Skip to content

Commit d685d81

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
feat: add agent_card to agent engine spec
PiperOrigin-RevId: 862768189
1 parent 3c9128c commit d685d81

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

vertexai/_genai/agent_engines.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,6 +1318,18 @@ def _create_config(
13181318
agent=agent,
13191319
)
13201320
)
1321+
1322+
if hasattr(agent, "agent_card"):
1323+
agent_card = getattr(agent, "agent_card")
1324+
if agent_card:
1325+
try:
1326+
agent_engine_spec["agent_card"] = agent_card.model_dump(
1327+
exclude_none=True
1328+
)
1329+
except TypeError as e:
1330+
raise ValueError(
1331+
f"Failed to convert agent card to dict (serialization error): {e}"
1332+
) from e
13211333
update_masks.append("spec.agent_framework")
13221334

13231335
if identity_type is not None or service_account is not None:

vertexai/_genai/types/common.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5158,6 +5158,10 @@ class ReasoningEngineSpecSourceCodeSpecDict(TypedDict, total=False):
51585158
class ReasoningEngineSpec(_common.BaseModel):
51595159
"""The specification of an agent engine."""
51605160

5161+
agent_card: Optional[dict[str, Any]] = Field(
5162+
default=None,
5163+
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.""",
5164+
)
51615165
agent_framework: Optional[str] = Field(
51625166
default=None,
51635167
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):
51955199
class ReasoningEngineSpecDict(TypedDict, total=False):
51965200
"""The specification of an agent engine."""
51975201

5202+
agent_card: Optional[dict[str, Any]]
5203+
"""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."""
5204+
51985205
agent_framework: Optional[str]
51995206
"""Optional. The OSS agent framework used to develop the agent. Currently supported values: "google-adk", "langchain", "langgraph", "ag2", "llama-index", "custom"."""
52005207

0 commit comments

Comments
 (0)