What Is Agent Handoff?

Agent handoff is the mechanism by which one AI agent transfers control, context, and task responsibility to another agent in a multi-agent system. Learn how orchestrator-worker patterns, LangGraph, and CrewAI implement handoffs.

People collaborating around a table in a modern office, representing the transfer of tasks and responsibility between specialized team members
Photo by Annie Spratt on Unsplash

Term Snapshot

Also known as: Agent Transfer, Agent Routing, Agent Delegation

Related terms: What Are Multi-Agent Systems?, What Is AI Agent Orchestration?, What Is Human-in-the-Loop AI?, What Is AI Agent Planning?

Team of professionals working together around laptops in a collaborative office setting representing multi-agent orchestration
Photo by Annie Spratt on Unsplash

What Is Agent Handoff?

Quick Definition#

Agent handoff is the mechanism by which one AI agent transfers control, context, and responsibility for a task to a different agent within a multi-agent system. Rather than a single agent trying to handle every aspect of a complex task, handoffs allow work to flow to the agent best suited for each subtask — a research agent handing to a writing agent, a triage agent handing to a specialist, or an orchestrator distributing work across a pool of workers.

For foundational context, see Multi-Agent Systems and AI Agent Orchestration. Browse the full AI Agents Glossary to explore all related architecture concepts.

Why Agent Handoff Matters#

A single general-purpose agent can handle simple tasks end-to-end, but complex real-world workflows involve fundamentally different types of work: research, writing, code execution, data analysis, API integration, quality review. Trying to handle all of this with a single agent prompt leads to degraded performance because no single system prompt and context window can make the model excel at every specialization simultaneously.

Handoffs solve this by decomposing work at the architecture level. The orchestrator handles decomposition and routing. Specialist agents receive exactly the context they need for their domain and return a result the orchestrator can integrate or pass forward. The system becomes more capable, more debuggable, and easier to improve incrementally.

See Multi-Agent System Examples for concrete patterns where handoffs drive real business value.

When to Trigger a Handoff#

Not every step in an agent workflow requires a handoff. The decision to hand off should be driven by clear criteria:

Specialization#

The current agent reaches the boundary of its competence. A research agent has gathered sources but cannot write the final report in the required format — hand off to a writer agent with a specialized writing prompt.

Parallelization#

The task can be decomposed into independent workstreams that multiple agents can execute simultaneously. The orchestrator hands off each workstream to a separate worker rather than processing them sequentially. This is a primary performance optimization in production systems.

Error Recovery#

The current agent has failed a step or exceeded its retry budget. Rather than allowing unguided retrying, the orchestrator hands off to a recovery agent or escalates to a Human-in-the-Loop checkpoint with a structured error report.

Privilege Boundaries#

Certain actions require elevated permissions (database writes, email sending, external API calls with billing implications). A lower-privilege research agent hands off to a higher-privilege execution agent rather than holding broad permissions itself.

Domain Completion#

The current agent has finished its designated scope. A triage agent classifies an inbound request and hands off to the appropriate specialist with classification metadata included.

Routing vs. Handoff#

These terms are often used interchangeably but refer to distinct operations:

Routing is the decision layer — determining which agent or path should handle an input based on its content, type, or current state. A router might use an LLM classifier, a rule-based switch, or a semantic similarity comparison to determine the destination.

