Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions vertexai/_genai/_agent_engines_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@
"ag2",
"llama-index",
"custom",
"a2a",
"a2a-google-adk"
]
)
_DEFAULT_ASYNC_METHOD_NAME = "async_query"
Expand Down
22 changes: 22 additions & 0 deletions vertexai/preview/reasoning_engines/templates/a2a.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,28 @@ def __init__(
self.rest_handler = None
self.task_store = None
self.agent_executor = None
self._set_agent_framework()

def _set_agent_framework(self):
"""Best effort detection of the underlying agent framework."""
self.agent_framework = "a2a"
agent_executor_builder = self._tmpl_attrs.get("agent_executor_builder")
if agent_executor_builder:
try:
from google.adk.a2a.executor.a2a_agent_executor import (
A2aAgentExecutor as AdkAgentExecutor,
)
# It's unlikely that the builder does any heavy lifting, so this
# shouldn't throw any exception.
executor = agent_executor_builder(
**self._tmpl_attrs.get("agent_executor_kwargs")
)
if isinstance(executor, AdkAgentExecutor): # type: ignore
# A2aAgentExecutor presence indicates a Google ADK agent
# since it requires a `google.adk.runners.Runner` to instantiate.
self.agent_framework = "a2a-google-adk"
except Exception:
pass

def clone(self) -> "A2aAgent":
"""Clones the A2A agent."""
Expand Down
Loading