Securing Production AI Agents: Identity, Permissions and Prompt-Injection Defence
Most agent programmes secure the model and forget the agent. In production the risk is not what the model says — it is what the agent is allowed to do, on whose behalf, and what happens when a document tells it to do something else.
The Control Gap Nobody Budgets For
Agent pilots are reviewed as software projects: model choice, prompt, evaluation set, licence cost. Almost nobody checks what the agent can reach. Then it goes live on a service account left over from the pilot, and the review that would have caught it never happens. The numbers explain the urgency. More than 50% of GenAI pilots are abandoned before they reach production, and the survivors tend to be the ones that found a governance owner early. Analyst guidance through 2026 points the same way: agentic AI governance cannot live in a policy document, because the failure mode is a live action, not a bad prediction. The question shifts from "what did the model say?" to "what did the agent do, with whose credentials, against which system?"
Three Surfaces Attackers Actually Use
- The instruction surface. Anything the agent reads — a ticket, an email, a PDF, a retrieved knowledge chunk — can carry instructions. This is prompt injection, and no filter solves it.
- The identity surface. The credentials the agent runs under, how they are issued, how long they live, and whether one agent can impersonate another.
- The tool surface. The APIs, databases and file stores the agent can call, and whether those calls are scoped to the task or to the whole estate.
Most production incidents combine two of the three. A poisoned document plus an over-scoped token is enough to move money, leak records or delete a resource.
Identity: Give the Agent a Name, Not a Password
An agent should never be a shared service account with a static secret. It should be a first-class non-human identity with its own record, owner and lifecycle.
- One identity per agent, per environment. Production and staging must not share credentials, and neither should two agents with different jobs.
- Short-lived credentials. Tokens issued per run, minutes long, refreshed through a workload identity mechanism rather than stored in a config file.
- Delegated authority where a human is in the loop. When an agent acts for a user, the action should carry that user's authority and appear in their audit trail — not the agent's own superuser rights.
- Revocation that actually revokes. If you cannot kill an agent's access in one step, you do not control it. Test the kill switch before go-live, not during an incident.
Treat the identity record like a joiner-mover-leaver process: owner, purpose, review date and expiry. Agents accumulate permissions the way old accounts do, for the same reason.
Permissions: Least Privilege, Scoped to the Task
Least privilege is an old idea that agents break in a new way: scope is decided at design time, then quietly widened every time someone adds a tool. Start from the task, not the system. A support agent that answers policy questions needs read access to a knowledge index and the ability to draft a reply — not write access to the customer record, and certainly not the billing API "for later". Write the permission set as a table with three columns: action, system, justification. A row without a justification is a future incident. Two constraints make this stick:
- Separate read from write, and write from delete. Read-only tools can be granted broadly and cheaply. Destructive tools should be narrow, logged, and gated by a second confirmation step.
- Scope by data, not just by endpoint. Row-level and tenant-level filters belong in the tool implementation, not in the prompt. A model instruction is a suggestion; a query predicate is a control.
If your back office is approaching end of support — SAP ECC maintenance ends in December 2027, and roughly 60% of the installed base has migrated — you will rebuild integrations anyway. Scope agent access then, not later.
Tool Access and the Confused Deputy
The classic agent failure is not a jailbreak. It is an agent doing exactly what it was told, by the wrong party. An agent with send-email and read-inbox tools becomes an outbound channel after one crafted message. The defences are structural:
- Allow-list tools explicitly. No dynamic tool discovery in production. The agent gets the tools its job needs and nothing else.
- Never let retrieved content change the goal. Authorise each tool call against a fixed policy, not against whatever the agent claims it is doing.
- Log the reasoning trail. Store tool calls, arguments and retrieved sources per run. After an incident, this is the only artefact that explains what happened.
- Red-team before launch. Attempt injection through every input channel, including the boring ones: PDFs, CSV uploads, calendar invites and shared documents.
A Runtime Control Set That Survives Audit
Controls that live in a design document do not survive a security review. The ones that do are enforced at runtime and produce evidence.
- Policy decision point. Every tool call is authorised against a policy engine that knows the agent, the user, the resource and the action.
- Immutable action log. Who or what acted, on which system, with which arguments, and what came back.
- Anomaly detection. A jump in tool calls, a new destination host or unusual data volume should page someone.
- Environment isolation. Sandbox anything that processes untrusted input, with no ambient credentials.
Rolling It Out Without Stalling Delivery
Security stalls when sequenced as a gate at the end. Put the controls in the platform instead — a shared agent runtime with identity issuance, a policy layer and logging — so each new agent inherits them by default. Start with the agent closest to production, map its tool calls, and remove everything it does not need. Over-scoped agents are also expensive agents, and the discipline is familiar from cloud estates, where 29% of cloud spend is wasted on resources nobody owns.
Put Agent Security in Production, Not in a Slide
We scope agent identity, permission boundaries and runtime controls before go-live — so the agent that saves your team hours cannot be talked into spending your budget.
Book a ConsultationFrequently Asked Questions
What is the biggest security risk in a production AI agent?
Over-scoped authority. Most incidents come from an agent given credentials or tools broader than its task required, then influenced by content it read. Scope limits the damage injection can cause.
Is prompt injection solvable with input filtering?
Not reliably. Untrusted text and trusted instructions share one channel inside a language model, so filtering reduces noise but cannot be the control. Assume injection sometimes succeeds and constrain what the agent can do when it does.
Should an AI agent use a shared service account?
No. Each agent needs its own non-human identity with an owner, short-lived credentials and a documented purpose. Shared accounts make revocation impossible and destroy the audit trail you need after an incident.
How do we audit what an AI agent did?
Log every tool call with the agent identity, delegating user, arguments and result, and store it immutably. Monitoring on that log catches loops, unusual data volumes and new destinations before they become incidents.
Where should agent security sit organisationally?
With the platform or security team, not each business unit. Identity issuance, policy enforcement and logging must be shared services, otherwise every team reinvents controls and the weakest implementation sets your risk level.
Related: AI agents · What an AI agent costs to build · RAG implementation services · AI agents for customer support · Managed security services
