Remove restriction: output_schema should coexist with agent transfer configurations
Background
Since commit af635674b5 (August 2025), ADK supports using output_schema alongside regular tools by introducing a set_model_response tool mechanism. However, the restriction preventing output_schema from coexisting with agent transfer configurations remains in place.
Current Behavior
When an agent has output_schema set, the validation in llm_agent.py:750-771 forcibly disables agent transfers:
def __check_output_schema(self):
if not self.output_schema:
return
if (
not self.disallow_transfer_to_parent
or not self.disallow_transfer_to_peers
):
logger.warning(
'Invalid config for agent %s: output_schema cannot co-exist with'
' agent transfer configurations. Setting'
' disallow_transfer_to_parent=True, disallow_transfer_to_peers=True',
self.name,
)
self.disallow_transfer_to_parent = True
self.disallow_transfer_to_peers = True
Why This Restriction Appears Outdated
- Agent transfers are implemented as tools (
transfer_to_agentintransfer_to_agent_tool.py) - The
set_model_responsemechanism works with any tools, including agent transfer tools - Both processors can coexist architecturally:
_OutputSchemaRequestProcessorhandles output_schema + tools_AgentTransferLlmRequestProcessoradds the transfer_to_agent tool- Both are already registered in
AutoFlow
There's no clear technical reason why agent transfers can't use the same workaround that regular tools use.
Valid Use Cases Being Blocked
From issue #1910:
- Structured output with post-processing: An agent with structured output and
after_agent_callbackthat needs to transfer to another agent after user review - Plugin-based transfers: Plugins that use
tool_context.actions.transfer_to_agentbased on structured output from an LlmAgent - Sequential agents with formatting: A sequential workflow where one agent does work and another formats the output with a schema
Proposed Solution
Remove or relax the validation that prevents output_schema from coexisting with agent transfer configurations, allowing the existing set_model_response mechanism to handle both regular tools and transfer tools.
Related Issues
- #1910 - Original issue reporting this limitation
Technical Details
- Restriction location:
src/google/adk/agents/llm_agent.py:750-771 - Related commit: af635674b5d3c128cf21737056e091646283aeb7
- Output schema processor:
src/google/adk/flows/llm_flows/_output_schema_processor.py - Agent transfer processor:
src/google/adk/flows/llm_flows/agent_transfer.py
Please add me as an assignee and I'll take a look at this issue
Is this fix available for typescript sdk? I do see the same issue with the latest version available, 0.2.4