Skip to content

feat(ui): add and show displayName for agents#798

Merged
PetrBulanek merged 4 commits intomainfrom
ui/agent-display-name
Jun 25, 2025
Merged

feat(ui): add and show displayName for agents#798
PetrBulanek merged 4 commits intomainfrom
ui/agent-display-name

Conversation

@PetrBulanek
Copy link
Contributor

Closes: #675

Signed-off-by: Petr Bulánek <bulanek.petr@gmail.com>
@PetrBulanek PetrBulanek requested review from jezekra1, penge and tomkis June 16, 2025 14:45
penge
penge previously requested changes Jun 17, 2025
Copy link
Contributor

@penge penge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest removing getAgentDisplayName and enriching the Agent object directly in the React Query hook — for example, by adding a label field.

metadata: { annotations },
} = agent;

return annotations?.display_name ?? name;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issues

  1. Hidden fallback: At first glance, getAgentDisplayName(agent) suggests it always returns display_name. The fallback to name isn't immediately obvious.
  2. Excessive indirection: A simple one-liner is extracted into a utility function used across many files, adding mental overhead and development friction.
  3. Import bloat: Importing getAgentDisplayName in multiple files clutters the codebase and reduces component readability.
  4. Risk of inconsistent usage: Developers might forget to use the function, leading to inconsistent display logic across the app.

Suggestion

The cleanest and most efficient approach is to augment the React Query hook directly.
For a field that prefers display_name but falls back to name, introduce a new field called label.


Benefits of augmenting the hook

  1. Centralized logic: The fallback is handled once inside the React Query hook. All consumers receive extended Agent objects automatically.
  2. Improved readability: Components simply use agent.label, with no need to understand or call a helper function.
  3. No redundant imports: No need to import a utility function in every file — the data comes ready to use.
  4. Scales cleanly: Additional fields can be added later without affecting consuming code.
  5. Type-safe and declarative: With a type like ExtendedAgent, it's immediately clear which fields are available — and why.

Example

In the hook:

.map((agent) => ({
  ...agent,
  label: agent.metadata?.annotations?.display_name ?? agent.name,
}))

In components:

{agent.label}

@tomkis
Copy link
Collaborator

tomkis commented Jun 18, 2025

This has to be reworked with the new Annotations metadata concept.

Signed-off-by: Petr Bulánek <bulanek.petr@gmail.com>

# Conflicts:
#	agents/community/aider/src/aider_agent/agent.py
#	agents/community/gpt-researcher/gpt_researcher_agent/agent.py
#	agents/community/literature-review/src/literature_review/agent.py
#	agents/community/marketing-strategy/src/marketing_strategy/agent.py
#	agents/community/ollama-deep-researcher/src/ollama_deep_researcher/agent.py
#	agents/official/beeai-framework/agent-docs-creator/src/agent_docs_creator/agent.py
#	agents/official/beeai-framework/chat/src/chat/agent.py
#	agents/official/beeai-framework/podcast-creator/src/podcast_creator/agent.py
#	agents/official/sequential-workflow/src/sequential_workflow/agent.py
#	apps/beeai-ui/src/modules/agents/api/types.ts
#	apps/beeai-ui/src/modules/agents/components/AgentDetail.tsx
#	apps/beeai-ui/src/modules/agents/components/ImportAgentsModal.tsx
#	apps/beeai-ui/src/modules/providers/hooks/useMonitorProviderStatus.ts
#	apps/beeai-ui/src/modules/runs/chat/Message.tsx
#	apps/beeai-ui/src/modules/runs/components/AgentRun.tsx
Signed-off-by: Petr Bulánek <bulanek.petr@gmail.com>
Signed-off-by: Petr Bulánek <bulanek.petr@gmail.com>

# Conflicts:
#	apps/beeai-ui/src/components/AgentsNav/AgentsNav.tsx
@PetrBulanek PetrBulanek requested a review from penge June 25, 2025 11:45
@PetrBulanek PetrBulanek dismissed penge’s stale review June 25, 2025 13:26

It's no longer valid after the changes.

@PetrBulanek PetrBulanek merged commit 3faaa95 into main Jun 25, 2025
7 checks passed
@PetrBulanek PetrBulanek deleted the ui/agent-display-name branch June 25, 2025 13:26
JanPokorny pushed a commit to markstur/agentstack that referenced this pull request Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Human readable name in GUI

4 participants