handoff
AI Agent Handoff functionality for agent-to-agent delegation. This module provides handoff capabilities that allow agents to delegate tasks to other agents, similar to the OpenAI Agents SDK implementation. Unified Handoff System:- Handoff: LLM-driven (tool call) or programmatic agent-to-agent transfer
- HandoffConfig: Configuration for context policy, timeouts, concurrency, safety
- Replaces/absorbs Agent.delegate() and SubagentDelegator functionality
Import
Classes
ContextPolicy
Policy for context sharing during handoff.
HandoffConfig
Unified configuration for handoff behavior.
HandoffError
Base exception for handoff errors.
HandoffCycleError
Raised when a cycle is detected in handoff chain.
HandoffDepthError
Raised when max handoff depth is exceeded.
HandoffTimeoutError
Raised when handoff times out.
HandoffInputData
Data passed to a handoff target agent.
HandoffResult
Result of a handoff operation.
Handoff
Represents a handoff configuration for delegating tasks to another agent.
handoff_filters
Common handoff input filters.
Functions
handoff()
Create a handoff configuration for delegating tasks to another agent.
prompt_with_handoff_instructions()
Add handoff instructions to an agent’s prompt.
Constants
| Name | Value |
|---|---|
RECOMMENDED_PROMPT_PREFIX | 'You have the ability to transfer tasks to specialized agents when appropriate. \nWhen you determine that a task would be better handled by another agent with specific expertise, \nuse the transfer to... |

