Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

refactor(a2a): return a normalized card copy instead of mutating the resolved card

milande0d8ceb25ea
diff --git a/litellm/a2a_protocol/card_resolver.py b/litellm/a2a_protocol/card_resolver.py
index 47d6346b9a6..9b3e4ec13b9 100644
--- a/litellm/a2a_protocol/card_resolver.py
+++ b/litellm/a2a_protocol/card_resolver.py
@@ -67,11 +67,13 @@ def normalize_agent_card_protocol_bindings(agent_card: "AgentCard") -> "AgentCar
case-sensitively against its uppercase TransportProtocol constants and fails
with "no compatible transports found." for spec-adjacent casings.
"""
- for interface in agent_card.supported_interfaces:
+ normalized: Final = type(agent_card)()
+ normalized.CopyFrom(agent_card)
+ for interface in normalized.supported_interfaces:
canonical: str | None = _CANONICAL_PROTOCOL_BINDINGS.get(interface.protocol_binding.lower())
- if canonical is not None and canonical != interface.protocol_binding:
+ if canonical is not None:
interface.protocol_binding = canonical
- return agent_card
+ return normalized
def get_agent_card_url(agent_card: "AgentCard") -> str | None: