Describe the bug
I have created an agent and I am passing a very simple input_schema:
class CountryInput(BaseModel):
country: str = Field(description="The country to get information about.")
This doesn't work, I get error:
{"error": "Failed to parse the parameter return_value: None of function CountryInput for automatic function calling. Automatic function calling works best with simpler function signature schema, consider manually parsing your function declaration for function CountryInput."}
However, in your documentation, this is exactly how you are explaining to use the input_schema with Pydantic classes:
https://google.github.io/adk-docs/agents/llm-agents/#putting-it-together-example
Note that the input_schema only crashes when assigned to AgentTool objects, not when assigned to the root_agent.
This defeats the point of an input_schema, because the input_schema is supposed to be assigned to sub-agents so the root_agent knows how to call them, right?
Fully reproducible code
from google.adk.agents import LlmAgent
from google.adk.tools.agent_tool import AgentTool
from pydantic import BaseModel, Field
MODEL_NAME = "gemini-2.5-flash-preview-05-20"
class CountryInput(BaseModel):
country: str = Field(description="The country to get information about.")
def get_capital_city(country: str) -> str:
"""Retrieves the capital city of a given country."""
country_capitals = {
"united states": "Washington, D.C.",
"canada": "Ottawa",
"france": "Paris",
"japan": "Tokyo",
}
result = country_capitals.get(country.lower(), f"Sorry, I couldn't find the capital for {country}.")
return result
weather_agent = LlmAgent(
model=MODEL_NAME,
name="capital_agent_tool",
description="Retrieves the capital city using a specific tool.",
instruction="""You are a helpful agent that provides the capital city of a country using a tool.
The user will provide the country name in a JSON format like {"country": "country_name"}.
1. Extract the country name.
2. Use the `get_capital_city` tool to find the capital.
3. Respond clearly to the user, stating the capital city found by the tool.
""",
tools=[get_capital_city],
input_schema=CountryInput,
output_key="weather_agent_state",
)
root_agent = LlmAgent(
model=MODEL_NAME,
name="root_agent",
description="Retrieves the capital city using a specific tool.",
tools=[AgentTool(agent=weather_agent)],
instruction="""Your job is to query the sub-agent as tool to get the capital city of a country.""",
output_key="root_state",
)
Error Log
venv➜ ava git:(master) ✗ adk web .
INFO: Started server process [1602]
INFO: Waiting for application startup.
+-----------------------------------------------------------------------------+
| ADK Web Server started |
| |
| For local testing, access at http://localhost:8000. |
+-----------------------------------------------------------------------------+
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: 127.0.0.1:59074 - "GET / HTTP/1.1" 307 Temporary Redirect
INFO: 127.0.0.1:59074 - "GET /list-apps?relative_path=./ HTTP/1.1" 200 OK
2025-05-30 14:08:20,678 - INFO - fast_api.py:457 - New session created
2025-05-30 14:08:20,678 - INFO - fast_api.py:457 - New session created
INFO: 127.0.0.1:59074 - "POST /apps/issue/users/user/sessions HTTP/1.1" 200 OK
INFO: 127.0.0.1:59075 - "GET /apps/issue/eval_results HTTP/1.1" 200 OK
INFO: 127.0.0.1:59074 - "GET /apps/issue/eval_sets HTTP/1.1" 200 OK
INFO: 127.0.0.1:59074 - "GET /apps/issue/users/user/sessions HTTP/1.1" 200 OK
INFO: 127.0.0.1:59074 - "GET /apps/issue/users/user/sessions HTTP/1.1" 200 OK
INFO: 127.0.0.1:59074 - "POST /run_sse HTTP/1.1" 200 OK
2025-05-30 14:08:22,041 - INFO - envs.py:47 - Loaded .env file for issue at /Users/vzegna/repos/ava/.env
2025-05-30 14:08:22,052 - ERROR - fast_api.py:817 - Error in event_generator: Failed to parse the parameter return_value: None of function CountryInput for automatic function calling. Automatic function calling works best with simpler function signature schema, consider manually parsing your function declaration for function CountryInput.
Traceback (most recent call last):
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/cli/fast_api.py", line 806, in event_generator
async for event in runner.run_async(
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/runners.py", line 196, in run_async
async for event in invocation_context.agent.run_async(invocation_context):
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/agents/base_agent.py", line 147, in run_async
async for event in self._run_async_impl(ctx):
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/agents/llm_agent.py", line 278, in _run_async_impl
async for event in self._llm_flow.run_async(ctx):
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 279, in run_async
async for event in self._run_one_step_async(invocation_context):
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 293, in _run_one_step_async
async for event in self._preprocess_async(invocation_context, llm_request):
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 335, in _preprocess_async
await tool.process_llm_request(
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/tools/base_tool.py", line 96, in process_llm_request
if (function_declaration := self._get_declaration()) is None:
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/tools/agent_tool.py", line 65, in _get_declaration
result = _automatic_function_calling_util.build_function_declaration(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/tools/_automatic_function_calling_util.py", line 232, in build_function_declaration
from_function_with_options(func, variant)
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/tools/_automatic_function_calling_util.py", line 336, in from_function_with_options
function_parameter_parse_util._parse_schema_from_parameter(
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/tools/function_parameter_parse_util.py", line 292, in _parse_schema_from_parameter
raise ValueError(
ValueError: Failed to parse the parameter return_value: None of function CountryInput for automatic function calling. Automatic function calling works best with simpler function signature schema, consider manually parsing your function declaration for function CountryInput.
2025-05-30 14:08:22,052 - ERROR - fast_api.py:817 - Error in event_generator: Failed to parse the parameter return_value: None of function CountryInput for automatic function calling. Automatic function calling works best with simpler function signature schema, consider manually parsing your function declaration for function CountryInput.
Traceback (most recent call last):
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/cli/fast_api.py", line 806, in event_generator
async for event in runner.run_async(
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/runners.py", line 196, in run_async
async for event in invocation_context.agent.run_async(invocation_context):
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/agents/base_agent.py", line 147, in run_async
async for event in self._run_async_impl(ctx):
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/agents/llm_agent.py", line 278, in _run_async_impl
async for event in self._llm_flow.run_async(ctx):
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 279, in run_async
async for event in self._run_one_step_async(invocation_context):
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 293, in _run_one_step_async
async for event in self._preprocess_async(invocation_context, llm_request):
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 335, in _preprocess_async
await tool.process_llm_request(
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/tools/base_tool.py", line 96, in process_llm_request
if (function_declaration := self._get_declaration()) is None:
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/tools/agent_tool.py", line 65, in _get_declaration
result = _automatic_function_calling_util.build_function_declaration(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/tools/_automatic_function_calling_util.py", line 232, in build_function_declaration
from_function_with_options(func, variant)
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/tools/_automatic_function_calling_util.py", line 336, in from_function_with_options
function_parameter_parse_util._parse_schema_from_parameter(
File "/Users/vzegna/repos/ava/venv/lib/python3.12/site-packages/google/adk/tools/function_parameter_parse_util.py", line 292, in _parse_schema_from_parameter
raise ValueError(
ValueError: Failed to parse the parameter return_value: None of function CountryInput for automatic function calling. Automatic function calling works best with simpler function signature schema, consider manually parsing your function declaration for function CountryInput.
INFO: 127.0.0.1:59074 - "GET /apps/issue/users/user/sessions/a28629b1-2dba-44e7-937a-f25e5ae99725 HTTP/1.1" 200 OK
INFO: 127.0.0.1:59075 - "GET /debug/trace/session/a28629b1-2dba-44e7-937a-f25e5ae99725 HTTP/1.1" 200 OK
Additional info
Run it with adk web .
ADK Framework version: 1.0.0
Describe the bug
I have created an agent and I am passing a very simple input_schema:
This doesn't work, I get error:
However, in your documentation, this is exactly how you are explaining to use the input_schema with Pydantic classes:
https://google.github.io/adk-docs/agents/llm-agents/#putting-it-together-example
Note that the input_schema only crashes when assigned to AgentTool objects, not when assigned to the root_agent.
This defeats the point of an input_schema, because the input_schema is supposed to be assigned to sub-agents so the root_agent knows how to call them, right?
Fully reproducible code
Error Log
Additional info
Run it with
adk web .ADK Framework version: 1.0.0