Describe the bug
When creating agents, it is possible to specify both an output_schema and tools. However, the current documentation does not mention any restriction or limitation when using these two parameters together.
If both parameters are provided, a runtime error occurs. This is a known limitation: due to how output_schema is implemented, an agent cannot both enforce an output schema and call tools directly. The current expected workaround is to create a separate sub-agent responsible for calling the tool.
To Reproduce
Steps to reproduce the behavior:
- Create an agent with the following code:
Agent(
name="task_planner",
model=create_litellm_model(model_name, api_base),
instruction=(
"You are a task planner. Return a JSON object with title, steps (array), "
"and estimated_time (integer). Return ONLY valid JSON, nothing else."
),
tools=[dummy_tool],
output_schema=TaskPlan,
output_key="task_plan",
)
Expected behavior
- A clear runtime error (or static type error) explaining that tools and output_schema cannot be used together.
- Updated documentation with a more explicit and visible note in the parameter descriptions explaining this limitation.
Screenshots
See the mentioned issue
Versions
- OS: macOS
- ADK version: 1.21
- Python version: 3.11
Additional context
See the following issue google/adk-python#3969 (comment)
Describe the bug
When creating agents, it is possible to specify both an output_schema and tools. However, the current documentation does not mention any restriction or limitation when using these two parameters together.
If both parameters are provided, a runtime error occurs. This is a known limitation: due to how output_schema is implemented, an agent cannot both enforce an output schema and call tools directly. The current expected workaround is to create a separate sub-agent responsible for calling the tool.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Screenshots
See the mentioned issue
Versions
Additional context
See the following issue google/adk-python#3969 (comment)