fix(a2a): scope a2a lazy-feature so it doesn't subsume /v1/a2a/discover

- _lazy_features.py: use /a2a prefix + /message/send suffix for the
  a2a feature so a request to /v1/a2a/discover no longer triggers the
  a2a_endpoints module to load alongside a2a_registration.
- agent_endpoints/endpoints.py: drop the no-op description override
  kwarg from _build_merged_agent_card and its three call sites. The
  upstream card's description is already preserved by merge_agent_card's
  deepcopy, so passing it explicitly did nothing.
This commit is contained in:
mateo-berri 2026-05-28 04:09:49 +00:00
parent 2cb4a8c254
commit a294fbea79
No known key found for this signature in database
2 changed files with 4 additions and 6 deletions

View file

@ -92,7 +92,10 @@ LAZY_FEATURES: Tuple[LazyFeature, ...] = (
LazyFeature(
name="a2a",
module_path="litellm.proxy.agent_endpoints.a2a_endpoints",
path_prefixes=("/a2a", "/v1/a2a"),
# ``/v1/a2a/{agent_id}/message/send`` is caught via the suffix so the
# ``/v1/a2a`` prefix doesn't subsume the discover prefix below.
path_prefixes=("/a2a",),
path_suffixes=("/message/send",),
),
LazyFeature(
name="a2a_registration",

View file

@ -49,7 +49,6 @@ def _build_merged_agent_card(
agent_id: str,
http_request: Request,
agent_name: Optional[str] = None,
description: Optional[str] = None,
) -> Dict[str, Any]:
"""Apply the LiteLLM-fronting merge to ``upstream_card`` for ``agent_id``."""
proxy_base = _proxy_base_url(http_request)
@ -58,7 +57,6 @@ def _build_merged_agent_card(
proxy_url=f"{proxy_base}/a2a/{agent_id}",
proxy_base_url=proxy_base,
name=agent_name,
description=description,
)
@ -390,7 +388,6 @@ async def create_agent(
agent_id=new_agent_id,
http_request=http_request,
agent_name=request.get("agent_name"),
description=upstream_card.get("description"),
)
agent_to_create = {**request, "agent_card_params": merged_card} # type: ignore[typeddict-item]
@ -599,7 +596,6 @@ async def update_agent(
agent_id=agent_id,
http_request=http_request,
agent_name=request.get("agent_name"),
description=upstream_card.get("description"),
)
agent_to_update = {**request, "agent_card_params": merged_card} # type: ignore[typeddict-item]
@ -711,7 +707,6 @@ async def patch_agent(
agent_id=agent_id,
http_request=http_request,
agent_name=request.get("agent_name"),
description=upstream_card.get("description"),
)
patch_payload = {**request, "agent_card_params": merged_card} # type: ignore[typeddict-item]