Skip to content

Forced handoff or transfer for more reliable workflows #3078

@Matheus-Garbelini

Description

@Matheus-Garbelini

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

  1. Strict Pipelines: Unconditional handoffs or transfer where autonomy isn't needed (e.g., DataExtractor always hands off to Summarizer).
  2. Setup/Teardown: Guaranteed transitions like SetupAgent -> ExecutionAgent -> CleanupAgent.
  3. 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.

Metadata

Metadata

Assignees

Labels

area/agentFor work that has to do with the general agent loop/agentic features of the apparea/configFor configuration parsing, YAML, environment variables
No fields configured for Enhancement.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions