Returns
Promise<boolean>
Promise<boolean> - true if registration succeeded, false if @openai/agents not available
Examples
Remarks
How automatic instrumentation works: When you import Weave, it registers module loader hooks viaaddCJSInstrumentation() and addESMInstrumentation(). When your code later
imports @openai/agents, these hooks intercept the import and automatically patch the
module to add Weave tracing. This happens transparently - no action required from you!
When to use this function: Only use this if automatic instrumentation fails, such as:
- Using dynamic imports that bypass module hooks
- Bundlers that don’t support import-in-the-middle
- Need explicit control over when instrumentation happens
createOpenAIAgentsTracingProcessor() and register it manually: