Execute Programmatic • AI Agent SDK

execute_programmatic: Execute handoff programmatically (not via LLM tool call).

execute_programmatic

Method

</div>

This is a method of the Handoff class in the handoff module.

Execute handoff programmatically (not via LLM tool call).

This is the unified programmatic handoff API that replaces Agent.delegate().

Signature

python
def execute_programmatic(source_agent: 'Agent', prompt: str, context: Optional[Dict[str, Any]]) -> HandoffResult

Parameters

ParamField Agent

The agent initiating the handoff

ParamField str

The task/prompt to pass to target agent

ParamField Optional

Optional additional context

Returns

ResponseField HandoffResult

HandoffResult with response or error

Uses

  • time.time
  • logger.info
  • HandoffResult
  • on_delegation
  • logger.warning
  • logger.error

Used By

Source

View on GitHub

praisonaiagents/agent/handoff.py at line 805