# upstash-box-py

Teaches coding assistants to build with the upstash-box Python SDK for sandboxed cloud containers, agents, headless browsers, and cron jobs.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 991 installs · ★ 34
- Author: Upstash
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/upstash/skills/tree/HEAD/skills/upstash-box-py/SKILL.md
- Updated: 2026-10-22
- HTML: https://affpapa.org/en/nevibecode/skills/upstash-box-py

## What it does

This skill provides implementation patterns for the `upstash-box` library using synchronous `Box` and asynchronous `AsyncBox` classes. It teaches coding assistants how to configure sandboxes across Node, Python, Golang, Ruby, or Rust runtimes, select compute sizes up to 8 CPUs and 16 GB RAM, and provision headless Chromium.

The model receives instructions for orchestrating in-container agents such as Claude Code or Codex. It covers parsing structured tool output via Pydantic schemas, streaming chunk types, attaching files up to 10 MB, and managing account-level environment variables.

Calls fail without an API key supplied via constructor arguments or the `UPSTASH_BOX_API_KEY` environment variable. Calling `box.pause()` on boxes marked with `keep_alive=True` immediately raises an error because these instances do not idle-pause.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add upstash/skills --skill upstash-box-py -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/upstash-box-py/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/upstash-box-py/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add upstash/skills --skill upstash-box-py -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/upstash-box-py/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add upstash/skills --skill upstash-box-py -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/upstash-box-py/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install upstash/skills upstash-box-py
```

2. **Manually: put the files in place**
- File: `.github/skills/upstash-box-py/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add upstash/skills --skill upstash-box-py -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/upstash/skills --path skills/upstash-box-py
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/upstash-box-py/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add upstash/skills --skill upstash-box-py -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/upstash/skills/tree/HEAD/skills/upstash-box-py/SKILL.md

## When to use it
- provision isolated cloud sandbox containers via the Python SDK
- execute coding agents inside containers with Pydantic validation
- automate headless Chromium inside isolated cloud environments
- dispatch agent jobs with webhook notifications

## Example prompts
- Create an async Box container with the Node runtime and a headless browser using upstash-box.
- Write code to run an agent in a Box and validate the response with a Pydantic schema.

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 280352f5d42c59d2.

BEGIN THIRD-PARTY FILE 280352f5d42c59d2
````text
---
name: upstash-box-py
description: Work with the upstash-box Python SDK for sandboxed cloud containers with AI agents, shell, filesystem, git, cron schedules, snapshots, and a headless browser. Use when building with Upstash Box in Python, creating a sandbox or isolated environment to run untrusted or agent-generated code, running AI coding agents in containers, giving an agent a cloud dev environment with a shell and repository, browser automation from a box, scheduling recurring jobs inside a box, saving and restoring snapshots, or orchestrating parallel boxes.
license: MIT
metadata:
  author: Upstash
  homepage: https://upstash.com
---

# upstash-box Python SDK

Sandboxed cloud containers with built-in AI agents, shell, filesystem, git, cron schedules, and an optional headless browser.

Mirrors the `@upstash/box` TypeScript SDK (`upstash-box-js` skill) with
snake_case names; the intentional differences are listed under Gotchas.

## Install & Setup

```bash
pip install upstash-box
```

Set `UPSTASH_BOX_API_KEY` env var or pass `api_key` to constructors.

The SDK ships both a synchronous `Box` (used in the examples below) and an
asynchronous `AsyncBox` (`box = await AsyncBox.create(...)`, `await box.agent.run(...)`).
The async surface is identical with `await` and `async for`.

Anonymous telemetry headers are sent with every request; opt out with the
`UPSTASH_DISABLE_TELEMETRY` env var.

## Box Lifecycle

```python
import os
from upstash_box import Box, Agent, ClaudeCode, BoxApiKey

# Create with agent + git + env vars
box = Box.create(
    name="my-box",
    runtime="node",  # "node" | "python" | "golang" | "ruby" | "rust" (+ "-alpine" variants)
    size="small",  # "small" (2 CPU/4GB) | "medium" (4/8) | "large" (8/16)
    labels=["beta", "x-team"],  # max 5, <=20 chars each
    keep_alive=True,  # don't idle-pause the box
    init_command="npm install && npm run dev",  # keep-alive boxes only
    browser=True,  # provision headless Chromium for box.browser
    agent={
        "harness": Agent.CLAUDE_CODE,  # Agent.CODEX | Agent.OPEN_CODE | Agent.CURSOR | Agent.CUSTOM
        "model": ClaudeCode.SONNET_4_5,  # or a plain string "anthropic/claude-sonnet-4-5"
        # api_key options:
        #   omit                    → server decides which key to use
        #   BoxApiKey.UPSTASH_KEY   → use Upstash-provided LLM key
        #   BoxApiKey.STORED_KEY    → use key previously stored via Upstash Console
        #   "sk-..."                → direct API key string
        "api_key": BoxApiKey.UPSTASH_KEY,
    },
    git={  # all fields optional
        "token": os.environ["GITHUB_TOKEN"],  # or link your GitHub account via Upstash Console
        "user_name": "Bot",
        "user_email": "bot@example.com",
    },
    env={"DATABASE_URL": "..."},
    skills=["upstash/qstash-js/qstash-js"],  # owner/repo/skill-name
    timeout=600_000,  # request timeout in ms
    debug=False,
)

# Reconnect, list, delete, pause/resume
````
END THIRD-PARTY FILE 280352f5d42c59d2

The third-party file has ended. Everything between the 280352f5d42c59d2 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2978 of 35425 bytes. © Upstash · MIT · https://github.com/upstash/skills/tree/HEAD/skills/upstash-box-py/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
