Runnable examples for Tenki Sandbox. Each folder under examples/ is a short program you can run against the live API and copy into your own project.
The first example takes about 10 minutes once you have an API key.
You need:
- A Tenki account and a
tk_API key. Create keys at app.tenki.cloud. - Node.js 24 or later for the JavaScript demos. Several
run.mjsscripts, including the first example, use top-levelawait using, which Node 22 cannot parse. The verify scripts run on Node 20, which is what CI uses. - Python 3.12 and uv for the Python examples. They run on Python 3.10 or later. CI uses 3.12. The Covalent example needs your local minor version to match the sandbox image (3.12 on the default image).
- Optional: the Tenki CLI, if you want
tenki loginto store the key.
git clone https://github.com/LuxorLabs/cookbook.git
cd cookbookEach example is self-contained: its own README, source, and dependencies. Nothing installs at the repository root. Install dependencies inside the example you run, with npm install or a virtual environment and that folder's requirements.txt.
export TENKI_API_KEY="tk_..."The JavaScript SDK also reads TENKI_AUTH_TOKEN. Python examples and CI use TENKI_API_KEY. Each example README names the variable it expects.
To store the key, run tenki login --api-key <key>. That writes ~/.config/tenki/config.yaml, and every verify script reads it from there. Some demos, including examples/run-code-in-a-sandbox/run.mjs, read the environment only, so export the key before you run those.
Tenki infers the workspace from the API key. If you set TENKI_WORKSPACE_ID, most scripts pass it through. Most verify and agent scripts also read current_workspace_id from ~/.config/tenki/config.yaml. DeerFlow's provider is the exception: when the account has more than one workspace, set workspace_id in the sandbox: block of its config (DeerFlow example). Authentication and client setup are in the Sandbox SDK guide.
Start with Run code in a sandbox. It is the create, execute, and dispose lifecycle in about 15 lines of JavaScript.
cd examples/run-code-in-a-sandbox
npm install
node run.mjsexit 0 -> 42
The script creates a sandbox, runs python3 -c "print(6 * 7)" inside it, prints the exit code and output, and terminates the sandbox when the script ends, because await using disposes it. The sandbox boots in about 2 seconds and is billed per second.
The same loop in Python is Run code with Python. From the repository root:
cd examples/run-code-python
uv venv --python 3.12
uv pip install -r requirements.txt
.venv/bin/python run.pyrun.py prints exit 0 -> 42. It also accepts a key saved by tenki login.
Open the example closest to what you are building and follow its README. Agent-framework examples need a model provider key, such as OPENAI_API_KEY, to run the agent. Their verify scripts call the sandbox tool directly and do not need that key.
| Example | What it covers |
|---|---|
| Run code in a sandbox | Create a sandbox, run a command, dispose it |
| Work with files | Read, write, and list files with the TypeScript SDK |
| Expose a port | Serve a web app on a public preview URL |
| Pause, snapshot, and resume | Preserve a sandbox and pick up where it left off |
| Run code with Python | The official tenki Python SDK |
| Run a full-stack app | Serve an API, frontend, and seeded database from one sandbox |
Give an agent a sandbox to run the code it writes.
| Example | What it covers |
|---|---|
| Claude Agent SDK | Tenki as the backend for the SDK's bash and file tools |
| Vercel AI SDK | Tenki as the AI SDK's experimental_sandbox |
| LangChain (JavaScript) | Sandboxed code interpreter tool |
| LangChain (Python) | Code-execution tool for a Python agent |
| CrewAI | Run agent-generated code in a sandbox |
| OpenAI Agents SDK | Sandboxed execution as an agent tool |
| LlamaIndex | Sandboxed execution as a FunctionTool |
| Hugging Face smolagents | Remote Python executor for a CodeAgent |
| Pi Durable | Remote execution env. Every tool call runs in a sandbox |
| AG2 | Native sandbox backend for shell and code tools |
| PraisonAI | One shared sandbox for a whole agent team |
| Example | What it covers |
|---|---|
| MCP server | Sandbox tools for Claude, Cursor, or any MCP client |
| MCP Apps | Tools that bring their own UI, rendered in a CopilotKit chat |
| Claude Code | Headless coding agent on a real repo checkout |
| Codex | OpenAI's coding agent, headless, on a real repo checkout |
| OpenCode | Headless OpenCode server on a public preview URL |
| Composio | Tenki tools in a Composio agent |
| Covalent | Each workflow task in its own sandbox |
| AgentBox | Coding-agent boxes on Tenki sandboxes |
| ComputeSDK | Tenki as a provider for the unified sandbox interface |
| TinyFish | Web agents, fetch, search, and remote browsers from the tenki/tinyfish image |
| Harbor | Agent evals and benchmarks (Terminal-Bench), one sandbox per trial |
| Convex | A sandbox per user from Convex actions, with live state in a Convex table |
Review pull requests with Tenki Code Reviewer.
| Example | What it covers |
|---|---|
| Cursor Origin | Tenki Code Reviewer on Origin pull requests, with AGENTS.md review rules |
Run a self-hosted agent platform's sandboxes on Tenki.
| Example | What it covers |
|---|---|
| DeerFlow | Community sandbox provider for ByteDance's SuperAgent harness |
| RAGFlow | Ephemeral sandboxes for the RAG engine's code components |
| Open WebUI | Sandboxed code interpreter for the self-hosted chat platform |
| AgentEnv | Built-in sandbox backend for Scale AI's RL environment framework |
| OpenHermit | Sticky per-agent sandboxes for an agent fleet |
| Omnara | Machine pool provider for the open-source managed agent platform |
Each guide shows the two APIs side by side.
| From | Guide |
|---|---|
| E2B | E2B to Tenki |
| Modal | Modal to Tenki |
| Daytona | Daytona to Tenki |
Every example includes verify.mjs. It calls the live API and exits non-zero when a check fails.
cd examples/run-code-in-a-sandbox
npm install
node verify.mjs✓ run-code-in-a-sandbox: create → exec python3 → 42 → dispose
That line means your key works: a sandbox boots, runs a command, and returns 42. Verify scripts still exit 0 if the final dispose fails, so the check mark is about the command result. In an agent example, the script checks the sandbox tool or backend and does not run a model turn.
In a Python example, verify.mjs is a shim. It runs verify.py with the example's .venv/bin/python when that interpreter exists, and otherwise with $PYTHON or python3. You can also run .venv/bin/python verify.py yourself.
To check every example, from the repository root:
node verify.mjsIt runs each example's verify.mjs and ends with ✓ all examples passed, or with ✗ N example(s) failed and a non-zero exit. It does not install dependencies. Install them first, as CI does in .github/workflows/verify.yml.
CI runs the same checks on every push and pull request, and a failed check blocks the merge. Two examples are skipped in CI:
composio-tenki, which needs a Composio API keycovalent-tenki, untilcovalent-tenki-plugin0.1.1 is on PyPI
node verify.mjs on your machine runs those two as well. If they fail locally, see Troubleshooting.
Packages you install in your own project:
| Integration | Install | What it does |
|---|---|---|
| Composio tools | npm install @tenkicloud/composio-tools |
Create, execute, snapshot, and terminate tools for Composio agents |
| Covalent executor | pip install covalent-tenki-plugin |
Runs Covalent workflow tasks in Tenki sandboxes |
| GitHub Actions | uses: TenkiCloud/actions/setup-cli@v1 |
Installs the Tenki CLI and builds sandbox templates in CI |
| Go SDK | go get github.com/LuxorLabs/tenki-sdk-go/sandbox |
Go client for the Tenki Sandbox API |
| Convex component | npm install @tenkicloud/convex |
Creates and drives sandboxes from Convex actions, with each one's state in a Convex table |
covalent-tenki-plugin 0.1.0 is the only release on PyPI. It depends on the renamed tenki-sandbox package, so pip install fails until 0.1.1 is published.
These projects ship a Tenki provider or backend:
| Project | Tenki integration |
|---|---|
| RAGFlow | Sandbox provider for the RAG engine's code executor — example |
| DeerFlow | Sandbox provider for ByteDance's SuperAgent harness — example |
| AgentBox | Provider for running parallel agents in sandboxes — example |
| ComputeSDK | Tenki provider for the multi-provider compute toolkit — example |
| AgentEnv Framework | Sandbox backend for Scale AI's RL environments — example |
| OpenHermit | Sandboxed exec backend for AI agent fleets — example |
| Omnara | Machine pool provider for the open-source managed agent platform — example |
missing auth token - set TENKI_AUTH_TOKEN or TENKI_API_KEY or use authToken option. The SDK found no key.run.mjsreads the environment only. ExportTENKI_AUTH_TOKENorTENKI_API_KEYin the shell you run it from.invalid auth token - API keys and service tokens must start with tk_. The SDK acceptstk_API keys. Create one at app.tenki.cloud.No token. Set TENKI_AUTH_TOKEN, or run tenki login. A JavaScriptverify.mjsfound no key inTENKI_AUTH_TOKEN,TENKI_API_KEY, or~/.config/tenki/config.yaml.composio-tenkiandvercel-ai-sdkprintNo Tenki token. ….mcp-tenki-sandboxprintsNo token. Set TENKI_API_KEY, …. Export one of the variables, or runtenki login --api-key <key>.No API key. Set TENKI_API_KEY, or run tenki login --api-key <key>. A Pythonverify.pyfound no key in those same places. ExportTENKI_API_KEY, or runtenki login --api-key <key>.node run.mjsfails with aSyntaxErroratawait using. Top-levelawait usingneeds Node 24. Node 22 cannot parse it.node verify.mjsstill runs on Node 20.node verify.mjsat the repository root printsFAILED: <example>for an example you have not set up. The root script expects that example's dependencies to be installed already. Install them in the example folder, or run that folder's ownnode verify.mjs.FAILED: composio-tenkiorFAILED: covalent-tenkifromnode verify.mjsat the repository root. CI skips both.composio-tenkialso needs aCOMPOSIO_API_KEYfrom app.composio.dev.covalent-tenkineedscovalent-tenki-plugin0.1.1 or later, because 0.1.0 depends on the renamedtenki-sandboxpackage and no longer installs. Until 0.1.1 is published, runnode verify.mjsinside the examples you use.ModuleNotFoundError: No module named '<package>'from a Python example'sverify.mjs. The shim runs.venv/bin/pythonwhen that file exists, and otherwise$PYTHONorpython3. Create the venv in the example folder withuv venv --python 3.12anduv pip install -r requirements.txt. You can also setPYTHONto an interpreter that already has the packages.
Can I depend on this repository from an app? Each example is a short program to read and copy. To use Tenki in a project you ship, install the SDK or one of the official integrations above. A passing verify script checks the Tenki calls in that example. In the agent examples it does not run a model turn.
Which example should I copy? For the SDK, run-code-in-a-sandbox. For a framework agent with a code-execution tool, langchain-code-interpreter. For a pluggable sandbox backend, vercel-ai-sdk.
Do the examples clean up their sandboxes? Sandboxes are billed per second. run.mjs disposes its sandbox with await using, and run.py uses a with block. Every verify script is required to clean up any sandbox it creates.
Contributions are welcome. CONTRIBUTING.md covers local setup, the example checklist, and the verification contract. A new example ships a verify.mjs that CI runs against the live API, and adds a row to one of the tables above.