CODE SANDBOXES FOR AI AGENTSBETA

AI Sandboxes

Disposable sandboxes your AI agent can run code in.

One API call creates a Linux sandbox. Your agent runs the code it wrote, reads the output and files back, then deletes it. The code stays away from your machine and your servers.Python, Node or shell · from €0.052 an hour, billed by the second · European cloud region

Run Code From Your Agent

Three calls to the public REST API: create, run, delete. Use curl, any HTTP library, or the rarecloud CLI.

  1. Create a sandbox

    POST /v1/sandboxes

    Pick a template. Python is the default, with the data stack already installed.

  2. Run the code

    POST /v1/sandboxes/ID/run_code

    Send the code your model wrote and get back stdout, stderr and the exit code. Shell commands and files work the same way.

  3. Delete it

    DELETE /v1/sandboxes/ID

    Read out the files you want to keep, then delete the sandbox. Its billing stops when it is gone.

# 1. create a python sandbox
curl -X POST https://api.rarecloud.io/v1/sandboxes \
  -H "Authorization: Bearer rc_pat_YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"template": "python"}'

# 2. run the model's code in it
curl -X POST https://api.rarecloud.io/v1/sandboxes/SANDBOX_ID/run_code \
  -H "Authorization: Bearer rc_pat_YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"language": "python", "code": "import pandas as pd; print(pd.__version__)"}'

# 3. delete it
curl -X DELETE https://api.rarecloud.io/v1/sandboxes/SANDBOX_ID \
  -H "Authorization: Bearer rc_pat_YOUR_TOKEN"

Read the API referenceInstall the CLI

Three templates, one rate

TemplatePer hour
python
Python 3.12 with numpy, pandas, matplotlib, scipy and scikit-learn. 1 vCPU, 2 GB
€0.064
node
Node.js 22. 1 vCPU, 2 GB
€0.064
base
Debian 12 shell and files. 1 vCPU, 1 GB
€0.052

€0.04 per vCPU-hour plus €0.012 per GB of memory, metered by the second from creation until you delete the sandbox. Beta prices, excluding VAT. Usage is invoiced monthly with the rest of your cloud.

Included With Every Sandbox

A real Linux userland with the tools agents reach for, kept apart from everything else you run.

Isolated From the Host
Each sandbox runs under a user-space kernel, on servers that run only sandboxes, as a non-root user with read-only system files and no cloud credentials inside.
Python Data Stack
Python 3.12 with numpy, pandas, matplotlib, scipy, scikit-learn, requests, pillow and openpyxl ready to import. pip install adds the rest.
Node and Shell
A Node.js 22 template for JavaScript, and a small Debian 12 template for shell commands and files.
Files In and Out
Write a file into the sandbox, let the code work on it, then read the result back by path.
Outbound Internet
Nothing outside can connect in to a sandbox. Outbound requests and package installs work, while private networks and the cloud metadata service stay out of reach.
Your Own Image
Start from a public container image of your own instead of a template. The template you choose still sets the size and the price.

Frequently Asked Questions

What is an AI sandbox for?
Running code you did not write yourself, usually code an AI model just produced: a calculation, a data analysis on an uploaded file, a chart, a test run, a package your agent wants to try. The code runs in its own Linux sandbox instead of on your machine or your servers.
How are sandboxes isolated?
Each sandbox runs under a user-space kernel that sits between the code and the host, on servers that run only sandboxes. Inside, the code runs as a non-root user with read-only system files, no added privileges and no cloud credentials. Each account's sandboxes live in their own namespace, nothing from outside can connect in, and the code cannot reach private networks or the cloud metadata service.
How is it billed?
By the second, for the vCPU and memory of the template you picked, from the moment the sandbox is created until you delete it. Usage is added to your monthly cloud invoice, and the credit on your account pays it. Prices exclude VAT and may change while the product is in beta.
What can I run inside?
Python and Node code through run_code, and any shell command through commands. Install packages with pip or npm, read and write files, and make outbound requests. Your home directory and /tmp are writable.
Can I use my own image?
Yes. Pass any public container image when you create the sandbox. It runs as a non-root user with a read-only system disk, so the image has to work that way. Private registries are not supported yet.
How long does a sandbox live?
Sandboxes are meant for one job: create one, run the work, read out what you need, delete it. Billing runs while a sandbox exists, so delete it when the job is done.
Which tools can my agent use?
The REST API with a scoped token, from any language, and the rarecloud CLI. Any agent that can make an HTTP request or run a shell command can drive a sandbox. The RareCloud MCP server does not include sandbox tools yet.
Where do sandboxes run?
In our European cloud region, the first we have opened, in Bucharest, Romania. Invoices come from Rare Mood Agency SRL (RareCloud) with EU VAT, in EUR or USD.
AI Sandbox or Cloud VM?
Use a sandbox for short jobs with code you do not fully trust: model-written code, tests, one-off analysis. Use a Cloud VM for anything that runs for a long time and needs SSH, a public IP or its own disk. Both live in the same account and on the same monthly invoice.

Give Your Agent a Sandbox

Create an API token in the console and run your first sandbox in a few lines of code.