Add Claude Agent SDK in E2B Sandbox example (TypeScript) - #109
Open
ondraulehla wants to merge 1 commit into
Open
Add Claude Agent SDK in E2B Sandbox example (TypeScript)#109ondraulehla wants to merge 1 commit into
ondraulehla wants to merge 1 commit into
Conversation
Runs an agent built with Anthropic's Claude Agent SDK inside an E2B sandbox: the sandbox template pre-installs the SDK, an in-sandbox script streams structured agent messages (tool calls, text, final result with cost) back to the host as JSON lines, and the host downloads the produced artifacts via the Files API. Complements the existing Claude Code CLI example with a programmatic, product-ready pattern: full autonomy via bypassPermissions is safe because the sandbox is the security boundary. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
examples/claude-agent-sdk-in-sandbox-js: an agent built with Anthropic's Claude Agent SDK running inside an E2B Sandbox, plus a row in the root README (Anthropic section).It complements the existing
anthropic-claude-code-in-sandbox-jsexample: instead of piping a prompt into theclaudeCLI and reading a single stdout blob, the Agent SDK emits structured messages. The example shows the full product-ready loop:@anthropic-ai/claude-agent-sdkpre-installed (Template SDK, same structure as the Claude Code example).query()and prints each SDK message as a JSON line.Running with
permissionMode: "bypassPermissions"is safe in this setup because the sandbox is the security boundary; nothing runs on the user's machine. Authentication works with eitherANTHROPIC_API_KEYor a Claude Pro/Max subscription token fromclaude setup-token(CLAUDE_CODE_OAUTH_TOKEN).Verification
Template build and end-to-end run against a real sandbox:
The demo prompt has the agent build a self-contained page that trains a small neural network on XOR and animates its decision boundary; the downloaded
output/index.htmlworks when opened in a browser.