Handoff To Async • AI Agent SDK
handoff_to_async: Asynchronously hand off a task to another agent.
handoff_to_async
Async
Method
</div>
Asynchronously hand off a task to another agent.
This is the async version of handoff_to() with concurrency control and timeout support.
Signature
async def handoff_to_async(target_agent: 'Agent', prompt: str, context: Optional[Dict[str, Any]], config: Optional['HandoffConfig']) -> 'HandoffResult'Parameters
ParamField
AgentThe agent to hand off to
ParamField
strThe task/prompt to pass to target agent
ParamField
OptionalOptional additional context dictionary
ParamField
Optional[HandoffConfig]Optional HandoffConfig for advanced settings
Returns
ResponseField
'HandoffResult'HandoffResult with response or error
Usage
result = await agent_a.handoff_to_async(agent_b, "Complete this analysis")
if result.success:
print(result.response)Uses
HandoffHandoffConfighandoff_obj.execute_async
Used By
Source
View on GitHubpraisonaiagents/agent/agent.py at line 5817