> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-opensw-1781706951-9d0138e.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# VercelSandbox integration

> Integrate with the VercelSandbox sandbox backend using LangChain Python.

[Vercel Sandbox](https://vercel.com/docs/vercel-sandbox) provides ephemeral, isolated Linux environments for running untrusted code. See the [Vercel Sandbox docs](https://vercel.com/docs/vercel-sandbox) for signup, authentication, and platform details.

## Installation

<CodeGroup>
  ```bash pip theme={null}
  pip install langchain-vercel-sandbox
  ```

  ```bash uv theme={null}
  uv add langchain-vercel-sandbox
  ```
</CodeGroup>

## Authentication

The Vercel SDK reads credentials from the environment. Set the following variables, or use [OIDC](https://vercel.com/docs/oidc) when running on Vercel:

```bash theme={null}
export VERCEL_TOKEN="your-token"
export VERCEL_PROJECT_ID="your-project-id"
export VERCEL_TEAM_ID="your-team-id"
```

## Create a sandbox backend

In Python, you create the sandbox using the provider SDK, then wrap it with the [deepagents backend](/oss/python/deepagents/backends).

```python theme={null}
from vercel.sandbox import Sandbox

from langchain_vercel_sandbox import VercelSandbox

sandbox = Sandbox.create()
backend = VercelSandbox(sandbox=sandbox)

try:
    result = backend.execute("echo hello")
    print(result.output)
finally:
    sandbox.stop()
```

## Use with Deep Agents

```python theme={null}
from vercel.sandbox import Sandbox
from langchain_anthropic import ChatAnthropic

from deepagents import create_deep_agent
from langchain_vercel_sandbox import VercelSandbox

sandbox = Sandbox.create()
backend = VercelSandbox(sandbox=sandbox)

agent = create_deep_agent(
    model=ChatAnthropic(model="claude-sonnet-4-20250514"),
    system_prompt="You are a coding assistant with sandbox access.",
    backend=backend,
)

try:
    result = agent.invoke(
        {"messages": [{"role": "user", "content": "Create a small Python project and run tests"}]}
    )
finally:
    sandbox.stop()
```

## Cleanup

Always stop the sandbox when you are done to avoid ongoing resource usage.

See also: [Sandboxes](/oss/python/deepagents/sandboxes).

***

<div className="source-links">
  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>

  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/oss/python/integrations/sandboxes/vercel.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>
</div>
