Skip to content

[bot] Instrument @openai/agents-realtime (1,534,984 weekly downloads) #2395

Description

@braintrust-bot

<!-- library-gap-audit: openai-agents-realtime -->

Summary

@openai/agents-realtime is a separate npm package (part of the OpenAI Agents SDK monorepo, distinct from @openai/agents-core/@openai/agents) that provides RealtimeAgent and RealtimeSession classes for building low-latency, audio-to-audio voice agents on top of OpenAI's Realtime API. This repo instruments the standard (text) Agents SDK tracing lifecycle but has zero instrumentation for this realtime package — no channels, no wrapper, no auto-instrumentation config reference it anywhere in source.

This is distinct from existing issue #1731, which covers the raw openai package's client.realtime resource (the base OpenAI Node SDK's Realtime WebSocket API). @openai/agents-realtime is a different npm package, under a different SDK family (the Agents SDK), with its own RealtimeAgent/RealtimeSession class implementations, its own tool-calling integration with the Agents SDK's tool system, and its own transport layer (WebRTC/WebSocket via @openai/agents-realtime's own connection handling) — not the same code path as client.realtime.

What's missing

Current instrumentation (js/src/auto-instrumentations/configs/openai-agents.ts) only hooks the MultiTracingProcessor.onTraceStart/onTraceEnd/onSpanStart/onSpanEnd lifecycle methods inside @openai/agents-core's dist/tracing/processor.{mjs,js}. This captures spans for standard (text) Agent/Runner execution.

Per OpenAI's own documentation, RealtimeSession/RealtimeAgent execution does not flow through this TracingProcessor pipeline at all — tracing for realtime/voice sessions happens server-side on OpenAI's Realtime API, not via the local MultiTracingProcessor that Braintrust's openai-agents config hooks. This is confirmed by an open upstream issue (openai/openai-agents-js#594, "Custom Tracing Processors for Voice Agents (Realtime API)", opened 2025-10-21, still open) which states that custom tracing processors are not currently triggered for RealtimeSession/RealtimeAgent workflows.

As a result, hooking the existing MultiTracingProcessor channel gives zero visibility into @openai/agents-realtime usage — a separate instrumentation approach is needed, e.g. wrapping RealtimeSession's connection/event-emitter surface directly (analogous to what #1731 proposes for the base SDK's RealtimeSession), to capture session config, tool-call events, and usage/audio-token metrics from events like history_updated, response.done-equivalent events, and tool-call events.

Weekly downloads

Weekly downloads: 1,534,984 (as of 2026-08-24; https://api.npmjs.org/downloads/point/last-week/@openai/agents-realtime — reported window 2026-08-17 to 2026-08-23)

Braintrust docs status

not_found for this specific package/surface. Checked:

  • https://www.braintrust.dev/docs/integrations/agent-frameworks/openai-agents-sdk — documents OpenAIAgentsTraceProcessor (TS) / BraintrustTracingProcessor (Python) for standard Agent/Runner.run execution, and separately mentions tracing "Speech and transcription spans... for voice agents" — but this refers to the classic STT→Agent→TTS voice-pipeline flow inside @openai/agents-core, which still runs through the standard TracingProcessor. It does not mention RealtimeAgent, RealtimeSession, or @openai/agents-realtime anywhere, and does not use the word "realtime" at all.
  • https://www.braintrust.dev/docs/instrument/wrap-providers — lists OpenAI Agents SDK (@openai/agents, min version 0.0.14) as a supported integration, with no mention of a realtime/voice-session variant.

Upstream references

Local files inspected

  • js/src/auto-instrumentations/configs/openai-agents.ts — only hooks @openai/agents-core's MultiTracingProcessor lifecycle methods; no reference to @openai/agents-realtime, RealtimeAgent, or RealtimeSession.
  • js/src/instrumentation/plugins/openai-agents-channels.ts — channels only cover the trace/span lifecycle methods above.
  • Repo-wide grep for agents-realtime, RealtimeAgent, RealtimeSession — only matches in pnpm-lock.yaml and e2e/scenarios/openai-agents-instrumentation/pnpm-lock.yaml (transitive lockfile entries), zero matches in any js/src/ source file.
  • e2e/scenarios/openai-agents-instrumentation/ — scenario covers standard Agent/Runner execution only, no realtime scenario.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions