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

# on • AI Agent SDK

> on: Register an event handler.

# on

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

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

Register an event handler.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def on(event_type: EventType, handler: Callable[[ObservabilityEvent], None]) -> Any
```

## Parameters

<ParamField query="event_type" type="EventType" required={true}>
  Type of event to handle
</ParamField>

<ParamField query="handler" type="Callable" required={true}>
  Handler function
</ParamField>

### Returns

<ResponseField name="Returns" type="Any">
  The result of the operation.
</ResponseField>

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/escalation/observability.py#L154">
  `praisonaiagents/escalation/observability.py` at line 154
</Card>
