Skip to content

docs(sandbox): document e2b code execution primitive#385

Merged
krrish-berri-2 merged 6 commits into
mainfrom
claude/recursing-wilson-8d5aeb
Jun 21, 2026
Merged

docs(sandbox): document e2b code execution primitive#385
krrish-berri-2 merged 6 commits into
mainfrom
claude/recursing-wilson-8d5aeb

Conversation

@krrish-berri-2

@krrish-berri-2 krrish-berri-2 commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

New page at /docs/sandbox covering both phases of the sandbox work.

BerriAI/litellm#30898, SDK primitive: acode_interpreter_tool for ephemeral runs, acreate_sandbox / arun_code / adelete_sandbox for manual lifecycle, the CodeExecutionResult passthrough shape, e2b setup (E2B_API_KEY, default template code-interpreter-v1, 300s timeout). api_base param from phase 2 is included on each entrypoint.

BerriAI/litellm#30905, Responses API code interpreter interceptor: a 4-step setup (set keys, write config.yaml with sandbox_tools + code_interpreter_interception callback, start the proxy, curl /v1/responses) and a one-paragraph notes block covering response-shape parity, streaming, forced tool_choice, lifecycle and isolation, hot reload, and the v0 no-file-IO limit.

Discovery: sidebar entry acode_interpreter_tool() under LiteLLM Python SDK > SDK Functions, plus a second entry "Code Interpreter Sandbox Interception" under Tool Calling next to "Web Search Interception". The existing /docs/guides/code_interpreter page has a tip linking through.

Test plan

  • npm start and verify the page renders at http://localhost:3002/docs/sandbox
  • Both sidebar entries appear (SDK Functions and Tool Calling)
  • Tip on /docs/guides/code_interpreter links to the interceptor section
  • Code blocks match the signatures and config shape shipped in feat(sandbox): e2b code execution primitive litellm#30898 and #30905

Documents the SDK surface added in BerriAI/litellm#30898: acode_interpreter_tool for ephemeral runs and the acreate_sandbox / arun_code / adelete_sandbox lifecycle. Covers the e2b backend setup, parameters, the CodeExecutionResult passthrough shape, and what is intentionally out of scope for this phase (proxy endpoints, OpenAI container interceptor, gpt-5 routing, container reuse, file IO, OpenSandbox, Daytona). Adds a sidebar entry under LiteLLM Python SDK > SDK Functions.
@vercel

vercel Bot commented Jun 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Jun 21, 2026 4:52am

Request Review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6146acbb61

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/sandbox.md
asyncio.run(main())
```

`arun_code` and `adelete_sandbox` accept either the `ContainerHandle` returned by `acreate_sandbox` or a bare sandbox id string, so you can persist the id between processes and pick the sandbox back up later.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove the unsupported bare-ID reuse guidance

For the only supported provider (e2b), following this guidance and persisting just the sandbox id between processes makes arun_code fail before it reaches the network: the e2b implementation requires the access token stored on the ContainerHandle returned by acreate_sandbox and raises ValueError when a bare string has no envd_access_token. This line therefore documents a reuse workflow that users cannot actually execute.

Useful? React with 👍 / 👎.

Documents BerriAI/litellm#30905: how a client can call OpenAI's code interpreter through /v1/responses and have the code run in the configured sandbox (e2b) instead of OpenAI's container, with no client-side change. Covers the sandbox_tools registry and code_interpreter_interception callback, the curl shape, response-shape parity with native code_interpreter_call (id/type/status/code/container_id/outputs as an OpenAI-shaped logs array), streaming via the synthetic SSE wrapper, forced tool_choice rewrite, sandbox lifecycle and per-request isolation on a server-minted token, the stripped control fields that prevent client forgery, hot-reload behaviour, and the v0 limitation that file upload and download are not yet supported. Also notes the new api_base passthrough on the SDK entrypoints.
…uide

A proxy user looking for code interpreter lands on guides/code_interpreter, not the SDK sandbox page, so the interceptor was effectively undiscoverable from the proxy side. Adds a tip in the Code Interpreter guide pointing at the new interceptor section, and a second sidebar entry under Tool Calling labelled 'Code Interpreter Sandbox Interception' next to the existing Web Search Interception entry, mirroring how websearch_interception is exposed.
The interceptor section had the config and curl but no narrative walking a proxy user from a clean checkout to a working call. Restructures into five numbered steps (get the e2b key, write config.yaml with a model_list plus sandbox_tools registry, start the proxy, call /v1/responses via curl or the OpenAI SDK, verify the code ran in e2b via the cntr_-wrapped container_id and the e2b dashboard sandbox count). Calls out enabled_providers as the safety gate so flipping the callback on does not silently change behaviour for other providers.
@krrish-berri-2 krrish-berri-2 enabled auto-merge (squash) June 21, 2026 04:51
@krrish-berri-2 krrish-berri-2 merged commit 5de4667 into main Jun 21, 2026
2 checks passed
@krrish-berri-2 krrish-berri-2 deleted the claude/recursing-wilson-8d5aeb branch June 21, 2026 04:52
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.

2 participants