Skip to main content

patchRealtimeSession

patchRealtimeSession(): void Manually patch the RealtimeSession class from @openai/agents-realtime so that every new instance is automatically traced by Weave. Note: You typically don’t need to call this function! @openai/agents-realtime is automatically instrumented via module loader hooks when you import Weave. This function is provided for edge cases where automatic instrumentation doesn’t work (e.g. dynamic imports, bundlers that bypass hooks). Call this once at app startup, before any RealtimeSession is constructed. The function is idempotent — safe to call multiple times.

Returns

void Example
import { patchRealtimeSession } from 'weave';
patchRealtimeSession();
// Every new RealtimeSession(...) is now auto-instrumented

Defined in

integrations/openai.realtime.agent.ts:797