Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions apps/agentstack-cli/src/agentstack_cli/commands/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,11 @@ def search_path_match_providers(search_path: str, providers: list[Provider]) ->

def select_provider(search_path: str, providers: list[Provider]):
provider_candidates = search_path_match_providers(search_path, providers)
if len(provider_candidates) != 1:
provider_candidates = [f" - {c}" for c in provider_candidates]
remove_providers_detail = ":\n" + "\n".join(provider_candidates) if provider_candidates else ""
raise ValueError(f"{len(provider_candidates)} matching agents{remove_providers_detail}")
if len(provider_candidates) == 0:
raise ValueError(f"No agents matched '{search_path}'")
if len(provider_candidates) > 1:
candidates_detail = "\n".join(f" - {c}" for c in provider_candidates)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The error message for multiple matching agents lists provider IDs, which are not very user-friendly. It would be more helpful to display the agent name and a short form of the ID to help the user distinguish between the ambiguous options.

Suggested change
candidates_detail = "\n".join(f" - {c}" for c in provider_candidates)
candidates_detail = "\n".join(f" - {p.agent_card.name} ({p.id[:8]})" for p in provider_candidates.values())

raise ValueError(f"Multiple agents matched '{search_path}':\n{candidates_detail}")
[selected_provider] = provider_candidates.values()
return selected_provider

Expand Down Expand Up @@ -520,10 +521,10 @@ async def stream_logs(
],
):
"""Stream agent provider logs. [Admin only]"""
announce_server_action(f"Streaming logs for '{search_path}' from")
async with configuration.use_platform_client():
provider = select_provider(search_path, await Provider.list()).id
async for message in Provider.stream_logs(provider):
provider = select_provider(search_path, await Provider.list())
announce_server_action(f"Streaming logs for '{provider.agent_card.name}' from")
async for message in Provider.stream_logs(provider.id):
print_log(message, ansi_mode=True)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ async def stream_logs(self, *, provider_id: UUID, logs_container: LogsContainer)
except kr8s.NotFoundError:
...
if not missing_logged:
logs_container.add_stdout("Provider is not running, run a query to start it up...")
logs_container.add_stdout("Agent is starting up...")
missing_logged = True
await asyncio.sleep(1)

Expand Down