Skip to main content
Building with an AI coding agent?
Run npx upstash to install the Upstash MCP server and skills in Claude Code, Cursor, Codex, and other agents.

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.

1. Get your API key#

Go to the Upstash Console and create an API key.

Create a Box API key in the Upstash Console

2. Install the SDK#

3. Set API Key#

.env

4. Create a Box#

Tip

The Python SDK ships both a synchronous Box (used here) and an asynchronous AsyncBox (box = await AsyncBox.create(...)).

Tip

By default, runtimes use Debian (glibc). For smaller Alpine-based images, use "node-alpine", "python-alpine", etc.

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.

Tip

You can also create a keep-alive box by setting keepAlive: true. Keep-alive boxes stay on between sessions instead of auto-pausing. See Keep Alive.

Init command#

Pass initCommand to run a startup script each time the box starts. It runs once per container start, on create, on resume, and after a snapshot restore, so it is the place to start a server that should come back with the box.

This example uses Node.js’s built-in HTTP server, so it works in a fresh box without installing packages. The command runs from /workspace/home. For an existing app, prepare its project files and dependencies before setting its startup command.

You can read, change, or remove the command later with getInitCommand, setInitCommand, and deleteInitCommand (get_init_command, set_init_command, delete_init_command in Python), on any box including a paused one. A box restored from a snapshot does not inherit the snapshot’s init command, so pass it again on the restore.


5. Configure an Agent (optional)#

To configure an agent for your box, pass the model you want to use and the provider API key:

6. Run Your First Task#

Your box is ready to use! It’s a secure cloud environment to run agents, execute commands, or manage files. For example:

7. Connect over SSH#

You can also connect directly to a box shell with SSH:

When 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.


Use Cases#

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:


Next Steps#

SDKs#