> ## 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.

# Get Hooks • AI Agent SDK

> get_hooks: Get all hooks for an event, optionally filtered by target.

# get\_hooks

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

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

Get all hooks for an event, optionally filtered by target.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%

graph TD
    event["Event Trigger"] --> hook["Hook: get_hooks"]
    hook --> decision{"Decision"}
    decision -- "Allow" --> proc["Process"]
    decision -- "Deny" --> block["Block"]
    style hook fill:#189AB4,color:#fff
    style event fill:#8B0000,color:#fff
    style proc fill:#8B0000,color:#fff
    style block fill:#8B0000,color:#fff
```

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def get_hooks(event: HookEvent, target: Optional[str]) -> List[HookDefinition]
```

## Parameters

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

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

### Returns

<ResponseField name="Returns" type="List[HookDefinition]">
  List of matching hook definitions
</ResponseField>

## Uses

* `h.matches`

## Used By

* [`HookRegistry.has_hooks`](../functions/HookRegistry-has_hooks)
* [`HookRunner.execute`](../functions/HookRunner-execute)

## Source

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

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Hooks Concept" icon="anchor" href="/docs/concepts/hooks" />

  <Card title="Hook Events" icon="bolt" href="/docs/features/hook-events" />

  <Card title="Callbacks" icon="phone" href="/docs/features/callbacks" />
</CardGroup>
