Skip to content

AI Agent Reference

Reduce prompt injection risk in AI workflows

Treat retrieved pages, files, and messages as untrusted input. Limit what an agent can do when that content tries to redirect it.

In brief

What this means for a real workflow.

Prompt injection occurs when content that an AI system reads changes its behavior in an unintended way. It can arrive through a direct user message or through a retrieved document, web page, or tool result. OWASP notes that no single filter can fully prevent it; the practical task is to limit what untrusted content can cause the application to do.

Key points

How the pieces fit together.

  • Mark the trust boundary

    Identify which instructions come from the application and which text comes from users, documents, search results, or tools. Retrieved text can be useful evidence without becoming an authority over the workflow.

  • Enforce permissions in code

    Use the user's actual authorization and narrow tool permissions for reads and writes. A model's instruction or a sentence inside a document must never grant access to a private record or approve an action.

  • Check consequential actions

    Validate tool arguments and require a person to confirm actions such as sending messages, changing accounts, or moving money. Keep the confirmation tied to the specific proposed action.

  • Test and monitor the boundary

    Try malicious instructions in direct requests, retrieved files, and tool output. Record blocked and completed actions, review failures, and retest after changes to prompts, models, tools, or data sources.

Before implementation

Questions to take into review.

  • Untrusted content sources and their owners
  • Tools that can read private data or write to systems
  • Authorization and approval checks outside the model
  • Adversarial test cases and response owner

Common questions.

Can input sanitization eliminate prompt injection?

No. Filtering may reduce some attacks, but malicious instructions can be indirect or hidden in ordinary-looking content. Permissions, validation, approval, and testing remain necessary.

Can a document trigger an attack?

Yes. An agent may encounter instructions embedded in a document, web page, or tool result while carrying out a legitimate task. That material should remain task data, not a new instruction source.

What should be reviewed first?

Start with the agent's most consequential tool: what it can read or change, whose permissions it uses, and what happens when untrusted content asks it to do something else.

Primary references

Check the source.

Explore AI agents

Ready?

Review the workflow before building.

Tell us which system, people, and data are involved. We will help define the scope and checks for a first release.