fix(a2a): return 404 from get_agent_card when agent has no card

This commit is contained in:
mateo-berri 2026-05-28 04:26:00 +00:00
parent 59e36bcfb4
commit da4d9ce4e5
No known key found for this signature in database

View file

@ -258,9 +258,17 @@ async def get_agent_card(
detail=f"Agent '{agent_id}' is not allowed for your key/team. Contact proxy admin for access.",
)
if not agent.agent_card_params:
raise HTTPException(
status_code=404,
detail=f"Agent '{agent_id}' has no agent card configured",
)
# Copy and rewrite URL to point to LiteLLM proxy
agent_card = dict(agent.agent_card_params)
agent_card["url"] = f"{str(request.base_url).rstrip('/')}/a2a/{agent_id}"
agent_card = {
**agent.agent_card_params,
"url": f"{str(request.base_url).rstrip('/')}/a2a/{agent_id}",
}
verbose_proxy_logger.debug(
f"Returning agent card for '{agent_id}' with proxy URL: {agent_card['url']}"