← Claude Docs

Securely deploying AI agents - Claude Code Docs

Claude Docs · April 29, 2026
Claude Code documentation presents strategies for securely deploying AI agents, which can execute code and access files but may take unintended actions due to prompt injection or model errors. The guide outlines built-in security features such as permissions systems, command parsing, and sandbox mode, along with advanced isolation technologies including containers, gVisor, and virtual machines. Security principles of isolation, least privilege, and defense in depth enable organizations to select controls appropriate to their specific threat models and operational requirements.

Detailed Analysis

Anthropic's Claude Code documentation on secure agent deployment establishes a tiered, risk-proportionate framework for organizations deploying AI agents capable of executing code, accessing files, and interacting with external services. The documentation centers on three foundational security principles — isolation, least privilege, and defense in depth — and argues that these familiar principles from conventional software security translate directly to AI agent deployments without requiring exotic or novel infrastructure. Central to the threat model is the risk of prompt injection, whereby malicious instructions embedded in content the agent processes (such as a tampered README file or a compromised webpage) could cause the agent to take actions outside the operator's intent. Claude Code addresses this natively through several built-in controls: a permissions system using glob-pattern rules, AST-based command parsing that requires explicit approval for ambiguous or high-risk commands, web search result summarization to reduce raw injection surface, and an optional sandbox mode that restricts filesystem and network access at the OS level.

The documentation's security boundary concept represents a particularly significant design principle. Rather than granting agents direct access to sensitive credentials or APIs, Anthropic recommends running a credential-injecting proxy outside the agent's environment, so that even a fully compromised agent process cannot exfiltrate the underlying keys. This architecture — separating the "brain" of the agent from its "hands" — mirrors patterns emerging across Anthropic's broader managed agents platform, where secure sandboxes, credential vaults, and proxies are composed into production-ready deployment primitives. The least privilege table in the documentation makes explicit that filesystem mounts should be minimized and prefer read-only access, network access should be scoped to specific endpoints, Linux container capabilities should be dropped, and credentials should never be directly exposed to the agent process. This granularity reflects a mature understanding that AI agents are not monolithic programs but composable systems whose attack surface can be methodically reduced at each layer.

The documentation's isolation technology comparison — spanning sandbox runtimes, Docker containers, gVisor, and full VM technologies like Firecracker — reveals the practical spectrum that enterprise deployments must navigate. Lightweight sandbox runtimes using OS primitives like bubblewrap on Linux or sandbox-exec on macOS offer the lowest complexity and overhead, suitable for developer workstations or low-sensitivity pipelines. At the other extreme, gVisor and Firecracker provide strong kernel-level isolation appropriate for multi-tenant environments processing untrusted content, at the cost of higher performance overhead and operational complexity. This spectrum aligns with the documentation's explicit acknowledgment that not every deployment warrants maximum security — a developer running Claude Code locally operates under a fundamentally different threat model than a company running agentic pipelines against customer data. The framing avoids security theater by encouraging operators to calibrate controls to actual risk rather than applying blanket hardening uniformly.

The release of this documentation is significant in the broader context of AI agents moving from research demonstrations into production infrastructure. As organizations increasingly deploy agents with real-world tool use — triggering API calls, modifying files, executing shell commands — the attack surface for prompt injection and privilege escalation grows proportionally. Anthropic's decision to publish explicit threat models, enumerate isolation tradeoffs by technology, and provide implementation patterns for credential proxying signals a maturation of the field's security discourse beyond vague safety principles toward concrete engineering guidance. The integration with enterprise platforms like Amazon Bedrock, using OIDC federation, cross-account IAM, and CloudTrail logging, further indicates that secure agent deployment is being positioned as an enterprise-grade concern with established audit and compliance pathways, not merely an experimental consideration for early adopters.

Read original article →