> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Execute Programmatic • AI Agent SDK

> execute_programmatic: Execute typed handoff programmatically with schema validation.

# execute\_programmatic

Method

> This is a method of the [**TypedHandoff**](https://praison.ai/docs/sdk/reference/praisonaiagents/classes/TypedHandoff.md) class in the [**handoff**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/handoff.md) module.

Execute typed handoff programmatically with schema validation.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def execute_programmatic(source_agent: 'Agent', payload: Union[T, dict, str], context: Optional[Dict[str, Any]]) -> HandoffResult
```

## Parameters

**source\_agent** `Agent` *required*

The agent initiating the handoff

**payload** `Union[T, dict, str]` *required*

The typed payload (Pydantic model instance or dict) OR a string prompt (for backward compatibility)

**context** `Optional`

Optional additional context

### Returns

**Returns** `HandoffResult`

HandoffResult with response or error

### Exceptions

> [accordion] HandoffValidationError
>
> If payload validation fails

## Uses

* `execute_programmatic`
* `time.time`
* `validated_payload.model_dump_json`
* `json.dumps`
* `logger.info`
* `chat`
* `HandoffResult`
* `logger.error`

## Used By

* [`Agent.handoff_to`](../functions/Agent-handoff_to)
* [`TypedHandoff.execute_programmatic`](../functions/TypedHandoff-execute_programmatic)

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/agent/handoff.py#L1656)
>
> `praisonaiagents/agent/handoff.py` at line 1656


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.