Execute Async • AI Agent SDK
execute_async: Execute typed handoff asynchronously with schema validation.
execute_async
Async
Method
</div>
This is a method of the TypedHandoff class in the handoff module.
Execute typed handoff asynchronously with schema validation.
Signature
async def execute_async(source_agent: 'Agent', payload: Union[T, dict, str], context: Optional[Dict[str, Any]]) -> HandoffResultParameters
ParamField
AgentThe agent initiating the handoff
ParamField
Union[T, dict, str]The typed payload (Pydantic model instance or dict) OR a string prompt (for backward compatibility)
ParamField
OptionalOptional additional context
Returns
ResponseField
HandoffResultHandoffResult with response or error
Exceptions
HandoffValidationError
If payload validation fails
Uses
execute_asynctime.timevalidated_payload.model_dump_jsonjson.dumpslogger.infoachatasyncio.get_event_looploop.run_in_executorHandoffResultasyncio.wait_for
Used By
Source
View on GitHubpraisonaiagents/agent/handoff.py at line 1770