Overview
Run untrusted Python or bash for your agent in a fresh gVisor sandbox.
Kandang is a throwaway Linux box for AI agents. Your agent sends code and input files, Kandang runs them in a fresh sandbox, and sends back stdout, stderr and the files the code wrote. The sandbox is gone when the run ends.
It never holds a secret. Anything that needs an API key stays in your agent, which fetches the data first and passes it in as a file.
How a run works
Your agent sends a request. POST /v1/runs with the language, the code and any input files, base64 encoded.
Kandang starts a sandbox. A gVisor sandbox with no network, a read-only root, a non-root user, no capabilities and its own memory, CPU and process caps.
The code runs in /work. Inputs are in /work/in. Anything the code writes to /work/out comes back.
Kandang answers and cleans up. The response has the exit code, stdout, stderr, the output files and the peak memory. Then the sandbox, its cgroup and its files are removed.
What's in the box
Alpine with bash and Python, plus numpy, pandas, matplotlib, Pillow, openpyxl, pypdf, python-docx and requests. The image is about 170 MB. There's no network, so pip install and requests calls to the internet don't work inside a run.
Next
- API: the one endpoint, its fields and its errors.
- Sandbox and limits: what every run gets and where it stops.
- Self-hosting: run Kandang on your own machine.