Recursive Language Model Sandbox: What Held Up, What Needs Rebuilding
Lessons from shipping a recursive language model sandbox: isolation layers, brokers, CDR, the limits of userspace tracing and one host, and why restraint won.
This article is published in English.
Sources: What I’d Build Differently: Lessons From Shipping a Recursive Agent to Production
A recursive language model system starts from one blunt instruction: stop feeding the entire prompt to the model. Instead, let the model write code, run that code against the data, read the result and decide what to try next. Turning that instruction into a working platform took months of reading code, taking pieces apart until each was understood well enough to explain, and then judging whether the explanation held up for a stranger. What follows is a retrospective on the finished system: what survived hard use, what would change in a second attempt, what proved surprising and where the pattern seems headed.
Why explaining it was harder than building it
The early ideas have clean shapes. One is the central notion of a recursive loop, and the other is a trust boundary. Further in, the material stops being a single idea. The broker pattern, the signed state round trips and the isolation layers become a pile of engineering decisions that only make sense side by side. Choosing which of them to show and which to relegate to a footnote consumed more time than writing the sentences ever did. A day spent on one piece of the codebase, only to decide what it was really about, was typical.
Slow stretches were not wasted. The layered sandboxes, the broker that spans four providers, the signed round trips and the detonation pipeline all came out better explained for having been given that time, even if the schedule looked uneven afterward.
Lessons that carry over
A few habits from the build apply to any similar agent platform, whatever its domain.
- Design every layer for the attacker, not the average user. A stack where each stage assumes the previous one may already have failed is dull to describe and very hard to defeat.
- Wait for several implementations before trusting an abstraction. A broker interface that survives four different providers with identical logic has proved itself, while one written against a single provider has merely been guessed at.
- Treat the agent's authority as a budget to be spent deliberately. Scope, cost and permissions each need an explicit ceiling, set by what the task requires and nothing wider.
- Prefer visible reasoning to opaque cleverness. A system that shows why it chose to inspect one thing next is easier to debug, easier to trust and easier to explain to someone new.
- Keep the first version honest about its edges. Single-host operation, userspace tracing and the absence of shared threat data are acceptable in a first build only if they are written down as limits and not left to be discovered in production.
What held up
Some parts of the system genuinely earned the label production ready.
- The core loop of generating code, executing it, observing the result and choosing the next step survived everything thrown at it.
- The three-layer isolation stack, running from namespace shadowing through gVisor to fully remote sandboxes, never let through anything it was supposed to stop.
- The broker pattern is the sort of abstraction that is only fully appreciated after implementing it four times for four truly different providers and watching the same twenty lines of logic run unmodified against each.
- The content disarm and reconstruction pipeline was the proudest piece. It was the one easiest to get subtly wrong, and across every file format tested it never failed that way.
None of this came from obvious ideas. It came from assuming from the start that something would eventually try to break the system, and designing each layer around that assumption instead of around the happy path.
What would change in a second build
A retrospective that lists only successes is a highlight reel, so the gaps deserve plain statements.
Tracing from userspace only
Syscall tracing in the detonation pipeline runs wholly in userspace through strace. That is a real limitation and not a stylistic preference. A sufficiently sophisticated sample can notice that it is being traced this way and alter its behavior, or exploit timing gaps that a kernel-level hook would not have. A rebuild would add eBPF or an equivalent kernel-level mechanism underneath the userspace trace, not in place of it, since the userspace layer still earns its keep against samples that do not try hard to hide.
No outside threat intelligence
The system has no link to external threat intelligence. Every verdict about a sample is structural: this syscall pattern resembles process injection, that section has unusual entropy. None of it is informed by whether the exact hash of a file has been seen and classified elsewhere. This gap should be closed early, because much of what a human analyst contributes is not clever pattern matching at all. It is simply having met this exact thing before.
One host only
Every sandbox, every detonation and every recursive call chain is coordinated from a single machine, with no scheduling across machines and no clustering. That was a fair choice for a system built by one person over one summer, and the wrong choice for a real caseload at real volume. Distributed coordination is not a small feature to bolt on later. It amounts to a separate architecture layered over the original one, and presenting it as an add-on would be the least honest statement possible. Scheduling work across machines, recovering from a node that disappears mid-detonation and keeping signed state consistent between hosts are all new problems with no counterpart in a single-process design.
The surprise: restraint over capability
The hard engineering problem turned out, again and again, to be about restraint. Nearly every difficult decision amounted to stopping something from doing more than it needed to:
- a script disarmer that touches only the exact dangerous node,
- a scope guard that must not mistake a filename for a domain,
- a recursive decomposition that must not spend budget it does not need.
The expectation had been that the challenge would be making the agent capable enough. In practice the challenge was making it capable enough while extending it only as much trust as it had earned at each individual step.
A smaller surprise concerned what readers responded to. It was never the cleverest code. It was the moments where reasoning was visible, where the system could be seen deciding what to examine next instead of ticking through a checklist. That supports a belief that grew stronger over the project: the value of an agentic system is rarely the mechanism itself but the judgment layered on top, and judgment is far harder to describe than architecture.
Where the pattern goes
Recursive, tool-using agents that reason over their own execution do not look like a passing fashion. They look closer to a default shape that much serious agentic work will converge on, since the other route, writing a dedicated fixed pipeline whenever a new class of problem appears, cannot keep pace with the variety of real problems.
The topics that got the most attention, namely trust boundaries, containment, scope enforcement and cost control, are not security footnotes attached to that shape. They decide whether anyone is willing to deploy it. A working, trusted and occasionally very strange system built on the idea of not stuffing the whole prompt into a model is a reasonable place to stop, and a reasonable place to start the next project.