Handoff To Async • AI Agent SDK

handoff_to_async: Asynchronously hand off a task to another agent.

handoff_to_async

Async

Method

</div>

This is a method of the Agent class in the agent module.

Asynchronously hand off a task to another agent.

This is the async version of handoff_to() with concurrency control and timeout support.

Signature

python
async def handoff_to_async(target_agent: 'Agent', prompt: str, context: Optional[Dict[str, Any]], config: Optional['HandoffConfig']) -> 'HandoffResult'

Parameters

ParamField Agent

The agent to hand off to

ParamField str

The task/prompt to pass to target agent

ParamField Optional

Optional additional context dictionary

ParamField Optional[HandoffConfig]

Optional HandoffConfig for advanced settings

Returns

ResponseField 'HandoffResult'

HandoffResult with response or error

Usage

python
result = await agent_a.handoff_to_async(agent_b, "Complete this analysis")
    if result.success:
        print(result.response)

Uses

  • Handoff
  • HandoffConfig
  • handoff_obj.execute_async

Used By

Source

View on GitHub

praisonaiagents/agent/agent.py at line 5817


Related Documentation