---
title: Working with Sandbox
product: vercel
url: /docs/vercel-sandbox/working-with-sandbox
type: conceptual
prerequisites:
  - /docs/vercel-sandbox
related:
  - /docs/vercel-sandbox/concepts/persistent-sandboxes
  - /docs/vercel-sandbox/pricing
  - /docs/vercel-sandbox/cli-reference
summary: Task-oriented guides for common Vercel Sandbox operations.
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

# Working with Sandbox

This page covers common tasks when working with Vercel Sandbox.

> **💡 Note:** **[Persistent sandboxes](/docs/vercel-sandbox/concepts/persistent-sandboxes)** are available in beta. They automatically save state when stopped and resume where you left off, so you don't need to manage snapshots manually. Install `@vercel/sandbox@beta` or `sandbox@beta` to try them.

## Execute long-running tasks

By default, sandboxes timeout after 5 minutes. For longer tasks, set a custom timeout when creating the sandbox:

To extend a running sandbox, call `extendTimeout`:

See [Pricing and Limits](/docs/vercel-sandbox/pricing#runtime-limits) for maximum durations by plan.

## Debug with an interactive shell

Connect to a running sandbox for interactive debugging with an SSH-like experience:

```bash
sandbox connect <sandbox-id>
```

Once connected, you have full shell access to inspect logs, check processes, and explore the filesystem.

See [CLI Reference](/docs/vercel-sandbox/cli-reference#sandbox-connect) for all options.

## Monitor your sandbox

View your sandboxes in the [Sandboxes dashboard](https://vercel.com/d?to=%2F%5Bteam%5D%2F%5Bproject%5D%2Fobservability%2Fsandboxes\&title=Show+Sandbox+Page). For each project, you can see:

- Total sandboxes created
- Currently running sandboxes
- Stopped sandboxes
- Command history and sandbox URLs

Track compute usage across projects in the [Usage dashboard](https://vercel.com/d?to=%2Fdashboard%2F%5Bteam%5D%2Fusage\&title=Show+Usage+Page), which measures:

- **Sandbox Provisioned Memory**: Memory allocated to your sandboxes
- **Sandbox Data Transfer**: Data transferred in and out
- **Sandbox Active CPU**: CPU time consumed
- **Sandbox Creations**: Number of sandboxes created
- **Snapshot Storage**: Sandbox snapshot storage

## Stop a sandbox

There are three ways to stop a sandbox:

### Through the dashboard

1. Go to [Sandboxes](https://vercel.com/d?to=%2F%5Bteam%5D%2F%5Bproject%5D%2Fobservability%2Fsandboxes\&title=Show+Sandbox+Page) in **Observability**.
2. Select your sandbox.
3. Click **Stop Sandbox**.

### Programmatically

### Automatic timeout

Sandboxes stop automatically when their timeout expires. The default is 5 minutes.

## Examples

**View all Sandbox examples**: Browse the complete collection of Sandbox guides, tutorials, and code samples. [Learn more →](/kb/sandbox)

**Reconnect to a running sandbox**: Learn how to use Sandbox.get() to reconnect to an existing sandbox from a different process or after a script restart. [Learn more →](/kb/guide/how-to-reconnect-to-a-running-sandbox)

**Execute AI-generated code safely**: Learn how to run code generated by AI models in an isolated sandbox environment. [Learn more →](/kb/guide/how-to-execute-ai-generated-code-safely)

**Install system packages**: Learn how to install additional system packages in Vercel Sandbox using dnf, the package manager for Amazon Linux 2023. [Learn more →](/kb/guide/how-to-install-system-packages-in-vercel-sandbox)

**Use with Claude Agent SDK**: Learn how to deploy Claude's Agent SDK in Vercel Sandbox for secure and isolated execution of AI-powered code generation and autonomous agent tasks. [Learn more →](/kb/guide/using-vercel-sandbox-claude-agent-sdk)

**Run AI-generated code**: How to execute untrusted, AI-generated code inside Vercel Sandbox - an isolated, ephemeral environment. [Learn more →](/kb/guide/running-ai-generated-code-sandbox)

**Use private GitHub repositories**: Learn how to create sandboxes from private GitHub repositories using personal access tokens or GitHub App installation tokens. [Learn more →](/kb/guide/sandbox-private-github-repositories)

**Run OpenClaw in Vercel Sandbox**: Learn how to run OpenClaw in Vercel Sandbox for secure and isolated execution. [Learn more →](/kb/guide/running-openclaw-in-vercel-sandbox)

**Run OpenCode securely with the Vercel Sandbox**: Learn how to run OpenCode securely with the Vercel Sandbox to build your own background coding agent [Learn more →](/kb/guide/running-opencode-securely-with-the-vercel-sandbox)


---

[View full sitemap](/docs/sitemap)