Handoff is the execution layer — the actual transfer of task ownership, including the payload of context the receiving agent needs. The handoff payload may include:

  • Conversation history (trimmed or summarized to fit the receiving agent's context window)
  • Structured task description generated by the sending agent
  • Memory state from a shared memory store
  • Intermediate results the sending agent produced
  • Instructions specific to what the receiving agent should do next

Routing without a thoughtful handoff payload produces agents that receive correct routing but insufficient context — they know they should act but not what they should know.

Orchestrator-Worker Pattern#

The most common handoff architecture is orchestrator-worker:

User Request
    ↓
Orchestrator Agent
    ├── Decomposes goal into subtasks
    ├── Routes each subtask to a specialist worker
    │       ├── Research Worker Agent
    │       ├── Writing Worker Agent
    │       └── Code Execution Worker Agent
    └── Aggregates results and synthesizes final response

The orchestrator maintains the high-level view — what needs to be done and in what order. Workers have narrow, deep system prompts that make them excellent at their specific domain. Orchestrators route and integrate; workers execute and return.

For implementation details, see Build an AI Agent with LangChain and Build an AI Agent with CrewAI.

LangGraph Handoff Patterns#

LangGraph models agent handoffs as state graph transitions. Each node in the graph is an agent or function. Edges define the routing logic. A handoff is a transition from one node to another, with the state object carrying context across the transition:

from langgraph.graph import StateGraph, END
from typing import TypedDict, Literal

class AgentState(TypedDict):
    task: str
    research_results: list
    draft: str
    current_agent: str

def orchestrator(state: AgentState) -> AgentState:
    # Decides which agent handles next
    if not state.get("research_results"):
        return {**state, "current_agent": "researcher"}
    elif not state.get("draft"):
        return {**state, "current_agent": "writer"}
    else:
        return {**state, "current_agent": "done"}

def route(state: AgentState) -> Literal["researcher", "writer", "__end__"]:
    agent = state["current_agent"]
    if agent == "done":
        return END
    return agent

graph = StateGraph(AgentState)
graph.add_node("orchestrator", orchestrator)
graph.add_node("researcher", researcher_agent)
graph.add_node("writer", writer_agent)
graph.add_conditional_edges("orchestrator", route)
graph.add_edge("researcher", "orchestrator")
graph.add_edge("writer", "orchestrator")
graph.set_entry_point("orchestrator")

Each agent returns an updated state. The orchestrator re-evaluates after each worker completes and routes to the next step. The state object is the handoff payload.

Team of professionals collaborating around laptops representing multi-agent orchestration and task delegation

CrewAI Handoff Patterns#

CrewAI implements handoffs through crew composition and task delegation. Agents are defined with specific roles and tools, and the crew's process determines how tasks flow between them:

from crewai import Agent, Task, Crew, Process

researcher = Agent(
    role="Research Specialist",
    goal="Find accurate information on the given topic",
    backstory="Expert at deep research and source verification",
    tools=[search_tool, scrape_tool]
)

writer = Agent(
    role="Content Writer",
    goal="Transform research into clear, structured reports",
    backstory="Expert technical writer specializing in AI topics",
    tools=[formatting_tool]
)

research_task = Task(
    description="Research the latest developments in {topic}",
    agent=researcher,
    expected_output="Bullet-pointed research summary with sources"
)

write_task = Task(
    description="Write a report based on the research provided",
    agent=writer,
    context=[research_task],  # Receives research_task output as context
    expected_output="Structured 500-word report"
)

crew = Crew(
    agents=[researcher, writer],
    tasks=[research_task, write_task],
    process=Process.sequential
)

The context parameter on a task is the handoff mechanism — it tells CrewAI to pass the output of research_task as additional context to the writer agent when it begins.

Human Handoff (HITL)#

A special case of agent handoff is transferring control to a human. This occurs when:

  • The agent lacks confidence in a decision above a risk threshold
  • An action is irreversible (sending an email, executing a financial transaction, deleting data)
  • A compliance requirement mandates human review
  • The agent has failed past a retry limit and cannot self-recover

Human handoffs should include a structured handoff payload that gives the human reviewer the same context they need that an agent would need: what was attempted, what the current state is, what the human needs to decide, and what the available options are. See Human-in-the-Loop AI for implementation patterns.

Context Loss: The Primary Handoff Failure#

The most common handoff failure is the receiving agent starting without enough context. This manifests as:

  • The receiving agent re-doing work the sending agent already completed
  • The receiving agent making decisions that contradict earlier decisions in the workflow
  • The receiving agent asking clarifying questions the user already answered

Prevention strategies:

  1. Explicit handoff summaries: Before handing off, the sending agent produces a structured summary of what it accomplished and what the receiving agent needs to know — rather than passing raw conversation history.

  2. Shared memory: Both agents read from and write to a shared memory store rather than relying solely on context window transfer.

  3. Handoff validation: After receiving the handoff, the receiving agent confirms it has the information needed to proceed before taking any action.

  4. Structured handoff schemas: Define what information must be present in every handoff for each transition type and validate it before the transfer completes.

Frequently Asked Questions#

What is agent handoff in multi-agent systems?#

Agent handoff is the process by which one agent transfers control of a task — along with relevant context, memory, and instructions — to another agent better suited to handle the next step. It enables specialization and parallelization in complex multi-agent pipelines.

What is the difference between routing and handoff?#

Routing is the decision of which agent should handle an input. Handoff is the execution of that decision including the transfer of context and state. Every handoff requires a routing decision, but routing does not always produce a handoff.

How do you prevent context loss during agent handoff?#

Use explicit handoff summaries (structured context rather than raw history), shared memory stores that both agents can access, handoff validation where the receiving agent confirms it has enough information, and structured handoff schemas that define required data for each transition type.