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

# Register Function • AI Agent SDK

> register_function: Register a Python function as a hook.

# register\_function

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

Register a Python function as a hook.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def register_function(event: HookEvent, func: Callable[[HookInput], HookResult], matcher: Optional[str], name: Optional[str], description: Optional[str], sequential: bool, timeout: float, is_async: bool) -> str
```

## Parameters

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

<ParamField query="func" type="Callable" required={true}>
  The function to call
</ParamField>

<ParamField query="matcher" type="Optional" required={false}>
  Optional regex pattern to match targets
</ParamField>

<ParamField query="name" type="Optional" required={false}>
  Optional name for the hook
</ParamField>

<ParamField query="description" type="Optional" required={false}>
  Optional description
</ParamField>

<ParamField query="sequential" type="bool" required={false} default="False">
  Whether to run sequentially
</ParamField>

<ParamField query="timeout" type="float" required={false} default="60.0">
  Timeout in seconds
</ParamField>

<ParamField query="is_async" type="bool" required={false} default="False">
  Whether the function is async
</ParamField>

### Returns

<ResponseField name="Returns" type="str">
  The hook ID
</ResponseField>

## Uses

* `FunctionHook`
* `register`

## Used By

* [`HookRegistry.on`](../functions/HookRegistry-on)
* [`add_hook`](../functions/add_hook)

## Source

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