From a294fbea7962217ef1ad0cca6fbb2b23ba34de65 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Thu, 28 May 2026 04:09:49 +0000 Subject: [PATCH] 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. --- litellm/proxy/_lazy_features.py | 5 ++++- litellm/proxy/agent_endpoints/endpoints.py | 5 ----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/litellm/proxy/_lazy_features.py b/litellm/proxy/_lazy_features.py index 4d9bf767830..f1b5cade4f6 100644 --- a/litellm/proxy/_lazy_features.py +++ b/litellm/proxy/_lazy_features.py @@ -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", diff --git a/litellm/proxy/agent_endpoints/endpoints.py b/litellm/proxy/agent_endpoints/endpoints.py index 7de4297cdb2..991836bc903 100644 --- a/litellm/proxy/agent_endpoints/endpoints.py +++ b/litellm/proxy/agent_endpoints/endpoints.py @@ -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]