Secure an AI agent by limiting what it can do, not by hoping the model behaves. Give it the fewest permissions possible, treat everything it reads as untrusted data, require a person to approve risky actions, cap its spending and log every step.
Those five layers cover the most serious risks on the OWASP list for AI applications.
What most security guides miss
The top results for "AI agent security and compliance" come from Okta, Salesforce, Check Point and an academic paper. They name the right risks: prompt injection, data leakage, over-privileged access and supply-chain attacks.
Okta's advice to treat each agent as a non-human identity with scoped permissions is sound (Okta).
But most are written to sell an identity or security product. None gives a builder's checklist that maps each risk to a specific design decision, or puts the compliance dates in one place.
That's this post.
Five layers of defence

Each layer assumes the one before it will fail.
- Least-privilege tools. Read-only by default. Separate, scoped API keys for each agent. No "admin" credentials.
- Untrusted input is data. Emails, web pages, documents and tool results never become instructions, however they're worded.
- Approval gates. A person approves anything that moves money, messages a customer or changes a record.
- Spend and rate limits. Caps per task, per user and per day, so a loop or an attack can't run up a bill.
- Logs and replay. Every model call and tool call recorded, so you can investigate and reproduce failures.
The OWASP risks, mapped to controls
OWASP's Top 10 for LLM Applications (2025) is the most widely used list of AI application risks (OWASP). These are the ones that matter most for agents:
| OWASP risk | What it means for an agent | Control |
|---|---|---|
| LLM01 Prompt injection | Hidden instructions in content the agent reads change its behaviour | Layer 2, plus approval gates on sensitive tools |
| LLM02 Sensitive information disclosure | The agent reveals data the user shouldn't see | Scope data access to the requesting user; filter outputs |
| LLM05 Improper output handling | Model output is passed to other systems unchecked | Validate outputs before they reach databases, code or email |
| LLM06 Excessive agency | The agent has more tools or permissions than it needs | Layer 1 and Layer 3 |
| LLM07 System prompt leakage | Instructions or secrets in the prompt are exposed | Never put credentials or secrets in prompts |
| LLM10 Unbounded consumption | Runaway loops or abuse drive cost and outages | Layer 4 |
Prompt injection deserves special attention because it can't be fully filtered out: the malicious text can look exactly like normal data. The reliable fix is architectural.
Even if the model is fooled, it shouldn't have the power to do damage alone.
Pre-launch security checklist
Every tool has a written purpose and the narrowest permission that serves it
API keys are per agent, stored in a secrets manager, and rotated
Actions that move money, send messages or change records need approval
Retrieved content is clearly separated from instructions in prompts
Outputs are validated before they reach other systems
Spend caps and rate limits are set and tested
Every run is logged with inputs, tool calls and outputs
Prompt-injection cases are in the evaluation set
Someone named owns the agent and reviews its logs
Compliance dates to know
| Rule | What applies | Date |
|---|---|---|
| EU AI Act, Article 50 transparency | Telling people they're interacting with AI, among other duties | Largely on the original schedule, per Gibson Dunn (Gibson Dunn) |
| EU AI Act, stand-alone high-risk systems (Annex III, such as hiring and education) | Risk management, data quality, human oversight, logging | 2 December 2027 |
| EU AI Act, high-risk AI in regulated products (Annex I) | The same duties for embedded systems | 2 August 2028 |
The later dates come from the Digital Omnibus on AI, provisionally agreed on 7 May 2026. Check the final published text with your lawyer.
If your agent screens job candidates or makes decisions about access to services, assume high-risk duties apply and design logging and human oversight in from the start.
FAQ
What is the biggest security risk for AI agents?
Prompt injection combined with excessive agency: the agent reads malicious content and has the permissions to act on it. Limit permissions and add approval gates to break that chain.
Does the EU AI Act apply to my AI agent?
It depends on where you operate and what the agent does. Transparency duties can apply to many AI systems.
High-risk duties apply to specific uses such as employment and education. Get legal advice for your case.
How do I audit what my AI agent did?
Log every model call and tool call with timestamps, inputs and outputs, and keep the logs where your security team can search them. Good logs let you replay a failure step by step.
Build it secure from day one
We build these five layers into every agent we ship, and we'll map your use case against them in a free scope within 24 hours. See our AI agent development services or book a free 30-minute call.
Sources
- IBM, 13% of organizations reported breaches of AI models or applications (Cost of a Data Breach 2025)
- OWASP, Top 10 for LLM Applications 2025
- Okta, Strategies to improve AI agent data privacy and security
- Orrick, EU's Digital Omnibus on AI: 7 key changes (May 2026)
- Gibson Dunn, EU AI Act Omnibus agreement (May 2026)