Skip to content

Commit 44022bd

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
feat: add agent_card to agent engine spec
PiperOrigin-RevId: 821726573
1 parent 46285bf commit 44022bd

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
@@ -1229,6 +1229,18 @@ def _create_config(
12291229
agent=agent,
12301230
)
12311231
)
1232+
1233+
if hasattr(agent, "agent_card"):
1234+
agent_card = getattr(agent, "agent_card")
1235+
if agent_card:
1236+
try:
1237+
agent_engine_spec["agent_card"] = agent_card.model_dump(
1238+
exclude_none=True
1239+
)
1240+
except TypeError as e:
1241+
raise ValueError(
1242+
f"Failed to convert agent card to dict (serialization error): {e}"
1243+
) from e
12321244
update_masks.append("spec.agent_framework")
12331245

12341246
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
@@ -4797,6 +4797,10 @@ class ReasoningEngineSpecSourceCodeSpecDict(TypedDict, total=False):
47974797
class ReasoningEngineSpec(_common.BaseModel):
47984798
"""The specification of an agent engine."""
47994799

4800+
agent_card: Optional[dict[str, Any]] = Field(
4801+
default=None,
4802+
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.""",
4803+
)
48004804
agent_framework: Optional[str] = Field(
48014805
default=None,
48024806
description="""Optional. The OSS agent framework used to develop the agent. Currently supported values: "google-adk", "langchain", "langgraph", "ag2", "llama-index", "custom".""",
@@ -4834,6 +4838,9 @@ class ReasoningEngineSpec(_common.BaseModel):
48344838
class ReasoningEngineSpecDict(TypedDict, total=False):
48354839
"""The specification of an agent engine."""
48364840

4841+
agent_card: Optional[dict[str, Any]]
4842+
"""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."""
4843+
48374844
agent_framework: Optional[str]
48384845
"""Optional. The OSS agent framework used to develop the agent. Currently supported values: "google-adk", "langchain", "langgraph", "ag2", "llama-index", "custom"."""
48394846

0 commit comments

Comments
 (0)