MCPcopy Create free account
hub / github.com/google/adk-python / _get_output_schema

Function _get_output_schema

src/google/adk/tools/agent_tool.py:82–104  ·  view source on GitHub ↗

Extracts the output_schema from an agent. For LlmAgent, returns its output_schema directly. For agents with sub_agents, recursively searches the last sub-agent for an output_schema. Args: agent: The agent to extract output_schema from. Returns: The output_schema if found, None o

(agent: BaseAgent)

Source from the content-addressed store, hash-verified

80
81
82def _get_output_schema(agent: BaseAgent) -> Optional[SchemaType]:
83 """Extracts the output_schema from an agent.
84
85 For LlmAgent, returns its output_schema directly.
86 For agents with sub_agents, recursively searches the last sub-agent for an
87 output_schema.
88
89 Args:
90 agent: The agent to extract output_schema from.
91
92 Returns:
93 The output_schema if found, None otherwise.
94 """
95 from ..agents.llm_agent import LlmAgent
96
97 if isinstance(agent, LlmAgent):
98 return agent.output_schema
99
100 # For composite agents, check the last sub-agent
101 if agent.sub_agents:
102 return _get_output_schema(agent.sub_agents[-1])
103
104 return None
105
106
107class AgentTool(BaseTool):

Callers 3

_get_declarationMethod · 0.85
run_asyncMethod · 0.85
_get_declarationMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected