E2B Sandbox Monitoring & Tracing with OpenTelemetry E2B sandboxes can be monitored and traced with OpenTelemetry by instrumenting the application that creates them, according to a technical guide from SigNoz. The guide details five telemetry paths — application instrumentation, in-sandbox code instrumentation, sandbox resource metrics, sandbox lifecycle events, and E2B's own OTel export — all exporting to the same SigNoz endpoint, with the first path requiring Python 3.10 or later and the e2b-code-interpreter package. The E2B OTel telemetry export path, which provides e2b.* metrics and service_name: e2b logs with no code, requires an Enterprise plan and an onboarding request. Overview E2B https://e2b.dev/ runs AI-generated code in an isolated Linux microVM. Your agent creates a sandbox, runs code in it, reads the output, and kills it. Two things go wrong in that loop, and each needs its own telemetry: the code inside the sandbox fails or hangs, and the sandbox lifecycle itself turns slow or errors out. A sandbox is ephemeral, so the execution that failed is gone before you can open a terminal, and nothing records how it exited until you instrument it. This page covers both halves. You end up with the execution that failed and the reason, the share of request latency that came from E2B rather than your own code, and the sandboxes that stayed alive long enough to matter on a per-second bill. Prerequisites - An instance of SigNoz either Cloud https://signoz.io/teams/ or Self-Hosted https://signoz.io/docs/install/self-host/ - Python 3.10 or later. The e2b SDK requires 3.10. - An E2B API key from the E2B Dashboard https://e2b.dev/dashboard . Every path on this page except the last one works on the free Hobby plan. How it works E2B produces telemetry through five paths. They do not overlap, so pick the ones that answer your question. | Path | What you get | What it costs you | |---|---|---| | Instrument the application that creates sandboxes | One trace per session, a span per execution, exit codes, and errors | A wrapper around Sandbox.create , run code , and commands.run | | Instrument the code that runs inside the sandbox | Spans and logs from the generated code, joined to the same trace | An OpenTelemetry SDK shipped into the sandbox | | Sandbox resource metrics | CPU, memory, and disk per sandbox | A poller over get metrics | | Sandbox lifecycle events | Create, update, and kill events as log records | A poller over the events API, or a webhook receiver | | E2B OTel telemetry export | e2b. metrics and service name: e2b logs, with no code at all | An Enterprise plan and an onboarding request | Start with the first path. It covers every sandbox your application creates, including the ones whose code a model wrote. The SDK also reports some HTTP telemetry by itself, with no code and no instrumentation package, which What the SDK Emits on Its Own what-the-sdk-emits-on-its-own covers. The rest sit under Optional Setups optional-setups . All five use OpenTelemetry https://opentelemetry.io/ and export to the same SigNoz endpoint. E2B sandboxes have outbound internet access by default, so you need no firewall rule before an exporter reaches SigNoz. If you set allow internet access=False or a network deny rule, read The sandbox cannot reach SigNoz the-sandbox-cannot-reach-signoz first. Monitor E2B Sandboxes from Your Application This path shows what each sandbox did: which executions ran, how long each took, how they exited, and where they failed. Step 1: Install the packages pip install e2b-code-interpreter opentelemetry-sdk opentelemetry-exporter-otlp-proto-http e2b-code-interpreter wraps the base e2b SDK and adds run code . If your agent only runs shell commands, install e2b instead, drop the traced run code helper below, and import Sandbox from e2b rather than from e2b code interpreter . The e2b package does not contain the e2b code interpreter module, so the import fails otherwise. Step 2: Configure the OpenTelemetry SDK Point the standard OpenTelemetry variables at SigNoz. The exporter reads all three, so no endpoint appears in your code. export E2B API KEY="