Introduction
In the realm of intelligent agents, the concept of a "harness" is crucial. It is the loop that drives a language model (LLM). By sending prompts, receiving responses, executing requested commands, and repeating the process, the harness is at the heart of agent operations. However, the debate on where it should run – inside or outside the sandbox – is far from settled.
Harness Inside the Sandbox
When the harness operates inside the sandbox, it lives in the same container as the code it manipulates. This means all commands and calls are executed locally. This approach is ideal for a single-user agent. For example, if you're a developer working on your laptop with the Claude Code SDK, this setup works perfectly.
Advantages
- Simplicity: One container, one file system, one process. This greatly simplifies execution management.
- Easy Reuse: Skills and memories rely on a local file system, allowing off-the-shelf harnesses to be reused without modification.
Limitations
- Security: Credentials are inside the sandbox, posing potential security issues if compromised.
- Limited Flexibility: The sandbox cannot be suspended without stopping the loop, which is not optimal for multi-user sessions.
Harness Outside the Sandbox
By moving the harness outside the sandbox, it is placed in the backend, interacting with the sandbox via an API to execute necessary commands.
Advantages
- Enhanced Security: LLM API keys, user tokens, and database access remain outside the sandbox. Thus, no permission model is needed in the sandbox, and there's no risk of sensitive data leaks.
- Resource Optimization: The sandbox can be suspended when not in use, saving resources. Some sessions may even completely bypass using a sandbox.
Use Case
Consider a tech company with dozens of engineers sharing the same agent. By having the harness outside the sandbox, you can easily provision or suspend sandboxes as needed, making this approach very efficient for multi-user environments.
Conclusion
Choosing the right harness architecture depends primarily on your specific security needs and resource management requirements. For companies looking to maximize security while optimizing resource use, moving the harness outside the sandbox is a winning strategy.
Let's discuss your project in 15 minutes.