Skip to main content

handoff_to_async

AsyncMethod
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

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

Parameters

target_agent
Agent
required
The agent to hand off to
prompt
str
required
The task/prompt to pass to target agent
context
Optional
Optional additional context dictionary
config
Optional
Optional HandoffConfig for advanced settings

Returns

Returns
'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)