E2B
A sandbox spins up in one call, code runs and returns stdout cleanly, and state persists across executions so multi-step work just accumulates. When code throws, the error comes back as a structured object - exception name, message, and full traceback - exactly what an agent needs to self-correct. Empty code and no-newline output are handled gracefully. Each sandbox is isolated under a unique id; side effects are whatever your code does, so idempotency is the caller's code responsibility for an execution environment. Nothing surprised the agent.
Cross-validated onClaude Opus 4.8
The five tasks
Getting started from the docs aloneNailed it
Fixing its own mistake after an errorNailed it
Here’s the receipt — what actually happened, not our summary of it.
run_code on an undefined variable returned a structured error object: name 'NameError', the exact message, and a full traceback. Fully self-correctable from the response alone.
Following a multi-step flowNailed it
Handling an unclear edge caseNailed it
Not double-charging on a retryNailed it
See everything the AI did (5 steps)
t0 Claude Opus 4.8 POST /sandboxes ; run_code('print(2+2)') → 201 sandboxID ; stdout '4'
t1 Claude Opus 4.8 run_code (undefined variable) → structured error: NameError + traceback
t2 Claude Opus 4.8 run_code x=41 -> x=x+1 -> print(x) → stdout '42' (state persisted)
t3 Claude Opus 4.8 run_code (empty) ; stdout no newline → handled gracefully ; captured
t4 Claude Opus 4.8 each sandbox unique id, isolated → predictable, isolatedTested 2026-07-01 with Claude Opus 4.8 agents · request a re-test