Why the Agent's Brain Needs to Live Outside the Sandbox
The Illusion of the Sandbox
When I first read about building AI agents, the 'sandbox' felt like the perfect answer. It’s the secure little box where you run the model, keeping everything contained. For simple, single-user tasks, this is great. It keeps the inputs and outputs clean and the state isolated. I thought, 'Everything is contained, everything is safe.'
But then I realized that 'safe' and 'scalable' are two very different things. If an agent needs to remember what happened yesterday, share data with ten other users, or coordinate complex tool calls across multiple steps, the single-user sandbox starts to feel like a very restrictive cage. It's built for isolation, which is wonderful for security, but terrible for durable, shared state.
The Core Problem: State and Coordination
The key concept I found was the 'agent harness.' Think of the sandbox as the worker doing the thinking, but the harness is the manager who coordinates the entire job. The harness is the loop that sends the prompt, executes the tool calls, takes the result, and feeds it back into the model until the task is finished. This loop *must* live outside the sandbox to manage the shared state and the persistence of the entire conversation.
If the harness stays inside, every time the sandbox resets or a new user logs in, the memory and the history of the complex task are lost. To build a production-grade, multi-user system, you need a durable mechanism for shared state. This means the control loop—the brain that manages the workflow—needs to be architected in a persistent layer that can read and write to shared memory, separate from the ephemeral compute environment itself.
What Else Is Running Outside the Sandbox?
This concept of external management isn't just limited to agents. I noticed similar patterns when looking at how complex ML models run client-side. For instance, running large models like Apple's SHARP in a browser via ONNX Runtime Web is impressive, but it still requires careful handling of the model artifacts (the ONNX graph and its data sidecar) and the coordination between the UI, the Web Worker, and the post-processing module. The complexity shifts from 'where to run it' to 'how to manage the dependencies and state outside the core inference engine.'
It made me think about how external tools manage compute resources, like the Utilyze GPU utilization tool. It doesn't just measure raw utilization; it measures 'useful work.' This suggests that even when optimizing compute, the real value is in managing the *flow* of computation, not just the raw speed. The 'harness' is essentially the flow manager.
A Tiny Takeaway on Architecture
So, if I'm trying to build something durable and shared, I need to stop thinking of the sandbox as the *engine* and start thinking of it as just the *compute unit*. The real intellectual work—the state management, the orchestration, the persistence—has to live in the surrounding system. It's the architecture around the model that provides the scale and the memory.
- The 'harness' (the control loop) must live outside the sandbox for multi-user, durable agents.
- External systems are needed to manage shared state and persistence across sessions.
- Architectural complexity often shifts from the compute unit itself to the surrounding orchestration layer.
- Designing for scale means designing for durable state management, not just fast inference.