Skip to content

Commit 4a959d0

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
feat: add agent_card to agent engine spec
PiperOrigin-RevId: 821726573
1 parent f7e718f commit 4a959d0

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

12331245
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
@@ -4790,6 +4790,10 @@ class ReasoningEngineSpecSourceCodeSpecDict(TypedDict, total=False):
47904790
class ReasoningEngineSpec(_common.BaseModel):
47914791
"""The specification of an agent engine."""
47924792

4793+
agent_card: Optional[dict[str, Any]] = Field(
4794+
default=None,
4795+
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.""",
4796+
)
47934797
agent_framework: Optional[str] = Field(
47944798
default=None,
47954799
description="""Optional. The OSS agent framework used to develop the agent. Currently supported values: "google-adk", "langchain", "langgraph", "ag2", "llama-index", "custom".""",
@@ -4827,6 +4831,9 @@ class ReasoningEngineSpec(_common.BaseModel):
48274831
class ReasoningEngineSpecDict(TypedDict, total=False):
48284832
"""The specification of an agent engine."""
48294833

4834+
agent_card: Optional[dict[str, Any]]
4835+
"""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."""
4836+
48304837
agent_framework: Optional[str]
48314838
"""Optional. The OSS agent framework used to develop the agent. Currently supported values: "google-adk", "langchain", "langgraph", "ag2", "llama-index", "custom"."""
48324839

0 commit comments

Comments
 (0)