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

# Has Hook • AI Agent SDK

> has_hook: Check if any hooks are registered for an event. Simplified API.

# has\_hook

<div className="flex items-center gap-2">
  <Badge color="teal">Function</Badge>
</div>

> This function is defined in the [**registry**](../modules/registry) module.

Check if any hooks are registered for an event. Simplified API.

Accepts both string event names and HookEvent enums:
has\_hook('before\_tool')  # String
has\_hook(HookEvent.BEFORE\_TOOL)  # Enum

```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: has_hook"]
    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 has_hook(event: Union[str, HookEvent]) -> bool
```

## Parameters

<ParamField query="event" type="Union" required={true}>
  Hook event name or HookEvent enum
</ParamField>

### Returns

<ResponseField name="Returns" type="bool">
  True if hooks are registered for this event
</ResponseField>

### Exceptions

<AccordionGroup>
  <Accordion title="ValueError">
    If event string is not a valid HookEvent
  </Accordion>
</AccordionGroup>

## Uses

* `HookEvent`
* `ValueError`
* `has_hooks`
* `get_default_registry`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/hooks/registry.py#L416">
  `praisonaiagents/hooks/registry.py` at line 416
</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>
