Skip to main content
Trace your OpenAI Realtime API voice agents to LangSmith. For high-level conventions, see Voice tracing fundamentals. OpenAI Realtime is a speech-to-speech model that streams typed events over a WebSocket. Either way you build it, the integration captures each conversation as a single LangSmith trace, with a span for every meaningful event (transcripts, model responses, and tool calls) grouped by turn. You enable it with one call and do not create any spans yourself. The flood of audio chunks is played but not traced.
The OpenAI Realtime integration is in development, so its API may change.

Choose an approach

There are two ways to build an OpenAI Realtime agent, and each has its own integration: Both produce the same kind of trace. Pick the one that matches how you built your agent.

Install

The langsmith[openai-realtime] extra provides both wrappers:
Voice apps also need an audio library such as sounddevice for microphone and speaker I/O.

Set environment variables

.env

Raw connection

Use this when you open the WebSocket yourself with client.realtime.connect() and drive the event loop.

Set up tracing

wrap_realtime returns a transparent proxy of your connection. Your existing async for event in connection loop, session.update, and tool handling stay the same:
A stable thread_id you generate per conversation (for example, a UUID) groups the trace into a LangSmith thread. Any @traceable tools you run while handling an event nest under that event automatically.
Enable input_audio_transcription (and the agent transcript) in your session.update, or the transcription events that make the trace readable never arrive.

Record the conversation audio

Feed the proxy your microphone and playback audio, and it attaches a single stereo recording (user left, agent right) to the trace. Pass is_agent_speaking so barge-ins are flagged:

OpenAI Agents SDK

Use this when you build the agent with the OpenAI Agents SDK (RealtimeAgent / RealtimeRunner), which owns the turn and tool-call loop.
The Agents SDK’s built-in realtime tracing uploads to OpenAI’s own dashboard. Call agents.set_tracing_disabled(True) to avoid a second, separate upload path.

Set up tracing

wrap_realtime_session wraps the RealtimeSession and enters it for you. Iterate it as you would the original; the SDK runs tools and manages turns:
The conversation transcript is reconstructed from the session’s history snapshots, so messages appear even though the SDK streams them as partials.

Record the conversation audio

Feed the proxy your microphone and playback audio:

Next steps

Voice fundamentals

Core conventions for tracing voice agents.

Upload files with traces

Attach the conversation audio recording to your trace.