Skip to content

feat: add run_code to E2BProvider via e2b_code_interpreter SDK#23

Open
omavashia2005 wants to merge 1 commit intocased:mainfrom
omavashia2005:feat/e2b-code-interpreter
Open

feat: add run_code to E2BProvider via e2b_code_interpreter SDK#23
omavashia2005 wants to merge 1 commit intocased:mainfrom
omavashia2005:feat/e2b-code-interpreter

Conversation

@omavashia2005
Copy link
Copy Markdown

Adds run_code() to E2BProvider mirroring HopxProvider's interface. Uses e2b_code_interpreter.AsyncSandbox.connect() in the official e2b_code_interpreter SDK to attach to an existing sandbox and execute code via its Jupyter kernel, returning rich MIME outputs (plots, DataFrames, etc.) alongside stdout/stderr.

Adds run_code() to E2BProvider mirroring HopxProvider's interface.
Uses e2b_code_interpreter.AsyncSandbox.connect() to attach to an existing
sandbox and execute code via its Jupyter kernel, returning rich MIME outputs
(plots, DataFrames, etc.) alongside stdout/stderr.

Also fixes several bugs in the bare-minimum draft:
- Was calling create() instead of connect() (spawned a new sandbox)
- Returned ExecutionResult instead of dict with rich_outputs
- e2b and e2b_code_interpreter imports were merged (breaking E2B_AVAILABLE)
- LANGUAGE_INTERPRETERS was scoped inside cleanup_idle_sandboxes
- >60s heredoc fallback bypassed the interpreter entirely
- Missing Optional/Dict typing imports

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant