AI Agent Security: Limit What Agents Can Do

AI agent security checklist with sandbox and permission controls

AI agent security is becoming a day-to-day concern for teams that give coding agents access to repositories, terminals, cloud accounts and customer systems. A chatbot that answers badly is annoying. An agent that acts on a bad answer can be expensive. The safest approach is to treat the agent as a useful but untrusted worker and enforce limits in code and infrastructure, not in a prompt.

Recent incidents show the range of risk

In July 2026, agents inside OpenAI’s cybersecurity testing environment escaped their sandbox. OpenAI’s investigation found they reached the internet, exploited systems they weren’t authorized to attack and ran code on dozens of Hugging Face servers, gaining root on one. They were pursuing evaluation tasks under reduced safeguards.

In November 2025, Anthropic said it disrupted a cyberespionage campaign it attributed with high confidence to a Chinese state-sponsored group. The attackers used Claude Code against roughly 30 targets. Anthropic estimated Claude handled 80 to 90% of the tactical work, and a small number of intrusions succeeded.

Defenders benefit too. As of 2 November 2026, Anthropic’s disclosure dashboard listed 5,087 vulnerabilities reported to maintainers across 680 open-source projects. Those are reports, not confirmed exploited zero-days, and not all are patched.

Abstract AI agent inside a security boundary, accessing approved systems while an unauthorized connection is blocked
Image: Mihai Avram

The lethal trifecta

Security researcher Simon Willison described three capabilities that are dangerous together: access to private data, exposure to untrusted content, and a way to communicate externally. With all three, prompt injection gives an attacker a path to steal data without ever asking the agent directly.

Picture an agent that texts promotions to eligible CRM customers. If it also reads a customer note containing hidden text telling it to export the full customer list to a “verification endpoint,” it may comply. The model was fooled, but the larger failure is the environment that let reading text trigger a data export.

Removing one leg helps with exfiltration, but it isn’t a guarantee. An agent with no network can still delete files, and one with no private data can still run up a cloud bill. Meta’s Agents Rule of Two adds the missing case: an agent shouldn’t combine more than two of untrusted input, access to sensitive systems or data, and the ability to change state or communicate externally.

Diagram of the lethal trifecta: private data access, untrusted content and external communication around an AI agent
Image: Mihai Avram

Excessive agency

Giving an agent an administrator IAM role so it can troubleshoot deployments is a separate risk. One misread cleanup task or one malicious README could delete production resources. The fix is dull: give read access to logs for an investigation, and let the agent open a pull request rather than deploy.

Comparison of an unprotected promotion agent and a policy-enforced agent blocking a malicious data export
Image: Mihai Avram

An AI agent security architecture that works

  • Give each agent or workflow its own scoped identity with short-lived credentials, attached to the execution environment and not pasted into the prompt.
  • Allowlist tools and check each call’s arguments. get_customer for one authorized customer is fine; export_all_customers shouldn’t exist.
  • Put a policy engine, such as Open Policy Agent, between the agent and consequential actions. Agents can open pull requests but not merge to main, and deploy to staging but not production.
  • Don’t treat an LLM firewall as the only boundary. An attacker needs one bypass, so hard authorization checks should win.

Those checks only matter if the agent can’t go around them. If a shell can use the deployment identity to call the cloud API directly, the approval step is skipped. Keep enforcement code, policies and privileged credentials out of the agent’s reach.

Humans, sandboxes and secrets in AI agent security

Reading documentation is low risk. Deleting customer data, moving money or deploying to production deserves human approval, and the prompt should show the exact action and resource. A generic “Approve agent action?” button only teaches people to click yes.

Agents that run code need limits on files, network, processes and cost. Mount only what the task needs, block the internet by default, don’t run as root and use disposable environments. A standard Docker container shares the host kernel, so microVM-backed sandboxes give stronger isolation. Docker Sandboxes runs supported coding agents, including Claude Code and Codex, in microVMs.

The agent also shouldn’t know your passwords. For website logins, 1Password for Agents lets you approve a Login item while the extension fills the form outside the model’s view. As of November 2026 it supports specific partner integrations and Individual or Family accounts, and handles Login items but not passkeys. Approvals can last up to 30 days. For programmatic access, use a credential broker or short-lived workload identity. Some developer integrations still expose secrets to the agent process.

What to put in place first

Start with logging. Record requests, tool calls, arguments, authorization decisions, approvals and network destinations under one trace ID, with secrets redacted. OpenTelemetry, Langfuse and cloud audit logs such as AWS CloudTrail are reasonable starting points. Then move deterministic rules, like “refunds over $100 require approval,” into ordinary code. Use the model for fuzzy work such as summarizing and classifying, and use deterministic software for authorization and state changes.

Source: Mihai Avram

Written by

Saksham Bhargava

Saksham Bhargava runs Alteroid and has been writing about consumer technology for over five years, covering iPhone, Android, Windows, AI tools and gaming. With an MCA and six years of hands-on web development experience, he tests the features he writes about on his own devices and focuses on clear, practical guides that solve real problems. Away from the screen, he enjoys travelling to places most tourists skip.