Skip to content

Add OpenAI Agents auto-instrumentation with real e2e coverage#1891

Open
Stephen Belanger (Qard) wants to merge 2 commits intomainfrom
openai-agents-auto-instrumentation
Open

Add OpenAI Agents auto-instrumentation with real e2e coverage#1891
Stephen Belanger (Qard) wants to merge 2 commits intomainfrom
openai-agents-auto-instrumentation

Conversation

@Qard
Copy link
Copy Markdown
Contributor

@Qard Stephen Belanger (Qard) commented Apr 22, 2026

Summary

  • Add auto-instrumentation support for @openai/agents-core tracing lifecycle methods and wire it into the default Braintrust hook/plugin stack
  • Map OpenAI Agents traces and spans into Braintrust spans, including agent, tool, handoff, guardrail, and model activity
  • Add a real e2e scenario that runs @openai/agents through --import braintrust/hook.mjs and verifies captured spans against the live API path
  • Fix ESM loader fallback behavior so transformed .mjs modules are still treated as ESM when Node omits module format metadata

Testing

  • Added focused unit coverage for the new OpenAI Agents instrumentation config and trace processor
  • Added an e2e test that exercises the real OpenAI Agents SDK with OPENAI_API_KEY and validates the emitted Braintrust spans
  • Verified formatting, TypeScript, and the targeted Vitest suites pass locally

Fixes #1888

@Qard Stephen Belanger (Qard) force-pushed the openai-agents-auto-instrumentation branch 4 times, most recently from 85c5554 to 7686164 Compare April 22, 2026 22:31
Comment thread js/src/auto-instrumentations/configs/openai-agents.test.ts
Comment thread js/src/auto-instrumentations/configs/openai-agents.ts
@lforst
Copy link
Copy Markdown
Member

Also: Can we add the e2e sceanario to the ci summary?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add automatic instrumentation for the openai agents sdk

2 participants