> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # onDebugEvent > Lifecycle hook called when a debug event webhook is received. [enable-debug-events]: /docs/server-sdks/reference/typescript/agents/agent-base/enable-debug-events Lifecycle hook called when a debug event webhook is received at the `/debug_events` endpoint. Override this method in a subclass to react to events programmatically. > **Note** > > [`enableDebugEvents()`][enable-debug-events] must be called before events will be delivered. ## **Parameters** **`event`** `Record` — required The debug event payload, including fields like `call_id`, `label`, and event-specific data. --- ## **Returns** `void | Promise` ## **Example** ```typescript {10} import { AgentBase } from '@signalwire/sdk'; class DebugAgent extends AgentBase { constructor() { super({ name: 'debug-agent', route: '/debug' }); this.setPromptText('You are a helpful assistant.'); this.enableDebugEvents(1); } override async onDebugEvent( event: Record, ): Promise { const label = event.label as string; if (label === 'llm_error') { console.log('LLM error:', event); } else if (label === 'barge') { console.log(`Barge detected: ${event.barge_elapsed_ms}ms`); } } } const agent = new DebugAgent(); await agent.serve(); ``` > Lifecycle hook called when a debug event webhook is received.