handoff
Function
This function is defined in the handoff module.
Create a handoff configuration for delegating tasks to another agent.
This is a convenience function that creates a Handoff instance with the
specified configuration. It supports both the legacy API and the new
unified HandoffConfig.
Signature
def handoff(agent: 'Agent', tool_name_override: Optional[str], tool_description_override: Optional[str], on_handoff: Optional[Callable], input_type: Optional[type], input_filter: Optional[Callable[[HandoffInputData], HandoffInputData]], config: Optional[HandoffConfig], context_policy: Optional[str], timeout_seconds: Optional[float], max_concurrent: Optional[int], detect_cycles: Optional[bool], max_depth: Optional[int]) -> Handoff
Parameters
The target agent to hand off to
Custom tool name (defaults to transfer_to_<agent_name>)
tool_description_override
Custom tool description
Callback function executed when handoff is invoked
Type of input expected by the handoff (for structured data)
Function to filter/transform input before passing to target agent
HandoffConfig for advanced settings
Shorthand for config.context_policy (“full”, “summary”, “none”, “last_n”)
Shorthand for config.timeout_seconds
Shorthand for config.max_concurrent
Shorthand for config.detect_cycles
Shorthand for config.max_depth
Returns
A configured Handoff instance
Usage
from praisonaiagents import Agent, handoff, HandoffConfig
billing_agent = Agent(name="Billing Agent")
refund_agent = Agent(name="Refund Agent")
# Simple usage
triage_agent = Agent(
name="Triage Agent",
handoffs=[billing_agent, handoff(refund_agent)]
)
# With config
triage_agent = Agent(
name="Triage Agent",
handoffs=[
handoff(billing_agent, context_policy="summary", timeout_seconds=60),
handoff(refund_agent, config=HandoffConfig(detect_cycles=True))
]
)