Calls

AI debug webhook

A live feed of what the agent is doing, sent to your ai.params.debug_webhook_url while the call is still running. Use it to act mid-call, such as paging a supervisor or flagging a handoff. For analysis after the call, use the AI post-prompt callback instead.

Each request carries call_info plus one or more event properties, where the property name is the event. One moment can produce several: evaluating a data_map webhook sends webhook, input, output, error_keys, and match together. Handle the properties you recognize and ignore the rest, since the set grows over time. An event with no data arrives as null, so test whether the property is present rather than what it holds.

Setting the URL enables the feed. debug_webhook_level only widens it: at 2 it also carries conversation_add, llm_request, and llm_response, which fire on every turn and every model call.

postWebhookaiDebugWebhook

Payload

swaig_callobject

A completed tool call, as one entry of the swaig_log the post-prompt callback reports at the end. Carries command_name, command_arg, epoch_time in seconds, and, for a tool that reached your server, url, post_data, and post_response.

process_actionobject

A tool returned a SWAIG action. Carries the action exactly as your endpoint returned it.

webhookobject

A data_map webhook was evaluated. Carries the webhook definition as you wrote it. Arrives alongside input, and alongside output and match when the call produced a reply, or error when the definition was unusable.

inputobject

The body sent to a data_map webhook, or the input a data_map output template was expanded against.

outputobject nullable

The reply a data_map webhook produced, or the output template that matched. null when nothing matched.

matchobject nullable

The data_map entry that matched. null when none did.

expressionobject

A data_map expressions entry was evaluated. Carries the entry as you wrote it, alongside input and output.

webhook_replyobject nullable

The final reply a data_map webhook produced, after matching. An array reply is wrapped as { "array": [...] }.

Example payload

{
  "call_info": {
    "project_id": "4d0d6f16-5881-4fcc-92a4-02c51a91954d",
    "space_id": "451ed9ff-e568-4222-8af9-4f9ab7428d09",
    "call_id": "2e1e66e5-5d07-413d-9668-55542992eec0",
    "content_type": "text/json",
    "content_disposition": "post_data",
    "conversation_type": "voice"
  },
  "session_start": {
    "model": "gpt-4.1-mini",
    "tts_engine": "elevenlabs",
    "tts_voice": "rachel",
    "language": "en-US",
    "mode": "oart",
    "rate": 24000,
    "audio_format": "pcm16",
    "tool_model": "gpt-4.1-mini",
    "local_vad": true
  },
  "session_end": {
    "reason": "normal",
    "ended_by": "assistant",
    "duration_ms": 37651,
    "input_tokens": 5627,
    "output_tokens": 119
  },
  "startup_hook": {
    "duration_ms": 214,
    "success": true,
    "error": "execution failed"
  },
  "hangup_hook": {
    "duration_ms": 186,
    "success": true,
    "error": "execution failed"
  },
  "speech_detect": {
    "text": "I need a ride to the airport.",
    "source": "final"
  },
  "barge": {
    "barge_type": "normal",
    "barge_elapsed_ms": 1240,
    "interrupt_count": 2,
    "audio_played_ms": 1240,
    "barge_count": 2
  },
  "ai_completion": {
    "type": "normal"
  },
  "filler": {
    "text": "Let me check on that.",
    "filler_type": "function"
  },
  "attention_timeout": {
    "timeout_ms": 15000
  },
  "hold": {
    "event": "hold",
    "timeout": 30
  },
  "function_call": {
    "function": "get_weather",
    "duration_ms": 412,
    "shadow": true,
    "phase": "post_prompt"
  },
  "function_loop": {
    "function": "get_weather",
    "type": "repeated",
    "count": 3
  },
  "tool_distill": {
    "function": "get_weather",
    "raw_chars": 8412,
    "distilled_chars": 612,
    "model": "gpt-4.1-mini"
  },
  "error": {
    "error": "ai: webhook error",
    "errorText": "Webhook obj must have output or expressions"
  },
  "webhook_log": {
    "request_url": "https://example.com/weather?city=Springfield"
  },
  "webhook_fail": {
    "call_info": {
      "project_id": "4d0d6f16-5881-4fcc-92a4-02c51a91954d",
      "space_id": "451ed9ff-e568-4222-8af9-4f9ab7428d09",
      "call_id": "2e1e66e5-5d07-413d-9668-55542992eec0",
      "content_type": "text/json",
      "content_disposition": "post_data",
      "conversation_type": "voice"
    },
    "error": "webhook error",
    "request_url": "https://example.com/tools/get_weather",
    "attempts": 3,
    "parse_error": true,
    "protocol_error": true,
    "curl_code": 28,
    "http_code": 502
  },
  "step_change": {
    "from_step": "greet",
    "to_step": "collect_address",
    "to_index": 1,
    "trigger": "ai_function"
  },
  "context_change": {
    "to_context": "billing",
    "from_context": "default",
    "trigger": "ai_function"
  },
  "gather_start": {
    "context": "default",
    "step": "collect_address",
    "step_index": 2,
    "output_key": "address",
    "total_questions": 3
  },
  "gather_question": {
    "context": "default",
    "step": "collect_address",
    "step_index": 2,
    "key": "street",
    "question_type": "string",
    "requires_confirm": true
  },
  "gather_answer": {
    "context": "default",
    "step": "collect_address",
    "step_index": 2,
    "key": "street",
    "confirmed": true
  },
  "gather_reject": {
    "context": "default",
    "step": "collect_address",
    "step_index": 2,
    "key": "street",
    "reason": "missing_answer"
  },
  "gather_complete": {
    "context": "default",
    "step": "collect_address",
    "step_index": 2,
    "output_key": "address",
    "answered": 3,
    "completion_action": "next_step"
  },
  "conversation_add": {
    "role": "assistant",
    "content": "Your ride is booked for 6pm.",
    "lang": "en-US",
    "tokens": 53,
    "timestamp": 1694541297950440
  },
  "llm_request": {
    "model": "gpt-4.1-mini",
    "prompt_tokens": 412,
    "conversation_tokens": 5215
  },
  "llm_response": {
    "model": "gpt-4.1-mini",
    "output_tokens": 53,
    "duration_ms": 836,
    "success": true
  },
  "llm_error": {
    "event": "llm_retry",
    "model": "gpt-4.1-mini",
    "token_count": 128000,
    "limit": 120000,
    "errors": 4,
    "reasoning_effort": "high"
  },
  "consolidation": {
    "event": "consolidation",
    "token_count": 121400,
    "limit": 120000
  },
  "summarize_start": {
    "mode": "function",
    "model": "gpt-4.1-mini"
  },
  "post_prompt": {
    "url": "https://example.com/reports"
  },
  "text_normalize": {
    "direction": "itn",
    "language": "en",
    "original": "twenty twenty six",
    "normalized": "2026"
  },
  "voice_error": {
    "event": "voice_config_error",
    "engine": "elevenlabs",
    "voice": "rachel",
    "fallback_engine": "gcloud",
    "fallback_voice": "en-US-Neural2-J"
  },
  "warning": {
    "event": "excessive_prompt_tokens",
    "tokens": 82000
  },
  "oart_user_transcript": {
    "text": "I need a ride to the airport."
  },
  "oart_assistant_transcript": {
    "text": "Your ride is booked for 6pm."
  },
  "oart_response_done": {
    "latency": 836,
    "utterance_latency": 934,
    "audio_latency": 1106,
    "acoustic_latency": 1180,
    "status": "completed"
  },
  "inner_dialog": {
    "text": "The caller has not given a pickup address yet."
  }
}

Response

Webhook received

Changes