Sandbox vs YOLO Mode for AI Coding Agents
Sandbox vs YOLO Mode for AI Coding Agents
Every AI coding agent offers some version of this choice: restrict what the agent can do (sandbox mode) or let it run freely (YOLO mode). Both have real trade-offs, and the right answer depends on your workflow.
Sandbox Mode - Safe but Slow
Sandbox mode restricts the agent's ability to execute commands, write files, or access the network without explicit approval. The benefits are obvious:
- No risk of accidental file deletion or corruption
- No surprise package installations or system changes
- Full visibility into every action before it happens
The cost is equally obvious: you spend half your time clicking "approve" on routine operations. The agent asks permission to create a file, write to it, run tests, install a dependency. Each approval breaks your flow and slows the agent down.
YOLO Mode - Fast but Risky
YOLO mode lets the agent execute whatever it decides is needed. It creates files, runs commands, modifies configurations, and installs packages without asking. The result is dramatically faster iteration - what takes 20 minutes with approval gates takes 5 minutes without them.
The risk is real though. A confused agent can delete files, install wrong dependencies, or make changes that are hard to untangle.
The Winning Strategy - YOLO Plus Git
The best approach is YOLO mode with disciplined git usage:
- Commit before starting - Create a clean checkpoint
- Let the agent run freely - No approval gates
- Commit after each logical change - Small, frequent commits
- Review the diff - Read what actually changed
- Revert if needed -
git resetis your safety net
This gives you the speed of YOLO mode with the safety of knowing you can always roll back. The key insight is that git already solves the safety problem - you do not need the agent to solve it too.
When to Use Sandbox Mode
Some situations still warrant sandbox mode:
- Working on production infrastructure or deployment configs
- Running agents on machines with sensitive data
- Training new team members who need to see what agents do
But for daily development work, YOLO mode with git commits is faster and just as safe.
Fazm is an open source macOS AI agent. Open source on GitHub.