how to see debug logs from underlying models? in m...
# ask-ai
a
how to see debug logs from underlying models? in my case i use OpenAI realtime
t
Thanks for reaching out, Sebastián. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're asking how to view debug logs from the underlying models when using OpenAI Realtime. Here's how you can get detailed traces and debug-level logs in LiveKit. 1. Enable Agent Observability • In LiveKit Cloud go to Project Settings > Data and privacy and enable Agent observability. 1. Use a supported Agents SDK version • Ensure your agent uses at least: ◦ Python SDK >= 1.3.0 ◦ Node.js SDK >= 1.0.18 1. Set log level to DEBUG • Start your agent with the debug log level so verbose logs are captured. Example for a Python agent in Docker:
Copy code
CMD ["python", "agent.py", "start", "--log-level=DEBUG"]
1. View logs & traces in the dashboard • Open your Project → Sessions → select a session → Agent insights. • Use the Logs timeline to view chronological debug/info/warn/error logs across agent code, media server, and client events. • Use the Trace view to inspect turn-by-turn model behavior (LLM timing, token usage, end-of-utterance events) to correlate model actions with logs. 1. CLI option (limited) • You can stream the latest agent instance logs with:
Copy code
lk agent logs
Note: CLI shows only the most recent agent instance. 1. Retention & persistence • Observability data is retained for 30 days. • For longer retention or external analysis, configure log forwarding (e.g., Datadog/Sentry) by adding the appropriate secrets like
DATADOG_TOKEN
. If you want, tell me: • which SDK (Python or Node) and version you’re running, and • whether you need help enabling log forwarding to Datadog or downloading a session’s logs—I’ll give the exact steps. Sources: Agent insights in LiveKit Cloud | LiveKit docs | Log collection | LiveKit Docs | https://blog.livekit.io/streamline-troubleshooting-with-agent-observability/#/portal/signup|
a
no but i want logs from the models, not from LiveKit and im running in dev model locally
t
Thanks — you're asking specifically for logs from the underlying OpenAI models themselves while running locally in dev mode (not LiveKit logs). Quick answers and options: • You cannot get internal debug logs from OpenAI’s hosted models (those internals are not exposed). • You can capture everything you control locally: enable DEBUG logging in your agent to record full API requests/responses, timings, and token usage while calling OpenAI. ◦ Python dev example:
Copy code
uv run agent.py dev --log-level=DEBUG
and configure Python logging with
logging.basicConfig(level=logging.DEBUG)
. • Node dev example:
Copy code
pnpm run dev --log-level=debug
• If you need true internal generation traces (per-token internals, step-by-step generation), run an OpenAI-compatible local model (Ollama, LiteLLM, vLLM, etc.) and point the OpenAI plugin to that local endpoint. That gives full visibility into model inputs, outputs, and generation logs. If you want, tell me: • which SDK (Python or Node) and version you’re using, and • whether you’d like step-by-step help switching to a local model (I can provide exact setup and config for Ollama or another shim). Sources: OpenAI LLM plugin guide | LiveKit Docs | Ollama LLM plugin guide | LiveKit Docs | Agent server options | LiveKit docs
a
in previous version i could use the variable:
LK_OPENAI_DEBUG=1
it no longer works
t
You're right to call that out —
LK_OPENAI_DEBUG=1
was removed and no longer works. Quick summary and next steps tailored to local dev: • LK_OPENAI_DEBUG is no longer supported. • You cannot access internal debug logs from OpenAI’s hosted models themselves — those internals are not exposed. • To get verbose local traces of the agent’s interactions with OpenAI, run your agent with debug log level: ◦ Python dev:
Copy code
uv run agent.py dev --log-level=DEBUG
• Node dev:
Copy code
pnpm run dev --log-level=debug
This will log full API requests/responses, timings, and helpful lifecycle events. • If you need deeper, per-token/generation internals, switch to a local OpenAI-compatible model (Ollama, vLLM, LiteLLM) and point the OpenAI plugin at that local endpoint — that allows full generation logs you can inspect. Tell me which SDK (Python or Node) and version you’re using and whether you want steps to: • enable
--log-level=DEBUG
in your current setup, or • configure Ollama (or another local shim) for full model internals — I’ll give exact commands and config. Sources: OpenAI and LiveKit | LiveKit docs | OpenAI Realtime API plugin guide | LiveKit docs | OpenAI and LiveKit partner to turn Advanced Voice into an API | Agent server options | LiveKit docs | https://blog.livekit.io/streamline-troubleshooting-with-agent-observability/#/portal/signup|
a
im seeing this behaviour and can't debug why no answer was generated:
Copy code
13:51:36.461 DEBUG  livekit.agents     pre-connect audio received  
                                         {"duration": 3.800000000000002, "track_id": "TR_AMoBW9oaRytDew", "participant": 
"", "channels": 1, "sample_rate": 48000, "room": "", "agent":
"ato-lk-agent-dev", "pid": 33409, "job_id": "AJ_fTWmAFwLo4zx", "room_id": "RM_2Ku6pbEKCBQG"}
    13:51:36.466 DEBUG  livekit.agents     pre-connect audio buffer pushed  
                                         {"duration": 3.7999999999999985, "track_id": "TR_AMoBW9oaRytDew", "participant": 
"", "room": "492b0ce9-97d8-44cc-8d0b-a07d7a20214f_Kyifw", "agent": "ato-lk-agent-dev", "pid": 33409, 
"job_id": "AJ_fTWmAFwLo4zx", "room_id": "RM_2Ku6pbEKCBQG"}
                 DEBUG  livekit.agents     start reading stream  
                                         {"participant": "", "source": "SOURCE_MICROPHONE", "room": 
"492b0ce9-97d8-44cc-8d0b-a07d7a20214f_Kyifw", "agent": "ato-lk-agent-dev", "pid": 33409, "job_id": "AJ_fTWmAFwLo4zx", "room_id": 
"RM_2Ku6pbEKCBQG"}
    13:51:36.836 INFO   events             User state changed from: listening to speaking  
                                 {"room": "492b0ce9-97d8-44cc-8d0b-a07d7a20214f_Kyifw", "agent": "ato-lk-agent-dev", "pid": 33409, "job_id": 
"AJ_fTWmAFwLo4zx", "room_id": "RM_2Ku6pbEKCBQG"}
    13:51:36.986 INFO   events             Connection quality changed: 2 for participant: agent-AJ_fTWmAFwLo4zx  
                                 {"room": "492b0ce9-97d8-44cc-8d0b-a07d7a20214f_Kyifw", "agent": "ato-lk-agent-dev", "pid": 33409, "job_id": 
"AJ_fTWmAFwLo4zx", "room_id": "RM_2Ku6pbEKCBQG"}
                 INFO   events             Connection quality changed: 2 for participant: device-492b0ce9-97d8-44cc-8d0b-a07d7a20214f  
                                 {"room": "492b0ce9-97d8-44cc-8d0b-a07d7a20214f_Kyifw", "agent": "ato-lk-agent-dev", "pid": 33409, "job_id": 
"AJ_fTWmAFwLo4zx", "room_id": "RM_2Ku6pbEKCBQG"}
    13:51:37.008 INFO   events             User state changed from: speaking to listening  
                                 {"room": "492b0ce9-97d8-44cc-8d0b-a07d7a20214f_Kyifw", "agent": "ato-lk-agent-dev", "pid": 33409, "job_id": 
"AJ_fTWmAFwLo4zx", "room_id": "RM_2Ku6pbEKCBQG"}
                 DEBUG  livekit.agents     input stream detached  
                                         {"participant": "device-492b0ce9-97d8-44cc-8d0b-a07d7a20214f", "source": "SOURCE_MICROPHONE", 
"accepted_sources": ["SOURCE_MICROPHONE"], "room": "492b0ce9-97d8-44cc-8d0b-a07d7a20214f_Kyifw", "agent": "ato-lk-agent-dev", "pid": 33409, 
"job_id": "AJ_fTWmAFwLo4zx", "room_id": "RM_2Ku6pbEKCBQG"}
    13:51:37.017 INFO   main_agent         Setting conversation ID: conv_CkCGuC4qCmG2ZaDudlJvt  
                                     {"room": "492b0ce9-97d8-44cc-8d0b-a07d7a20214f_Kyifw", "agent": "ato-lk-agent-dev", "pid": 33409, "job_id": 
"AJ_fTWmAFwLo4zx", "room_id": "RM_2Ku6pbEKCBQG"}
    13:51:37.148 INFO   livekit.agents     RealtimeModel metrics  
                                         {"model_name": "gpt-realtime-2025-08-28", "model_provider": "api.openai.com", "ttft": -1.0, 
"input_tokens": 0, "cached_input_tokens": 0, "input_text_tokens": 0, "input_cached_text_tokens": 0, "input_image_tokens": 0, 
"input_cached_image_tokens": 0, "input_audio_tokens": 0, "input_cached_audio_tokens": 0, "output_tokens": 0, "output_text_tokens": 0, 
"output_audio_tokens": 0, "output_image_tokens": 0, "total_tokens": 0, "tokens_per_second": 0.0, "room": 
"492b0ce9-97d8-44cc-8d0b-a07d7a20214f_Kyifw", "agent": "ato-lk-agent-dev", "pid": 33409, "job_id": "AJ_fTWmAFwLo4zx", "room_id": 
"RM_2Ku6pbEKCBQG"}
    13:51:37.318 INFO   events             Conversation item added from user: Hola, ¿todo cómo va?. interrupted: False  
                                 {"room": "492b0ce9-97d8-44cc-8d0b-a07d7a20214f_Kyifw", "agent": "ato-lk-agent-dev", "pid": 33409, "job_id": 
"AJ_fTWmAFwLo4zx", "room_id": "RM_2Ku6pbEKCBQG"}
t
Thanks — I reviewed your logs. They show the agent received audio and created a conversation item, but the RealtimeModel metrics report zero input/output tokens, so the LLM never produced a response. That narrows the problem to one of these likely causes: • The OpenAI Realtime plugin/LLM was not actually invoked (misconfigured plugin, model name, or realtime flag). • The agent never sent the captured transcript/prompt to the model (turn detection, transcription, or routing issue). • The OpenAI Realtime connection failed silently (auth, base_url, or websocket issue) so requests never reached the model. • The plugin returned an empty response (timeout or plugin-level error) that wasn’t surfaced in logs. Next debugging steps — run these in your dev environment and share results: 1. Confirm plugin + model config • Verify the plugin is configured to use a realtime-capable model name and the realtime option is enabled in your agent code (the exact field depends on your SDK). • Share which SDK (Python or Node) and exact SDK version. 1. Enable full debug/trace for the OpenAI plugin calls • Start agent with debug and ensure HTTP/websocket request/response logging is on: ◦ Python:
uv run agent.py dev --log-level=DEBUG
◦ Node:
pnpm run dev --log-level=debug
• Look for log lines showing the outgoing OpenAI request (payload) and its response or websocket connect/close events. Paste those sections here. 1. Check for errors/timeouts • Search logs for any ERROR/WARN lines around the timestamp after conversation item added (135137). If you see connection or auth errors, paste them. 1. Verify transcription → model handoff • Confirm the agent produced a transcript before sending to LLM. In logs you should see the transcript text and then a call to the LLM. If transcript exists but no LLM call, the routing or trigger logic is failing — share the agent code that handles end-of-turn/dispatch. 1. Confirm tokens/metrics after repro • Reproduce the interaction and share the RealtimeModel metrics block that follows; if it still shows zeros, the LLM never received input. If you want, I can: • Give exact log lines to look for (plugin request/response traces) for your SDK, or • Review the relevant agent code snippet that sends transcripts to the model. Which SDK and version are you using, and can you paste the debug logs showing the OpenAI request/connection attempts?
a
agents 3.6,
sorry i mean, 1.3.6
t
Thanks — since you're on Agents 3.6, here are focused, actionable checks to find why the Realtime model shows zero tokens and no answer was produced. 1) Confirm realtime-capable model + plugin enabled • Ensure your OpenAI plugin is configured to use a realtime-capable model name (e.g., a Realtime model) and the plugin is enabled in your agent config. If the plugin is disabled or the model name is wrong, the agent won't call the LLM. 2) Verify auth & connection to OpenAI • Check your OpenAI API key env var (
OPENAI_API_KEY
or the var your agent uses) is present in the dev environment. • Look for websocket connect/handshake logs to api.openai.com (connect, upgrade, 101, or explicit websocket open/close). If you see no socket/open logs, the plugin never connected. 3) Turn detection → transcript → LLM handoff • Confirm a transcript was produced and then handed to the LLM. In DEBUG logs you should see: ◦ transcript text emitted ◦ a subsequent log showing an outgoing LLM request payload (messages/prompt) referencing that transcript If you see transcript logs but no outgoing LLM call, the handoff/trigger logic (end-of-turn or routing) is failing. 4) Enable full debug for plugin-level traffic • Start agent with DEBUG and ensure HTTP/ws request/response logging is shown: ◦ Python:
uv run agent.py dev --log-level=DEBUG
◦ Node:
pnpm run dev --log-level=debug
• Search the logs for: ◦ "POST /v1/realtime" or websocket frames to OpenAI ◦ Request payload that includes your prompt/messages ◦ Any 4xx/5xx, timeouts, or error frames 5) Inspect RealtimeModel metrics after a repro • Reproduce the audio, then find the RealtimeModel metrics block. If it still shows zero input/output tokens, that indicates the LLM call did not occur or returned empty. 6) Look for silent plugin errors • Search for WARN/ERROR near the timestamps. Some plugin errors may not be obvious — paste any connect/auth warnings or stack traces you find. 7) Quick local test outside Agents • From the same machine/env, try a minimal OpenAI Realtime request (or a simple REST call to the standard completions/chat endpoint) to confirm your key and network are OK. If that fails, it's an auth/network issue not agent logic. If you want, paste these specific logs after repro: • Any lines showing OpenAI request/connection attempts (POST/ws frames) around 135137. • Any WARN/ERROR lines within ±30s of the conversation item. • The full RealtimeModel metrics block after repro. Or paste your agent config snippet that defines the OpenAI plugin (model name, base_url, and any realtime flag). I’ll point out exactly what to change.
Thanks — since you’re on Agents v1.3.6, let’s focus narrowly on what will reveal why the Realtime model call never produced tokens. What to check now (run these and paste results you find): 1) Confirm plugin + model name • Share the OpenAI plugin config snippet you’re using (model name,
base_url
, and any realtime flag). I’ll verify it’s a realtime-capable model string. 2) Verify auth & network • Run from the same dev host: ◦ curl the standard OpenAI REST endpoint with your key to confirm network/auth:
Copy code
curl -s -o /dev/null -w "%{http_code}\n" https://api.openai.com/v1/models \
      -H "Authorization: Bearer $OPENAI_API_KEY"
• If you get 200, auth/network are OK. If not, paste the HTTP code or error. 3) Capture plugin-level traffic in DEBUG • Start the agent with DEBUG and reproduce: ◦ Python:
uv run agent.py dev --log-level=DEBUG
• Search the debug output for any of these after the conversation item timestamp: ◦ websocket connect/open logs to api.openai.com or
POST /v1/realtime
◦ outgoing request payloads containing the transcript/messages ◦ websocket frames, responses, or error frames • Paste the exact lines for connect/request/response (redact keys). 4) Check transcript → LLM handoff • In DEBUG logs, do you see the transcript text printed, then immediately a log showing an LLM request payload? If you see transcript but no LLM request, paste the transcript log and the agent code that triggers LLM calls (end-of-turn handler). 5) Look for silent errors/timeouts • Search for WARN/ERROR within ±30s of your timestamps. Paste any stack traces or error lines you find. 6) Quick local sanity test • From the same environment, try a simple OpenAI call (chat completion or model list) to confirm the SDK can reach OpenAI. Paste results. If you paste: • your OpenAI plugin config, and • the DEBUG lines showing connect/request/response (or lack thereof), I’ll point out the exact misconfiguration or next fix (auth, model name, websocket issue, or routing bug).