# AI Agent Security Isn’t a Model Problem: 9 Infrastructure Gaps to Fix Before Production

> Source: <https://dev.to/ai-ops/ai-agent-security-isnt-a-model-problem-9-infrastructure-gaps-to-fix-before-production-1ldh>
> Published: 2026-11-30 14:06:51+00:00

**Recommendation:** Give every agent its own non-human identity with short-lived, task-scoped tokens, keep credentials out of the context window, and require human approval plus hard budget caps before any high-impact action.
More in the playbook "Securing agents and AI tools": <https://wpnews.pro/playbooks/agent-security>

When multiple agents share a single service login, incident response breaks down—you can’t tell which agent took an action.

• Fix: Provision a distinct, non-human identity for every agent. Never share credentials.

To get demos working quickly, agents are often handed broad, long-lived API keys. One hallucination or loop can wipe production data.

• Fix: Enforce least-privilege, task-scoped permissions with short-lived, auto-expiring tokens.

Pasting API keys or passwords directly into system prompts guarantees they will end up in LLM traces, chat histories, and observability logs.

• Fix: Store credentials in a secrets manager and inject them strictly at the tool-execution layer—never into the context window.

Malicious instructions hidden inside an external email, PDF, or webpage can hijack an agent's control flow.

• Fix: Treat all external data as untrusted. Sanitize inputs, separate data from instructions, and strictly restrict accessible tools.

Connecting agents to random, unverified Model Context Protocol (MCP) servers introduces unreviewed code and potential data exfiltration paths.

• Fix: Maintain an internal allowlist of security-reviewed MCP servers and pin their versions.

When Agent A delegates a task to Agent B, permissions often stack up—allowing a low-privilege agent to trigger high-privilege actions through a proxy.

• Fix: Propagate the original user's identity and permission scope down the chain, and limit delegation depth.

Giving agents autonomous write-access to sensitive systems leads to costly mistakes—like issuing an unapproved $2,000 refund or emailing external clients.

• Fix: Require explicit human approval gates for high-impact actions (payments, deletions, external communications).

An agent caught in a recursive retry loop can burn through 10,000 API calls and thousands of dollars before anyone notices.

• Fix: Implement circuit breakers, hard rate/budget caps per session, and an immediate revocation mechanism.

Without structured execution logs, debugging failures or passing compliance audits becomes impossible.

• Fix: Log every tool invocation with its inputs, outputs, agent identity, user context, and approval trail.

The Blueprint in Short

• Identity & Access: Gaps 1, 2, 6

• Inputs & Supply Chain: Gaps 3, 4, 5

• Runtime Guardrails: Gaps 7, 8

• Observability: Gap 9

Stop trying to prompt-engineer your way out of infrastructure vulnerabilities. Secure the runtime, not just the weights.
