Skip to content

feat: trace E2B sandbox and code execution - #2602

Open
KarthikS (karthiksenv) wants to merge 1 commit into
braintrustdata:mainfrom
karthiksenv:codex/e2b-instrumentation
Open

KarthikS (karthiksenv) wants to merge 1 commit into
braintrustdata:mainfrom
karthiksenv:codex/e2b-instrumentation

Conversation

@karthiksenv

Copy link
Copy Markdown

E2B sandbox operations currently produce no Braintrust spans. Add standard Orchestrion configs and a channel plugin for Sandbox.create(), sandbox.commands.run(), and sandbox.runCode() in the E2B 2.x SDKs, including CommonJS and ES module builds.

The integration preserves SDK results, background command handles, callbacks, and parent spans. It captures execution errors even when runCode() resolves successfully, selects operation fields instead of serializing credential-bearing options/instances, and supports the e2b integration opt-out. Includes usage documentation and a changeset.

Fixes #2480.

Validation

  • Reproduced on the original registration: 10 tracing regressions fail because no E2B spans are emitted; the two opt-out checks pass.
  • With the fix: all 129 tests pass across the new published-SDK contract suite, BraintrustPlugin, and the instrumentation registry.
  • Published e2b@2.9.0 and @e2b/code-interpreter@2.2.0 tested in CommonJS and ES module formats.
  • Packaged braintrust/hook.mjs smoke checks pass for both module formats; both e2b and @e2b/code-interpreter environment opt-outs suppress tracing.
  • SDK build, source type check, test type check, and formatting pass. Changed-code lint has no errors (one existing assertion-style warning in span-origin.ts).

Reproduce the committed regression tests from js/ with:

pnpm exec vitest run tests/auto-instrumentations/e2b.test.ts src/instrumentation/braintrust-plugin.test.ts src/instrumentation/registry.test.ts
pnpm run check:typings
pnpm run build

Test scope

These are hermetic tests against published SDK implementations, using E2B's debug creation path and stubbed provider I/O. No live E2B sandbox was provisioned and no provider replay cassette is included; live-cloud verification remains outstanding because no E2B credential was configured.

@karthiksenv
KarthikS (karthiksenv) marked this pull request as ready for review October 11, 2026 13:59

This branch has not been deployed

No deployments
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.

[bot] Instrument E2B (1,253,397 weekly downloads)

1 participant