JustujuAI, layer by layer.Open in the interactive map

Guardrails & evals

Checks around model calls (input and output filters, permission gates, prompt-injection defences) plus automated tests that measure whether the system still behaves.

Layer 7 · Orchestration & Tooling · Run time · reviewed 2026-10-30

Read first: Tool use & protocols (MCP).

SimpleA plain explanation, one diagram and an analogy, with where the analogy breaks.

Guardrails are checks before and after the AI speaks, like a teacher reading a note before it goes home.

Evals are practice tests the builders run again and again, so they notice when a change makes the AI worse.

Input checks screen what goes in: user messages and, just as important, text from documents, web pages and tool results. Output checks screen what comes out: format, leaked secrets, unsafe content.

Prompt injection is text that tries to give the model new orders. Direct injection is typed by the user. Indirect injection hides in something the model reads: a web page, an email, a file, or a tool's own description (tool poisoning). Models read instructions and data in the same stream of tokens, so no filter catches every attempt.

So the main defences sit outside the model. The lethal trifecta is an agent that can read private data, sees untrusted content and can send data out: an injected instruction can make it leak. Take away any one of the three. Run agents in a sandbox (limited files, limited network), give tools the least privilege, and ask a person before risky actions.

Jailbreaks are different: the user attacks the model's own safety training, with role-play, odd encodings or hundreds of fake example dialogues. Safety training and classifiers that screen requests make them harder, not impossible.

Evals are test sets run automatically on every change to prompts, models or tools, scored by code, by people, or by another model acting as judge.

Input checkuser and tooltext1Model callwith context2Output checkformat, secrets,safety3Action gatepermissions,human OK4Evalsscore, compare,fix5change prompts or model, test again
Checks around one call, with evals in the loop
  1. Input check: user and tool text
  2. Model call: with context
  3. Output check: format, secrets, safety
  4. Action gate: permissions, human OK
  5. Evals: score, compare, fix

Like: A teacher checking notes, plus regular practice tests.
Where it breaks: A teacher understands what a note means. Filters are themselves pattern matchers or models, so cleverly worded attacks can slip past them; no single check stops prompt injection.

How it worksAn interactive demo first, then the mechanism: light maths, pseudo-code and trade-offs.

Prompt injection works because a model reads instructions and data in one stream of tokens, so text on a web page can give orders just as the user can. It becomes a data leak when one agent has three abilities at once, which Simon Willison calls the lethal trifecta: access to private data, exposure to untrusted content, and a way to send data out.

Remove any one leg and this attack has no path, however it is worded. Filters work differently: they try to recognise attacks, so a rewording can slip past. The strongest designs isolate untrusted text. A planning model sees only the user's request and writes the plan; a quarantined model with no tools reads the page. This is the dual-LLM pattern, which CaMeL extends by tracking where every value came from and checking a policy before each tool call.

Toggle the agent's abilities and defences, then read the trace. The scenario is scripted and assumes the model obeys the hidden text, which real models do often enough that a defence must not rely on them refusing.

Try the interactive version in the map.

Things to try

# The risky shape: one model reads everything and holds every tool
reply = llm(system_prompt + user_request + fetch_page(url))   # page text can give orders
for call in reply.tool_calls:
    run(call)                                   # read_email, send_email, load_image ...

# A check worth running before shipping an agent
private   = any(t.reads_private_data for t in tools)
untrusted = any(t.returns_outside_text for t in tools)
sends_out = any(t.can_send_out for t in tools) or app.loads_remote_images
if private and untrusted and sends_out:
    raise Unsafe("drop a leg for this task, or isolate the untrusted text")

# Isolation (dual model; CaMeL adds tracking of where each value came from)
plan = planner_llm(user_request)           # never sees page text
page = fetch_page(url)                     # value tagged: untrusted
summary = quarantined_llm("Summarise", page)   # no tools, no private data
policy.check("show", summary)              # untrusted values never become links or tool arguments
show_as_text(summary)

Trade-offs

ResearchWhere the simple picture breaks, open problems and primary sources.

Checks around a model reduce risk, but a filter is itself a model or a pattern, so it can be fooled in the same ways as the model it guards.

