handoff • AI Agent SDK
Handoff functionality for agent-to-agent delegation.
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
from praisonaiagents.agent import handoffClasses
Policy for context sharing during handoff.
HandoffToolPolicyPolicy for tool boundary enforcement during handoff.
HandoffConfigUnified configuration for handoff behavior.
HandoffInputDataData passed to a handoff target agent.
HandoffResultResult of a handoff operation.
HandoffRepresents a handoff configuration for delegating tasks to another agent.
handoff_filtersCommon handoff input filters.
TypedHandoffTyped handoff with schema validation using Pydantic models.
Functions
Create a handoff configuration for delegating tasks to another agent.
parallel_handoffs()Execute multiple handoffs in parallel with concurrency control.
prompt_with_handoff_instructions()Add handoff instructions to an agent’s prompt.
Constants
| Name | Value |
|---|---|
_HANDOFF_SEED_LOCK_INIT_GUARD | threading.Lock() |
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... |
T | TypeVar('T', bound=BaseModel) |