Files
dotfiles/dot_claude/skills/sandbox-sdk/references/examples.md
T
Prad NukalaandClaude Fable 5 20891f3910 config(git,claude,ssh): templated gitconfig; claude settings/commands/hooks/skills; ssh config
gitconfig: name/email from chezmoi data, gh credential helper by PATH
lookup (portable to darwin). claude: no credentials, history, projects,
sessions, or plugin caches. ssh config as private_ (0600).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-09 14:53:46 -04:00

50 lines
1.5 KiB
Markdown

# Sandbox SDK Examples
All examples: https://github.com/cloudflare/sandbox-sdk/tree/main/examples
## Example Index
| Example | Use Case | Key File |
|---------|----------|----------|
| `minimal` | Basic setup, exec, file ops | `src/index.ts` |
| `code-interpreter` | AI code execution with Workers AI | `src/index.ts` |
| `openai-agents` | OpenAI Agents SDK integration | `src/index.ts` |
| `opencode` | OpenCode agent integration | `src/index.ts` |
| `claude-code` | Claude Code agent integration | `src/index.ts` |
| `typescript-validator` | TypeScript compilation/validation | `src/index.ts` |
| `authentication` | Auth patterns for sandboxes | `src/index.ts` |
## When to Use Which Example
| Building | Start With |
|----------|------------|
| AI code execution | `code-interpreter` |
| Agent with shell + file editing | `openai-agents` |
| Basic command execution | `minimal` |
| Code validation service | `typescript-validator` |
| Multi-user sandboxes | `authentication` |
## Common Patterns from Examples
**Sandbox per user/session** (from `openai-agents`):
```typescript
const sandbox = getSandbox(env.Sandbox, `session-${sessionId}`);
```
**Code context reuse** (from `code-interpreter`):
```typescript
const pythonCtx = await sandbox.createCodeContext({ language: 'python' });
const result = await sandbox.runCode(code, { context: pythonCtx });
```
**Resource cleanup** (from `code-interpreter`):
```typescript
try {
// ... use sandbox
} finally {
await sandbox.destroy();
}
```
Fetch the full example source when implementing similar patterns.