DEV Community

ForgeWorkflows
ForgeWorkflows

Posted on Originally published at forgeworkflows.com

Bot-bottle: The Sandbox AI Coding Agents Actually Need

In 2026, the question is no longer whether your organization uses AI in production. According to McKinsey's State of AI 2024 report, 72% of organizations now use AI in at least one business function, up from 50% in previous years. The question is whether the systems running that AI can contain it when something goes wrong. When we started wiring n8n pipelines to external coding tools and LLM-backed automation chains, we hit this problem directly: the moment an AI coding tool gains write access to a filesystem, you have a credential exfiltration risk. Not a theoretical one. A practical one that shows up the first time you point a reasoning model at a repo that contains a .env file.

Bot-bottle is an open-source project that addresses this gap. It wraps AI coding tools in VM-level isolation, adds a Data Loss Prevention layer, and lets you define security policy in plaintext. We spent time evaluating it against the alternatives, and the architecture is worth understanding in detail, because most sandboxing approaches solve only one of the three problems you actually have.

The Problem We Were Trying to Solve

The security trilemma for AI coding tools is this: you want a system that is powerful enough to do real work, isolated enough that it cannot escape its boundaries, and auditable enough that you can prove what it did. Most approaches sacrifice one leg of that triangle.

Container-based isolation, for example, gives you reasonable process separation but does not protect against a model that reads a mounted secret and writes it to a network request before you can intercept it. Prompt-level restrictions ("don't access credentials") are trivially bypassed by a sufficiently capable reasoning engine that finds an indirect path. And most commercial sandboxing products give you isolation without auditability: you know the system ran, but you cannot reconstruct what it touched.

We ran into this concretely when building automation pipelines that invoke external coding tools as part of a larger orchestration chain. The pipeline would pass context to the reasoning node, the node would do its work, and the output would come back. But we had no visibility into what the reasoning layer accessed during that window. It could have read files outside its working directory. It could have made outbound calls. We had no record either way.

That is the gap Bot-bottle fills.

What Bot-bottle Actually Does

The architecture has three distinct layers, and understanding each one separately matters because they solve different failure modes.

VM-level isolation. Bot-bottle runs the coding tool inside a virtual machine, not just a container. The distinction is meaningful. A container shares the host kernel; a VM does not. If the reasoning module inside Bot-bottle finds a kernel exploit or a misconfigured mount, it still cannot reach the host filesystem or the host network stack. This is the hard boundary. It is also the expensive one: VM startup adds latency, and you pay that cost on every invocation. For interactive development workflows, this is acceptable. For high-frequency automation pipelines running hundreds of times per hour, you need to think carefully about whether VM-level isolation is the right tool or whether a lighter container boundary with tighter network egress rules is a better fit.

Data Loss Prevention. The DLP layer sits between the VM and any outbound channel. It inspects content leaving the sandbox and blocks patterns that match defined rules: AWS credential formats, private key headers, internal IP ranges, whatever you configure. This is where Bot-bottle's plaintext policy format becomes practically important. A security rule written in a domain-specific language that only your security team understands does not get used by the developers who need it. Bot-bottle's policies read like structured English. A developer who has never written a DLP rule can read one, understand what it does, and modify it without filing a ticket.

Remote control and auditability. The third layer is a remote control interface that lets you pause, inspect, and terminate a running session. Every action the coding tool takes is logged. You get a reconstruction of what the system touched, in what order, and what it tried to send out. This is the auditability leg of the triangle, and it is the one most sandboxing tools skip entirely.

The model-agnostic design is worth noting separately. Bot-bottle does not care which LLM or agent framework you are running inside the sandbox. You can swap the reasoning engine without changing your security posture. This matters in 2026 because the toolchain is still shifting fast: the reasoning model you deploy today may not be the one you run in six months, and rebuilding your security layer every time you update the underlying API is not a sustainable approach.

What We Learned Building Around It

We learned something relevant here from our own input-handling work. When we built the Meeting Prep pipeline, it accepted events from three sources: direct webhook calls, Google Calendar API responses, and test fixtures. Each source used different field names for the same data. Webhooks sent event_id and event_title; Calendar sent id and summary; test fixtures sent either, depending on who wrote them. Our first version used a bypass flag to detect the format. It failed immediately because test data came through without the flag set. We fixed it by detecting format from the fields themselves: if event_id exists, it is webhook format; if summary exists, it is Calendar format. No flags, no assumptions.

The same principle applies to security policy design in Bot-bottle. Do not use a flag or a mode switch to determine what rules apply. Detect the context from the content itself. A policy that says "if this looks like a private key, block it" is more reliable than a policy that says "if the session is in production mode, apply strict rules." Modes get misconfigured. Content patterns do not lie.

The limitation we ran into most often: Bot-bottle's VM startup time makes it a poor fit for pipelines where the coding tool is invoked as a lightweight step in a longer chain. If you are calling a reasoning node to do a quick code review on a small diff, the overhead of spinning up a VM for that call is disproportionate. We found it worked best when the coding tool session was long-lived: a developer working interactively for an extended period, or a batch job that processes a large codebase in a single session. Short, frequent invocations are better served by container isolation with strict network egress rules and a separate audit log.

There is also an operational cost that does not show up in the documentation: someone has to maintain the DLP policies. Plaintext format lowers the barrier to writing rules, but it does not eliminate the need to review them as your codebase and credential patterns evolve. A policy written for your AWS credential format in January may not catch a new secret type introduced in March. Build a review cadence into your security process, not just a one-time setup.

For teams evaluating how this fits into broader automation infrastructure, the relevant question is where in your pipeline the coding tool sits. If it is a terminal node that produces output consumed by downstream steps, VM isolation is appropriate. If it is a mid-chain component that passes data to other reasoning nodes, you need to think about what the DLP layer inspects at each handoff point, not just at the final output. We wrote more about the architectural decisions involved in keeping AI-generated code clean in our post on the architecture problem behind AI-generated code, and the security angle connects directly to the isolation decisions covered there.

The broader context: as AI coding tools move from developer experiments into production automation chains, the security layer cannot be an afterthought bolted on after the pipeline is built. Bot-bottle's value is that it makes isolation and auditability first-class concerns from the start. That is the right order of operations. Build the boundary first, then expand what runs inside it.

What We'd Do Differently

Start with DLP policy design before touching the VM configuration. We spent time on isolation settings before we had clear answers about what data patterns we needed to block. The policy layer is where your actual security requirements live. Get that right first, then configure the boundary around it.

Build a session-length heuristic before deploying. The VM overhead is only acceptable above a certain session duration threshold. We would instrument a sample of our coding tool invocations first, measure actual session lengths, and use that data to decide which invocations warrant VM isolation and which should use a lighter boundary. Applying VM isolation uniformly to all invocations is a performance mistake we would not repeat.

Treat the audit log as a first-class output, not a debugging tool. We initially looked at Bot-bottle's session logs only when something went wrong. The more useful pattern is to route those logs into your existing observability stack from day one, so you have a continuous record of what your coding tools touched across all sessions. That record becomes valuable not just for incident response but for understanding how your automation chains actually behave in production, which is a different and harder problem than knowing whether they behaved correctly on any given run.

Top comments (0)