Command reference ยท Cursor CLI
agent sandbox enable
Enables sandbox mode for command execution.
agent sandbox enable is a subcommand of agent sandbox and permanently turns on sandbox mode. After that, the agent's terminal commands run with read/write access to the workspace, but isolated from the rest of the system; network access is disabled by default. According to the official CLI overview, the setting persists across sessions and is stored in a configuration file (~/.cursor/sandbox.json globally, or .cursor/sandbox.json per project, also valid over SSH). The global option --sandbox enabled is equivalent.
This should be distinguished from agent sandbox run <cmd>, which only runs a single command in isolation without changing the persistent setting. For step-by-step configuration via an interactive menu, including network access, the slash command /sandbox is used instead, which, according to the changelog, switches between the three modes Run Everything, Auto-Run in Sandbox, and Ask Every Time. agent sandbox reset exists to reset to default values.
โ WHEN TO USE IT?
Turn on permanently isolated command execution for all future sessions
agent sandbox enable
Enforce a safe default setting from the start when setting up the CLI on a new machine
agent sandbox enable
โ WHEN NOT TO?
The sandbox should apply only to a single command, not permanently
agent sandbox enable changes the persistent configuration for all future runs.
Better: use agent sandbox run <cmd> to run only a single command in isolation
Mode and network access should be set interactively and with fine granularity, not just turned on across the board
agent sandbox enable only knows the binary state enabled/disabled, no intermediate levels.
Better: use /sandbox for the interactive menu with the three modes Run Everything, Auto-Run in Sandbox, and Ask Every Time
SOURCES
- Cursor Docs โ CLI Reference: Parameters โ cursor.com