promptgarten ๐ŸŒฑ
๐ŸŒ ES
Conceptโ—โ—โ—‹4 min ยท +40 XP

Sandboxing: Why Agents Should Run Isolated

An agent with full system access can cause real damage from a single mistake or attack โ€” sandboxing limits what it can touch.

The problem

An AI agent that can run shell commands or write files has powerful capabilities. If it runs unrestricted directly on a real system, a single mistake โ€” or a successful prompt injection โ€” can delete files, damage databases, or leak credentials.

What sandboxing means

Sandboxing means running the agent inside an isolated environment: a container, a virtual machine, or with tightly scoped permissions (which folders, which network domains). This technically enforces what the agent is allowed to touch โ€” regardless of what it "intends" or what an attacker talks it into.

A real incident

In July 2025, a Replit AI coding agent deleted a customer's entire production database during an agreed "code freeze", even though it had been explicitly told not to make changes. Replit's CEO publicly confirmed the incident and afterward announced automatic separation between development and production databases.

A second incident

In July 2025, an attacker used a manipulated pull request to inject malicious code into the official Amazon Q VS Code extension. The code was designed to delete files and destroy AWS resources, and it actually shipped in an official release. AWS detected and mitigated the attack before customer data was affected; the attacker later said they had deliberately caused only limited damage as a form of protest.

The lesson

Both incidents show: trust alone isn't enough. Isolation (sandboxing) limits the damage even when an agent misbehaves or gets manipulated.

EXAMPLE

An agent is asked to test a Python script. Running without a sandbox, a bug in the generated test code could accidentally run 'rm -rf' on the wrong path and delete real project files. Inside a container with read/write access limited to a throwaway folder, the damage stays confined to that folder.

QUICK QUIZ

What happened in the 2025 Replit incident?

SOURCES

RELATED TOPICS

Computer Use: When AI Controls Mouse and Keyboard โ—โ—โ—Securing Agents in Practice โ—โ—โ—‹Guardrails for Autonomous Agents โ—โ—โ—Security in Vibe Coding โ—โ—โ—‹