Investigate Vercel Sandbox using current official docs, installed SDK contracts, and only then any consumer-specific integration code.
Step 1: Classify the request
Pick the narrowest reference set before answering:
| Request type |
Read first |
| SDK/API behavior, lifecycle semantics, snapshots, stable vs beta persistence |
references/api-surface.md |
| Product-level usage patterns and architectural choices |
references/common-use-cases.md |
| Broken behavior, confusing docs, missing files, or suspected persistence bugs |
references/troubleshooting-workarounds.md |
If the task spans categories, load only the relevant files above.
Step 2: Establish which sandbox model applies
- Inspect the installed
@vercel/sandbox version and local types before trusting any doc page or changelog.
- If local types only expose
sandboxId, Sandbox.get({ sandboxId }), extendTimeout, and snapshot-backed source, treat the runtime as stable 1.x ephemeral sandboxes.
- If local code and types expose named sandboxes,
name, persistent, session updates, or automatic resume after stop, treat the runtime as the persistent beta model.
- Qualify time-sensitive claims with a date or retrieval note.
Step 3: Apply core guardrails
- Distinguish three separate clocks before diagnosing workspace loss:
- Vercel function/runtime timeout
- Application/request timeout in the embedding system
- Sandbox timeout
- On stable 1.x,
Sandbox.get({ sandboxId }) only helps while the sandbox is still alive.
- On stable 1.x, once the sandbox stops, its filesystem is gone. Do not describe that as resumable persistence.
sandbox.snapshot() is not workspace durability. It creates a new snapshot artifact and stops the source sandbox.
- Snapshots and persistent beta solve different problems:
- snapshots create new starting points
- persistent beta preserves named workspace state across sessions
- In embedded systems, inspect the consumer's persistence wiring before concluding that Vercel destroyed the workspace immediately.
- Do not infer persistent-beta behavior from a changelog alone. Confirm the installed SDK and local call sites.
Step 4: Investigate the Vercel surface first
- Check the installed SDK surface first:
- installed
@vercel/sandbox types
- official stable docs for concepts, snapshots, SDK reference, and limits
- persistent-beta changelog only if named persistence is relevant
- Determine whether the question is about:
- active sandbox reuse
- stopped sandbox recovery
- snapshot-based warm starts
- persistent named workspaces
- Establish which timeout fired first and whether the sandbox should still have been active.
Step 5: Inspect consumer code only when the task is app-specific
For repo-local debugging in Junior, inspect:
- timeout budget alignment:
packages/junior/src/chat/config.ts
packages/junior/src/chat/app/production.ts
- sandbox identity persistence and reuse:
packages/junior/src/chat/runtime/thread-state.ts
packages/junior/src/chat/runtime/turn-preparation.ts
packages/junior/src/chat/sandbox/session.ts
- whether timeout paths actually resume:
packages/junior/src/chat/agent/index.ts
packages/junior/src/chat/agent/resume.ts
packages/junior/src/chat/runtime/agent-continue-runner.ts
- where sandbox metadata is persisted:
packages/junior/src/chat/runtime/reply-executor.ts
- whether consumer-specific snapshots are being confused with Vercel product persistence:
packages/junior/src/chat/sandbox/README.md
Step 6: Recommend the smallest correct fix
Choose the narrowest fix that matches the diagnosed failure mode:
- Sandbox still alive but next turn started fresh:
- Persist sandbox identity earlier.
- Resume from the active sandbox instead of recreating it.
- Sandbox actually stopped:
- Increase sandbox timeout or extend it while work is active.
- Externalize intermediate outputs if they must survive stop.
- Confusion caused by docs drift:
- Align implementation advice to the installed SDK, not the newest beta docs.
- Need true durability across stop/timeout boundaries:
- Use external storage or migrate intentionally to the persistent beta model after confirming API availability.
Step 7: Return a concrete diagnosis
Default report structure:
- Active sandbox model:
stable-ephemeral or persistent-beta
- What likely timed out first
- Whether the sandbox probably still existed after the failed turn
- Whether workspace loss came from Vercel stop/destruction or consumer state handling
- Smallest next fix, with the exact file(s) or SDK change required
1---2name: vercel-sandbox3description: Investigate Vercel Sandbox lifecycle, timeout, snapshot, and persistence behavior. Use when users ask about Vercel Sandbox, `@vercel/sandbox`, `Sandbox.create`, `Sandbox.get`, why files disappeared, how snapshots differ from persistence, or whether Vercel's persistent sandbox beta applies.4---56Investigate Vercel Sandbox using current official docs, installed SDK contracts, and only then any consumer-specific integration code.78## Step 1: Classify the request910Pick the narrowest reference set before answering:1112| Request type | Read first |13| ----------------------------------------------------------------------------- | ------------------------------------------- |14| SDK/API behavior, lifecycle semantics, snapshots, stable vs beta persistence | `references/api-surface.md` |15| Product-level usage patterns and architectural choices | `references/common-use-cases.md` |16| Broken behavior, confusing docs, missing files, or suspected persistence bugs | `references/troubleshooting-workarounds.md` |1718If the task spans categories, load only the relevant files above.1920## Step 2: Establish which sandbox model applies21221. Inspect the installed `@vercel/sandbox` version and local types before trusting any doc page or changelog.232. If local types only expose `sandboxId`, `Sandbox.get({ sandboxId })`, `extendTimeout`, and snapshot-backed `source`, treat the runtime as stable 1.x ephemeral sandboxes.243. If local code and types expose named sandboxes, `name`, `persistent`, session updates, or automatic resume after stop, treat the runtime as the persistent beta model.254. Qualify time-sensitive claims with a date or retrieval note.2627## Step 3: Apply core guardrails28291. Distinguish three separate clocks before diagnosing workspace loss:30 - Vercel function/runtime timeout31 - Application/request timeout in the embedding system32 - Sandbox timeout332. On stable 1.x, `Sandbox.get({ sandboxId })` only helps while the sandbox is still alive.343. On stable 1.x, once the sandbox stops, its filesystem is gone. Do not describe that as resumable persistence.354. `sandbox.snapshot()` is not workspace durability. It creates a new snapshot artifact and stops the source sandbox.365. Snapshots and persistent beta solve different problems:37 - snapshots create new starting points38 - persistent beta preserves named workspace state across sessions396. In embedded systems, inspect the consumer's persistence wiring before concluding that Vercel destroyed the workspace immediately.407. Do not infer persistent-beta behavior from a changelog alone. Confirm the installed SDK and local call sites.4142## Step 4: Investigate the Vercel surface first43441. Check the installed SDK surface first:45 - installed `@vercel/sandbox` types46 - official stable docs for concepts, snapshots, SDK reference, and limits47 - persistent-beta changelog only if named persistence is relevant482. Determine whether the question is about:49 - active sandbox reuse50 - stopped sandbox recovery51 - snapshot-based warm starts52 - persistent named workspaces533. Establish which timeout fired first and whether the sandbox should still have been active.5455## Step 5: Inspect consumer code only when the task is app-specific5657For repo-local debugging in Junior, inspect:58591. timeout budget alignment:60 - `packages/junior/src/chat/config.ts`61 - `packages/junior/src/chat/app/production.ts`622. sandbox identity persistence and reuse:63 - `packages/junior/src/chat/runtime/thread-state.ts`64 - `packages/junior/src/chat/runtime/turn-preparation.ts`65 - `packages/junior/src/chat/sandbox/session.ts`663. whether timeout paths actually resume:67 - `packages/junior/src/chat/agent/index.ts`68 - `packages/junior/src/chat/agent/resume.ts`69 - `packages/junior/src/chat/runtime/agent-continue-runner.ts`704. where sandbox metadata is persisted:71 - `packages/junior/src/chat/runtime/reply-executor.ts`725. whether consumer-specific snapshots are being confused with Vercel product persistence:73 - `packages/junior/src/chat/sandbox/README.md`7475## Step 6: Recommend the smallest correct fix7677Choose the narrowest fix that matches the diagnosed failure mode:78791. Sandbox still alive but next turn started fresh:80 - Persist sandbox identity earlier.81 - Resume from the active sandbox instead of recreating it.822. Sandbox actually stopped:83 - Increase sandbox timeout or extend it while work is active.84 - Externalize intermediate outputs if they must survive stop.853. Confusion caused by docs drift:86 - Align implementation advice to the installed SDK, not the newest beta docs.874. Need true durability across stop/timeout boundaries:88 - Use external storage or migrate intentionally to the persistent beta model after confirming API availability.8990## Step 7: Return a concrete diagnosis9192Default report structure:93941. Active sandbox model: `stable-ephemeral` or `persistent-beta`952. What likely timed out first963. Whether the sandbox probably still existed after the failed turn974. Whether workspace loss came from Vercel stop/destruction or consumer state handling985. Smallest next fix, with the exact file(s) or SDK change required