From d685d8193eea8123f7de933213bd8487faf03f02 Mon Sep 17 00:00:00 2001 From: A Vertex SDK engineer Date: Thu, 29 Jan 2026 09:22:35 -0800 Subject: [PATCH] feat: add agent_card to agent engine spec PiperOrigin-RevId: 862768189 --- vertexai/_genai/agent_engines.py | 12 ++++++++++++ vertexai/_genai/types/common.py | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/vertexai/_genai/agent_engines.py b/vertexai/_genai/agent_engines.py index d7864967c8..6ad21e886b 100644 --- a/vertexai/_genai/agent_engines.py +++ b/vertexai/_genai/agent_engines.py @@ -1318,6 +1318,18 @@ def _create_config( agent=agent, ) ) + + if hasattr(agent, "agent_card"): + agent_card = getattr(agent, "agent_card") + if agent_card: + try: + agent_engine_spec["agent_card"] = agent_card.model_dump( + exclude_none=True + ) + except TypeError as e: + raise ValueError( + f"Failed to convert agent card to dict (serialization error): {e}" + ) from e update_masks.append("spec.agent_framework") if identity_type is not None or service_account is not None: diff --git a/vertexai/_genai/types/common.py b/vertexai/_genai/types/common.py index ea4fddce9e..2716964936 100644 --- a/vertexai/_genai/types/common.py +++ b/vertexai/_genai/types/common.py @@ -5158,6 +5158,10 @@ class ReasoningEngineSpecSourceCodeSpecDict(TypedDict, total=False): class ReasoningEngineSpec(_common.BaseModel): """The specification of an agent engine.""" + agent_card: Optional[dict[str, Any]] = Field( + default=None, + description="""Optional. The A2A Agent Card for the agent (if available). It follows the specification at https://a2a-protocol.org/latest/specification/#5-agent-discovery-the-agent-card.""", + ) agent_framework: Optional[str] = Field( default=None, description="""Optional. The OSS agent framework used to develop the agent. Currently supported values: "google-adk", "langchain", "langgraph", "ag2", "llama-index", "custom".""", @@ -5195,6 +5199,9 @@ class ReasoningEngineSpec(_common.BaseModel): class ReasoningEngineSpecDict(TypedDict, total=False): """The specification of an agent engine.""" + agent_card: Optional[dict[str, Any]] + """Optional. The A2A Agent Card for the agent (if available). It follows the specification at https://a2a-protocol.org/latest/specification/#5-agent-discovery-the-agent-card.""" + agent_framework: Optional[str] """Optional. The OSS agent framework used to develop the agent. Currently supported values: "google-adk", "langchain", "langgraph", "ag2", "llama-index", "custom"."""