Adaptive attacks. Attackers who tuned their attacks against each defence bypassed 12 recent ones, most with over 90% success, though most had reported near-zero (Nasr et al., 2025).

Security by design. Keeping untrusted data out of the control flow stops injected text from choosing actions. One such design solved 77% of agent tasks with provable security, against 84% with no defence (CaMeL, 2025).

Measuring agent security. Benchmarks of realistic tasks and attacks, such as 97 tasks and 629 security cases, let defences be compared (AgentDojo, 2024), but they can only include attacks someone has already written.

Judges and leaks. Model judges favour the first answer shown, longer answers and their own (Zheng et al., 2023), and benchmark questions leak into training data: two models guessed hidden answer options 52% and 57% of the time (Deng et al., 2023).

Security on this concept: 2 threats Pending expert review

Hidden instructions in content the AI reads Pending expert review

Exposed
  • Emails, web pages, documents and tool results that enter the model's context
  • Private data and outbound channels the assistant can reach
Attacks
  • Planting instructions in content the assistant will read (indirect prompt injection)
  • Leaking data through links or images the app loads automatically
Real case
Research demonstration: EchoLeak (zero-click exfiltration from an office assistant) (2025-06)
Controls
  • Break the lethal trifecta: never combine private data, untrusted content and a way out in one agent
  • Allow-list where outputs may send data; don't auto-load links and images
  • Ask a person before any outbound action
Owner
AppSec, with ML engineering
Reference
LLM01:2026 Prompt Injection
AML.T0051.001 Indirect

Jailbreaks that get past safety training and reveal hidden instructions Pending expert review

Exposed
  • A model's safety training and the app's content rules
  • Hidden context: system prompts, tool definitions and retrieved policy text users can't see
Attacks
  • Wording or optimised gibberish that talks a model out of refusing (jailbreak)
  • Asking the assistant to repeat or summarise its hidden instructions
  • Using leaked instructions and tool lists to aim better attacks
Real case
Research demonstration: Universal adversarial suffixes that jailbreak several aligned models (2023-07)
Controls
  • Assume hidden instructions will leak: keep keys, secrets and access rules out of prompts
  • Enforce permissions in code outside the model, not in its instructions
  • Layer input and output classifiers, and red-team regularly as new jailbreaks appear
Owner
AppSec, with ML engineering
Reference
LLM08:2026 Hidden Context Exposure
AML.T0054 LLM Jailbreak
AML.T0069.002 System Prompt
AML.T0085.003 System Instructions

All layers in the security view

Examples as of 2026-10-30

Sources

  1. Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection (2023)
  2. OWASP Top 10 for LLM Applications: LLM01:2025 Prompt Injection (2025)
  3. Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena (2023)
  4. The lethal trifecta for AI agents: private data, untrusted content, and external communication (Simon Willison) (2025-06-16)
  5. The Dual LLM pattern for building AI assistants that can resist prompt injection (Simon Willison) (2023-04-25)
  6. Defeating Prompt Injections by Design (Debenedetti et al., CaMeL) (2025-03-24)
  7. The Attacker Moves Second: Stronger Adaptive Attacks Bypass Defenses against LLM Jailbreaks and Prompt Injections (2025-10-10)
  8. AgentDojo: A Dynamic Environment to Evaluate Prompt Injection Attacks and Defenses for LLM Agents (2024-06-19)
  9. Investigating Data Contamination in Modern Benchmarks for Large Language Models (2023-11-16)
  10. MCP Security Notification: Tool Poisoning Attacks (Invariant Labs) (2025-04-01)
  11. Beyond permission prompts: making Claude Code more secure and autonomous (Anthropic engineering blog) (2025-10-20)
  12. Jailbroken: How Does LLM Safety Training Fail? (2023-07-05)
  13. Many-shot jailbreaking (Anthropic) (2024-04-02)
  14. Constitutional Classifiers: Defending against Universal Jailbreaks across Thousands of Hours of Red Teaming (2025)
  15. OpenAI to acquire Promptfoo (2026)

How it connects

More in Layer 7 · Orchestration & Tooling