- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.1k
Closed
Closed
Copy link
Labels
core[Component] This issue is related to the core interface and implementation[Component] This issue is related to the core interface and implementation
Milestone
Description
Background
Since commit af63567 (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 = TrueWhy 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
- output_schema cannot co-exist with agent transfer configurations #1910 - Original issue reporting this limitation
Technical Details
- Restriction location: src/google/adk/agents/llm_agent.py:750-771
- Related commit: af63567
- 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
RaffaelloRalf
Metadata
Metadata
Assignees
Labels
core[Component] This issue is related to the core interface and implementation[Component] This issue is related to the core interface and implementation