AI Coding Agents
One of the most powerful use cases for Modbox is giving AI coding agents a fully isolated execution environment. Instead of running agent-generated code on your infrastructure, each agent gets its own sandbox — with its own filesystem, network, and process space.
The problem without sandboxes
When an AI agent writes and runs code, a few things can go wrong:
- Security — agent-generated code can exfiltrate secrets, delete files, or call external APIs you didn’t authorize
- Isolation — one agent’s side effects can corrupt another agent’s state
- Cleanup — leftover processes, temporary files, and installed packages accumulate
- Resource limits — a runaway loop can consume all available CPU or memory
Modbox solves all of this by giving each agent its own container with a configurable TTL.
Architecture
Each sandbox is completely isolated. Agents communicate with their sandbox via HTTP — sending code to execute and receiving output back.
Example: AI coding agent with per-session sandboxes
Multi-step agent loops
For agents that run multiple steps (like ReAct or tool-calling loops), keep the sandbox alive across steps:
State persists within a sandbox session — installed packages, created files, and environment variables are all retained across multiple executions in the same sandbox.
Recommendations
Always set a TTL. Without it, a crashed agent can leave sandboxes running indefinitely, incurring costs.