home /all posts/ here

AOW-01 Deploying sandboxed agents in Kubernetes

December 1, 2026 • 5 minutes read • agentic-engineering kubernetes platform-engineering advent-of-word-2026

This is the first piece of the series Advent of Writing 2026 where I write through the 24 days of December. All posts are tagged with advent-of-word-2026.

I have been experimenting with deploying remote coding agents at work - I have a primary use case that I'm using as a proof-of-concept. The idea is simple: every new agent session gets a bunch of files pre-populated in the session and the user can iterate with the coding agent working with the files to build a final thing. The use case is quite restricted and hence perfect to start with.

While reading about how various solutions approach solving the problem of sandboxing and durability in cloud agents, I realised there are two approaches, each solving a unique problem, but these are often described in an overlapping manner.

Approach 1: Everything in a box - agent-substrate and microVMs #

The first idea is to package the agent, its memory and the file system into a box and run it in a restricted environment - often a sandboxed Kubernetes pod or a micro virtual machine. Agent Substrate is a Kubernetes setup which provides sandboxed durable agents by packaging everything into an entity called actor. Actors run on kernel-safe isolation provided by gVisor - a Linux-like API that prevents the actor from executing dangerous operations on the host OS. Durability is ensured by snapshotting the filesystem and state to a persistent store like S3.

Agent, memory and filesystem packaged in a single sandboxed actor

Firecracker is another sandboxing mechanism which provides hardware-level isolation. Solutions like Docker Sandboxes put the agent and surrounding features like the filesystem and the OS in a container which runs in a microVM, thus isolating the workload and preventing any bad syscalls from the agent.

This approach is theoretically simple as you can directly take your containerised setup and make it secure by deploying to something like agent-substrate.

Approach 2: Agent/harness decoupled from the sandbox #

If you think of most use cases, the harness itself is not dangerous. The risk is introduced when the agent is handed tools like filesystem access and OS syscalls, e.g. rm or exec. Why not sandbox only this part of the setup? That's the idea of this approach.

Agent control plane decoupled from sandboxed workspaces

You run the agent as a simple prompt agent, e.g. Agent with a simple system prompt in kagent which runs Pydantic's agent loop. Then you provide sandboxed workspaces for the agent to work with and expose an API that the agent uses to interact with the workspace. This API could be an MCP server or a mapped API through regular RPC.

Agents built on CloudFlare run this way - the agent itself is a durable object and it receives a sandbox computer, which is a throwaway workspace which is secure. Solutions in this approach use microVMs like Firecracker to host only the workspaces instead of the entire agent setup.

The benefit of this approach is that you decouple the agent from the workspace, hence allowing you to manage the sandboxed workspaces fully. This is very useful for cloud agents as you can dynamically provision sandboxes for execution with custom setup for each workspace while keeping the agent core lean and same across different use cases. You can also scale your sessions independent of the agent.

Which one to choose? #

I believe the first approach is advertised as a one-stop-shop solution for running deployed agents in Kubernetes due to its simple approach and using Kubernetes primitives. Yet I feel it's too simple, too early if you have a vision to run systems like a software factory where multiple agents start sessions on-demand and execution has to be scaled.

The second approach seems cleaner in design to me as it strictly separates the control plane, which is the agent, from the data plane - the user/session-specific filesystem and OS.


For my use case, I have now implemented a simple setup using the second approach where an MCP provides tools to access a sandboxed workspace per session to the agent. I am exploring use agent-sandbox to run sandboxed workloads while keeping the agents running in kagent control plane.

Related posts


Subscribe to get my latest posts by email.

    I won't send you spam. Unsubscribe at any time.

    © Mohit Karekar • [email protected] •