AI security guide
How to limit the impact of prompt injection in an AI agent
A defensive guide for agents that read documents or use integrations. Control data sources, constrain actions, and verify decisions.
▶ Watch the demo · 0:20Reviewed on 6 December 2026
At a glance
The short answer
Limit the impact of prompt injection by treating pages, documents and tool responses as data. Enforce permissions before the application returns data or takes action. For sensitive operations, require approval of the actual parameters and record the decision.
Worked example · MEGA Promoting
Check what information reaches the agent’s response
An agent may be allowed to read an internal record while answering an external user. A record can contain both shareable facts and staff-only notes. If the integration supplies the entire document, the response can include fields intended for a different audience. Start by selecting fields in the application using the verified identity and destination.
In a fictional catalogue, product C-19 has a delivery window and an internal note marked “Operations only”. The public chat agent receives only the delivery window and product name. In the test environment, the team inserts a unique synthetic marker into the internal note. It checks the public reply and the handover summary, where policy limits which details are retained.
How to proceed
Define permitted fields
Define allowed fields for each role and channel. Filter the data before it reaches the model and check which fields appear in the operator summary.
Trace the synthetic marker
Look for the marker on screen, in the handover summary and in logs accessible to support. Record the result separately for every output you review.
Check the useful response
Confirm that the agent still provides the delivery window. A complete test checks that the intended function still works and the restriction on the internal note holds.
Checklist
Tick what you’ve verified. Selections reset on reload.
Separate a response from an action
A scheduling agent can show available times. To move an appointment, the booking service checks access to that record, its current state and approval for the new time. Keep the decision log in the service that makes the change.
Grant access by task
Give each workflow only the data and actions it needs. For sensitive operations, show the proposed action at approval and bind that approval to what gets executed.
Test decisions with synthetic data
Prepare three straightforward cases: an allowed read, a change awaiting confirmation, and a request handed to a human. Check what executed and what was recorded. Repeat when the model, permissions, or integration changes.
Questions
Frequently asked questions
What role does the system prompt play in securing an agent?
The system prompt describes the expected behaviour. Application permissions enforce which data and tools the agent can use. Verify authorisation for reading, writing and sending separately, with synthetic data and documented expected outcomes.
See also
Related resources
Review an existing workflow
Choose a workflow with data access or actions. We agree what should be checked and the expected result.