| title | Quickstart |
|---|---|
| description | Get started with Upstash Box: install the SDK, create an isolated cloud container, configure an AI agent, and run your first task. |
Upstash Box lets you give your AI agents a computer.
Every Upstash Box is a secure, isolated cloud container with an AI Agent built-in. Spin up as many as you want in parallel. Each one includes a full environment with a filesystem, shell, git, and a runtime. Your agent can read files, write code, and execute tasks inside it.
Upstash Box is in developer preview — APIs and pricing may change.
Go to the Upstash Console and create an API key.
```bash npm npm install @upstash/box ```yarn add @upstash/boxpnpm add @upstash/boxbun install @upstash/boxpip install upstash-boxUPSTASH_BOX_API_KEY=box_xxxxxxxxxxxxxxxxxxxxxxxxconst box = await Box.create({ runtime: "node", })
```python box.py
from upstash_box import Box
box = Box.create(runtime="node")
Your box is ready to use! You can already use it as a standalone, secure, isolated sandbox with full shell access, git, and filesystem operations.
You can also create a keep-alive box by setting `keepAlive: true`. Keep-alive boxes stay on between sessions and can run an `initCommand` at startup. See [Keep Alive](/box/overall/keep-alive).To configure an agent for your box, pass the model you want to use and the provider API key:
```typescript box.ts {5-8} import { Agent, Box } from "@upstash/box"const box = await Box.create({ runtime: "node", agent: { harness: Agent.ClaudeCode, model: "anthropic/claude-opus-4-6", apiKey: process.env.ANTHROPIC_API_KEY, }, })
```python box.py {6-10}
import os
from upstash_box import Box, Agent
box = Box.create(
runtime="node",
agent={
"harness": Agent.CLAUDE_CODE,
"model": "anthropic/claude-opus-4-6",
"api_key": os.environ["ANTHROPIC_API_KEY"],
},
)
const box = await Box.create({ runtime: "node", agent: { harness: Agent.Codex, model: "openai/gpt-5.3-codex", apiKey: process.env.OPENAI_API_KEY, }, })
```python box.py {6-10}
import os
from upstash_box import Box, Agent
box = Box.create(
runtime="node",
agent={
"harness": Agent.CODEX,
"model": "openai/gpt-5.3-codex",
"api_key": os.environ["OPENAI_API_KEY"],
},
)
Your box is ready to use! It's a secure cloud environment to run agents, execute commands, or manage files. For example:
```typescript box.ts import { Agent, Box } from "@upstash/box"const box = await Box.create({ runtime: "node", agent: { harness: Agent.ClaudeCode, model: "anthropic/claude-opus-4-6", apiKey: process.env.ANTHROPIC_API_KEY, }, })
// 👇 execute OS-level commands await box.exec.command("node --version")
// 👇 run agent await box.agent.run({ prompt: "create an index.txt saying 'hello world'", })
```python box.py
import os
from upstash_box import Box, Agent
box = Box.create(
runtime="node",
agent={
"harness": Agent.CLAUDE_CODE,
"model": "anthropic/claude-opus-4-6",
"api_key": os.environ["ANTHROPIC_API_KEY"],
},
)
# 👇 execute OS-level commands
box.exec.command("node --version")
# 👇 run agent
box.agent.run(prompt="create an index.txt saying 'hello world'")
You can also connect directly to a box shell with SSH:
ssh <box-id>@us-east-1.box.upstash.comWhen SSH asks for a password, enter your Box API key.
You can copy the exact SSH command for a box from the SSH button on its details page in the Upstash Console.
The idea behind Upstash Box is simple: give AI its own computer. Your agent gets a full, isolated cloud environment it can control. Run commands, write files, or execute code independent of any user device. Freeze a box anytime, and continue days or even weeks later with perfect resumability.
Great example use cases:
One box per user with durable state. Personalized agents that remember context and improve over time. Fan out to multiple boxes running specialized agents in parallel, then combine their results. Run the same inputs across isolated boxes and compare model output side by side.Learn the basics about using Upstash Box. Boxes have Claude Code, Codex or OpenCode built-in.
