***

title: enable_debug_events
slug: /reference/python/agents/agent-base/enable-debug-events
description: Enable real-time debug event webhooks from the AI module during calls.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[on-debug-event]: /docs/server-sdks/reference/python/agents/agent-base/on-debug-event

[ref-agentbase]: /docs/server-sdks/reference/python/agents/agent-base

Enable real-time debug event webhooks from the AI module during calls. When enabled,
the SDK automatically wires a `debug_webhook_url` into the AI parameters and registers
a `/debug_events` endpoint that receives event POSTs from the SignalWire platform.

Events are logged via the agent's structured logger. Optionally, register a custom
handler with [`on_debug_event()`][on-debug-event] to react to events programmatically.

## **Parameters**

<ParamField path="level" type="int" default="1" toc={true}>
  Debug event verbosity level.

  * `1` -- High-level events: barge, errors, session start/end, step changes
  * `2+` -- Adds high-volume events: every LLM request/response, `conversation_add`
</ParamField>

## **Returns**

[`AgentBase`][ref-agentbase] -- Returns self for method chaining.

## **Example**

```python {5}
from signalwire import AgentBase

agent = AgentBase(name="debug-agent", route="/debug")
agent.set_prompt_text("You are a helpful assistant.")
agent.enable_debug_events(level=1)
agent.serve()
```