Overview
Add a force_handoff: <agent_name> parameter to agent configurations to guarantee a transition to a specific agent when the current one finishes, bypassing the LLM entirely.
Motivation
Relying on LLMs to reliably call handoff or transfer tools is inherently flaky. Even with strict system prompts, LLMs can ignore the tool, hallucinate, or get stuck in loops. This parameter provides a native way to enforce deterministic routing.
Use Cases
- Strict Pipelines: Unconditional handoffs or transfer where autonomy isn't needed (e.g.,
DataExtractor always hands off to Summarizer).
- Setup/Teardown: Guaranteed transitions like
SetupAgent -> ExecutionAgent -> CleanupAgent.
- Escalation: Hardcoded logic to ensure an issue reaches a
SpecialistAgent without relying on the LLM's decision-making.
Proposed Solution
Introduce a new field in the agent configuration:
agents:
researcher:
model: ...
force_handoff: writer_agent # or force_transfer: writer_agent
Implementation: When the current agent reaches a natural stop (e.g., generates a final text response), the orchestrator intercepts the finish state and automatically routes to the target agent, carrying over the context.
Overview
Add a
force_handoff: <agent_name>parameter to agent configurations to guarantee a transition to a specific agent when the current one finishes, bypassing the LLM entirely.Motivation
Relying on LLMs to reliably call handoff or transfer tools is inherently flaky. Even with strict system prompts, LLMs can ignore the tool, hallucinate, or get stuck in loops. This parameter provides a native way to enforce deterministic routing.
Use Cases
DataExtractoralways hands off toSummarizer).SetupAgent->ExecutionAgent->CleanupAgent.SpecialistAgentwithout relying on the LLM's decision-making.Proposed Solution
Introduce a new field in the agent configuration:
Implementation: When the current agent reaches a natural stop (e.g., generates a final text response), the orchestrator intercepts the finish state and automatically routes to the target agent, carrying over the context.