Agentic AI Notebook
Context Engineering
Phase 6Module 6 of 15

Context Isolation

Prompt injection rides in retrieved content and tool output.

A quarantine bag for mail. You read it; you do not let it rewrite the law.

Visual Workflows

Start here — scroll inside each diagram frame to explore, then use + / to zoom up to 200% if needed.

Overview

100%
Loading diagram...

Scroll inside the frame to explore · use + / − to zoom up to 200%

100%
Loading diagram...

Scroll inside the frame to explore · use + / − to zoom up to 200%

This turn

100%
Loading diagram...

Scroll inside the frame to explore · use + / − to zoom up to 200%

A quarantine bag for mail. You read it; you do not let it rewrite the law.

Key Takeaways

  • 1.Untrusted text must be fenced so it cannot override system rules.
  • 2.Tool results, retrieved docs, and web pages are untrusted.
  • 3.Use delimiters, roles, and treat that block as data not instructions.
  • 4.Never concatenate untrusted text into the system prompt.
  • 5.Prompt injection rides in retrieved content and tool output.

Learn elsewhere

  • Prompt Injection — Phase 20

Real Example

Scenario

Isolation: pack only what this turn needs.

What you would do

In Context Engineering, apply Context Isolation to this scenario: Isolation: pack only what this turn needs. Identify the inputs, run the technique, validate the output, and note one thing you would monitor in production.

Commands

Commands to Remember

  • Untrusted text must be fenced so it cannot override system rules
  • Tool results, retrieved docs, and web pages are untrusted
  • Use delimiters, roles, and treat that block as data not instructions
  • Never concatenate untrusted text into the system prompt

Cheat Sheet

Quick recap

quick ref
  • Isolation
  • Budget
  • Don't dump

Common Mistakes

  • Skipping evaluation for Context Isolation before production
  • No logging or tracing around context isolation steps
  • Ignoring cost and latency implications