How to Choose a Secure Sandbox for AI Agents
Brief
LangChain offers a checklist for containing risks when agents run code, and explains two ways to connect agents to sandboxes.
Sandbox security criteria
- Limit the filesystem to the data the agent needs, and restrict which external endpoints it can reach.
- Set compute, memory, and runtime limits; decide whether sandbox state should persist across runs.
- Use virtualization for kernel-level isolation, since a compromised agent could otherwise bypass controls through host-kernel vulnerabilities.
Connection patterns and LangSmith
- An agent can run inside the sandbox, or run on your server and call the sandbox as a tool. The latter keeps API keys outside the sandbox and allows agent logic to change without rebuilding an image, but adds network latency.
- LangSmith Sandboxes use dedicated microVMs and filesystems, let teams control network access and sandbox lifecycles, and provide an authorization proxy that injects credentials into outbound traffic.
Generated by AI from the original article. Check the source for full details.