GitHub 3.6K
Orchestration & Control emerging

Dual LLM Pattern

By Nikola Balic (@nibzard)
Add to Pack
or

Saved locally in this browser for now.

Cite This Pattern
APA
Nikola Balic (@nibzard) (2026). Dual LLM Pattern. In *Awesome Agentic Patterns*. Retrieved March 11, 2026, from https://agentic-patterns.com/patterns/dual-llm-pattern
BibTeX
@misc{agentic_patterns_dual-llm-pattern,
  title = {Dual LLM Pattern},
  author = {Nikola Balic (@nibzard)},
  year = {2026},
  howpublished = {\url{https://agentic-patterns.com/patterns/dual-llm-pattern}},
  note = {Awesome Agentic Patterns}
}
01

Problem

When the same model both reads untrusted content and controls high-privilege tools, a single prompt-injection path can convert benign context into privileged actions. This coupling collapses trust boundaries and makes it hard to reason about where dangerous behavior originated.

02

Solution

Split roles:

  • Privileged LLM: Plans and calls tools but never sees raw untrusted data.
  • Quarantined LLM: Reads untrusted data but has zero tool access.
  • Pass data as symbolic variables or validated primitives; privileged side only manipulates references.

Use an explicit contract between the two models: the quarantined model may only emit typed values (or opaque handles), while the privileged model may only operate over approved schemas and tools. This preserves capability while preventing raw untrusted text from entering high-authority reasoning paths.

var1 = QuarantineLLM("extract email", text)  # returns $VAR1
PrivLLM.plan("send $VAR1 to boss")           # no raw text exposure
execute(plan, subst={ "$VAR1": var1 })
03

How to use it

Email/calendar assistants, booking agents, API-powered chatbots, or any system handling untrusted user input with privileged actions (e.g., database writes, external API calls, file system operations).

04

Trade-offs

  • Pros: Clear trust boundary; compatible with static analysis.
  • Cons: Complexity; debugging across two minds.
06

References

  • Willison, Dual LLM Pattern (Apr 2023); adopted in Beurer-Kellner et al., §3.1 (4).