Skip to content

docs: add Sandbox E2B SDK quickstart and Playground - #25

Merged
sam2tom merged 5 commits into
mainfrom
codex/sandbox-quickstart
Sep 29, 2026
Merged

sam2tom merged 5 commits into
mainfrom
codex/sandbox-quickstart

Conversation

@sam2tom

@sam2tom sam2tom commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Developers can now start with the official E2B SDK or explore Sandbox operations directly in the docs. The existing Sandbox navigation contains Overview & capabilities, Quickstart / E2B SDK, and Playground (Experimental).

The SDK guide covers organization-visible templates, JavaScript and Python examples, commands and files, pause/reconnect, application-port authentication, cleanup, and troubleshooting. The English Playground supports templates with missing-name fallbacks, lifecycle actions, streamed shell output, file readback after resume, and events/logs/metrics/usage. It clearly distinguishes shell commands from AI chat.

The Playground uses the Docs theme with a wider desktop workspace: instances, operation panel, and Events appear side by side. At intermediate widths, Events stays beside the operation panel; phone screens stack the panels. Component typography is isolated from prose styles. The mobile documentation menu now clears the fixed site header.

Each visitor supplies their own API key, held only in page memory. A stateless same-origin Worker proxy uses fixed Sandbox upstreams, an explicit route allowlist, and separate control/data credentials. No shared production key is bundled or configured. Deploy the Worker and built assets together as documented in DEPLOYMENT.md.

Validation:

  • All validation-script stages passed, including 12 Playground tests, Worker routing, navigation, content, links, SEO, API contracts, and OpenAPI lint.
  • Full-build baseline before the subsequent copy and credential-clearing refinements passed: 7,515 files / 2,490 HTML pages.
  • Browser layout inspected at desktop, intermediate, and phone widths; no phone-width horizontal overflow. Final menu-click inspection was interrupted by browser automation timeouts.
  • Earlier read-only production template discovery succeeded. No production Sandbox creation or other mutations were performed by this change's validation.
  • Existing unresolved ClashGrotesk font warning remains.

Credential handling: Clear key works before connection and during in-flight requests, clears displayed state, and rejects late responses. Page exit clears credentials before browser back-forward caching. Public copy limits privacy promises to Playground handling, separates key revocation and resource cleanup, and removes unnecessary provider, routing, and process-protocol details. Latest targeted tests, content/link checks, and browser clear-key verification passed.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-29T03:04:35.468338Z 1971b2d New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sam2tom sam2tom changed the title docs: add Sandbox E2B SDK quickstart docs: add Sandbox E2B SDK quickstart and Playground Sep 29, 2026

@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: 2baa4e1ece

ℹ️ 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".

async function list() {
const rows = []; let next = '', pages = 0
do {
const query = new URLSearchParams({ limit: '100', state: 'running,paused' }); if (next) query.set('nextToken', next)

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 Encode list states as repeated query parameters

When the Playground loads or refreshes instances, this sends a single state value of running,paused. The v2 listing contract models this filter as an array—as the repository's SDK example shows with state: ['running', 'paused'] in _archived/agents/sandbox-list.md:97-100—so the request must contain separate state=running and state=paused parameters. Servers validating the enum reject the combined value, causing every Connect/Refresh call to fail during list() and leaving the instance list unusable.

Useful? React with 👍 / 👎.

@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: f0e1c2bf47

ℹ️ 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 .vitepress/theme/SandboxPlayground.vue Outdated
}
async function loadEvents() {
const rows = await control(`/events/sandboxes/${id.value}?limit=100`)
for (const event of Array.isArray(rows) ? rows : []) if (!events.value.some(x => x.id === event.id && x.source === 'Gateway lifecycle')) events.value.unshift({ id: event.id, type: event.type, source: 'Gateway lifecycle', time: event.timestamp, data: safe(event) })

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 Use createdAt for lifecycle event timestamps

When gateway lifecycle events are loaded, the Events API returns their timestamp in createdAt (as documented in _archived/agents/sandbox-events.md:50-62), not timestamp. Consequently every fetched lifecycle event renders an empty time beside its source, making the Playground timeline misleading; populate time from event.createdAt instead.

Useful? React with 👍 / 👎.

@sam2tom
sam2tom merged commit bdd96df into main Sep 29, 2026
1 check passed

@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: 1971b2dfe0

ℹ️ 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".

const result = await control('/v2/sandboxes', 'POST', { templateID: template.value, timeout: Number(ttl.value), metadata: { docsPlayground: connectionID.value, docsCreate: attempt } })
const currentID = idOf(result); if (!currentID) throw new Error('create_result_unknown')
if (result.envdAccessToken) tokens.set(currentID, result.envdAccessToken)
selected.value = result; pendingCreate.value = ''; await list(); await loadEvents(); record('create.completed', 'Playground', { sandboxId: currentID })

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 Decouple optional event loading from successful creation

When the Events API is unavailable or denied—an expected possibility according to the new capabilities documentation—the sandbox has already been created and pendingCreate cleared before loadEvents() rejects. That rejection bubbles into act(), which reports the creation as “Not completed” even though a billable resource now exists and creation is immediately enabled again, risking duplicate resources. Treat the event refresh as best-effort so it cannot overwrite the successful mutation result; the same coupling also affects lifecycle actions below.

Useful? React with 👍 / 👎.

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