> ## 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 • AI Agent SDK

> execute: Execute all hooks for an event.

# execute

<div className="flex items-center gap-2">
  <Badge color="blue">Async</Badge>
  <Badge color="purple">Method</Badge>
</div>

> This is a method of the [**HookRunner**](../classes/HookRunner) class in the [**runner**](../modules/runner) module.

Execute all hooks for an event.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
async def execute(event: HookEvent, input_data: HookInput, target: Optional[str]) -> List[HookExecutionResult]
```

## Parameters

<ParamField query="event" type="HookEvent" required={true}>
  The event to execute hooks for
</ParamField>

<ParamField query="input_data" type="HookInput" required={true}>
  Input data for the hooks
</ParamField>

<ParamField query="target" type="Optional" required={false}>
  Optional target to filter hooks (e.g., tool name)
</ParamField>

### Returns

<ResponseField name="Returns" type="List[HookExecutionResult]">
  List of execution results
</ResponseField>

## Uses

* `get_hooks`

## Used By

* [`CodeAgent.execute_code`](../functions/CodeAgent-execute_code)
* [`CodeAgent.aexecute`](../functions/CodeAgent-aexecute)
* [`MiddlewareManager.execute_model_call`](../functions/MiddlewareManager-execute_model_call)
* [`MiddlewareManager.execute_tool_call`](../functions/MiddlewareManager-execute_tool_call)
* [`HookRunner.execute_sync`](../functions/HookRunner-execute_sync)

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/hooks/runner.py#L82">
  `praisonaiagents/hooks/runner.py` at line 82
</Card>
