Start a Linux microVM for your code, run commands in it, and read and write its files.
For CUDA workloads, see the GPU sandboxes.
A CPU sandbox is a Linux microVM. It has its own kernel, disk and network. Code in one sandbox cannot reach another sandbox, unless both are in a network that you make.
Use a sandbox for:
- Code that you do not trust, such as code that an AI agent writes.
- A test or a build that must start clean.
- An agent that needs its own computer. See Cloud Agents.
| Property | Value |
|---|---|
| Base URL | https://api.munito.ai/sandboxes/v1 |
| Key variable | MUNITO_API_KEY |
| Templates | base (Debian), ubuntu (Ubuntu with Docker), agent and desktop. See Templates |
| Work folder | /workspace. Each command starts there, unless you set cwd |
Without code
The Sandboxes console creates and terminates sandboxes, opens ports in a browser, and shows SSH commands and desktop screens. It also pauses and resumes persistent sandboxes. Use the API for other operations.
Install the CLI
npm install -g @munitoai/cli
munito loginmunito login asks for a key with the Inference permission, from
the console. See the command line tool.
The steps below include cURL examples for use without the CLI.
Quick start
1. Create a sandbox
munito create --size small --timeout 600The sandbox uses the base template. Internet access and other optional features default to off.
Pass --internet for outbound connections, and --size tiny for one vCPU and 128 MiB, restored from a
prepared snapshot.
Keep the id it prints for the next steps:
export SANDBOX="sbx_01k8f6x7g3d2b9v5n4m1q0w8e6"2. Run a command
munito exec $SANDBOX "python3 -c 'print(6 * 7)'"munito run "<command>" does the same in a throwaway sandbox: it creates one, runs the command, prints the
output and deletes the machine.
- A string runs in
bash -lc. A list, such as["python3", "-V"], is the argument vector. - To get events while the command runs, set
"stream": true. The API sends NDJSON:stdoutandstderrevents, then oneexitevent. - To create a sandbox and run a command in one request, set
commandin the create. The answer gives the result incommand. This command runs for 60 seconds or less.
3. Write, read and list files
echo 'print("Hello from the sandbox")' | munito files write $SANDBOX /workspace/hello.py
munito files read $SANDBOX /workspace/hello.py
munito files ls $SANDBOX /workspace- A write creates the parent folders. It replaces a file that exists.
munito files writereads the content from standard input. To send a local file, add--from <file>.munito files readprints the bytes of the file. To save them, add> <file>.munito files lslists/workspacewhen you give no folder.
4. Find your sandboxes again
munito lsmetadata holds your own keys and values. Set them when you create a sandbox.
Pass each pair as key=value to GET /sandboxes to list sandboxes that match every pair:
5. Keep the sandbox longer
munito timeout $SANDBOX 3600- The sandbox gets a new end, 3,600 seconds from the call. The answer gives the time in
expires_at. - A timeout has a limit. To run longer, set a new timeout before the end.
- At the end of its timeout, a sandbox stops. A persistent sandbox pauses.
6. Delete the sandbox
munito rm $SANDBOXThe sandbox stops at once, and its files are deleted. GET /sandboxes/{sandbox_id} still shows the sandbox, with the status stopped.
Report abuse
The ports and SSH of the sandboxes have addresses under munito.run, such as https://8080-<id>.munito.run. The code at these addresses belongs to the customers of Munito AI.
To report phishing, malware or other abuse at such an address, send its full URL to [email protected].