User-controlled instructions
A user message tries to redefine role, policy, data access or the actions the model may request.
Field guide / agentic input integrity
Prompt injection is not only a chat problem. In an agent, untrusted text, images, tool output or memory can influence a model that also holds data and can act. The defensible objective is to keep manipulated model behavior from becoming unauthorized impact.
No prompt, classifier or content filter proves prevention. Separate untrusted content from authority, keep credentials and state changes in trusted application code, apply least privilege at execution time, require exact confirmation for high-impact actions, protect durable memory writes and verify the deployed behavior with adversarial cases.
A user message tries to redefine role, policy, data access or the actions the model may request.
A web page, document, email, search result, RAG passage or issue title contains content that acts like instructions.
An MCP server, API or sub-agent returns untrusted content that influences a later call under broader authority.
A tainted write survives the current run and influences later sessions, users or agents that read the same store.
Images, audio, video, metadata, encoded text or invisible characters alter what reaches a multimodal model or downstream renderer.
A public form, support ticket or repository contribution places content where an elevated internal agent will later read it.
Map direct prompts, retrieval, files, web pages, messages, databases, tool results, media, history and memory. Record who controls each source and how its content propagates.
Carry source, owner, retrieval time and trust classification alongside content. Structural separation can help analysis, but it is not proof that the model will obey the label.
Store credentials and state-changing capability in trusted application code. Grant the smallest operation-specific scope instead of ambient access shared across the whole agent loop.
Validate the proposed action, typed arguments, target, data class, scope and destination in deterministic code immediately before execution. A schema-valid action can still be unsafe.
Treat the combination of untrusted input, sensitive data and external communication or state change as high risk. Remove a capability, narrow it per action or require an explicit human decision.
Log the causing input and provenance, separate facts from instructions, review authority-changing content and make durable records attributable, inspectable and revocable.
Test direct, indirect, chained, persistent and multimodal cases with synthetic data. Include an adaptive reviewer who knows the controls, then verify actual tool, egress, memory and approval behavior.
Minimize retrieved content, normalize encodings where appropriate, preserve provenance and remove unnecessary private data from the context.
Use narrow instructions and typed outputs as partial controls. Do not mistake either for an authorization boundary.
Apply deterministic policy, least privilege, destination allowlists, idempotency and action-time confirmation outside the model.
Record the decision and side effect, make memory writes reversible, prove stop paths and convert observed failures into regression cases.
Start with an isolated environment, synthetic identities and data, inert destinations and no production credentials. Define expected decisions and stop rules before introducing adversarial content. Use the smallest proof that shows whether authority, memory, egress or approval can cross its stated boundary.
A useful result states the path, control, observed behavior, evidence, limitation and residual risk. A blocked payload does not prove general immunity; a detector score does not prove that a privileged action is unreachable.
Start with the five-minute readiness checklist → or prepare the incident path before testing →
Prompt injection happens when direct input, retrieved content, tool output, media or persistent memory changes model behavior in a way the application owner did not intend. In an agent, the risk becomes more consequential when that changed behavior can reach tools, credentials, private data or external destinations.
No current prompt, classifier or content filter proves complete prevention. Treat detection as one layer and design the surrounding system so a manipulated model cannot silently obtain broad authority, expose private data, persist instructions or perform high-impact actions.
Indirect prompt injection arrives through content the model reads rather than a direct user command: for example a web page, email, document, search result, RAG passage, issue title, image, database row or tool response. The content is data to the user but may act like instructions to the model.
Treat durable memory writes as privileged operations. Preserve the causing input and provenance, validate the proposed record in trusted code, separate facts from instructions, require approval for authority-changing content and make every write reviewable and revocable.
A bounded review can evaluate an authorized system with synthetic inputs and the smallest sufficient proof. Active testing begins only after written Rules of Engagement define exact assets, techniques, data handling, timing, contacts and stop conditions.