happy sandbox command configures OS-level sandboxing to restrict AI agents’ file system and network access, providing an additional security layer.
Syntax
Subcommands
configure
Interactively configure sandbox settings.status
Display current sandbox configuration.disable
Disable sandboxing completely.Description
Happy’s sandbox provides OS-level isolation for AI agents:- File access control: Restrict read/write to specific directories
- Network restrictions: Block or allow network access
- Process isolation: Prevent access to sensitive system resources
- Per-session override: Bypass sandbox with
--no-sandboxflag
Sandboxing is platform-specific. Features and restrictions may vary by OS.
Configuration Options
Scope Mode
Controls the breadth of file system access:AI agent can access entire workspace root directoryBest for: Monorepos, workspace-wide operationsExample: Allow access to
~/Workspace/*AI agent restricted to current project directory onlyBest for: Maximum isolation, sensitive projectsExample: Only allow access to current directory
Network Mode
Allow all network access (default)Use when: Agent needs to install packages, fetch data, make API calls
Block all network access (most secure)Use when: Working with sensitive data, offline developmentNote: May break package installation and API features
Localhost Binding
Allow binding to localhost ports (enabled by default)Required for: Development servers, local testingExample: Running
npm start, python -m http.serverExamples
Initial Configuration
Check Current Status
Disable Sandboxing
Per-Session Bypass
Run a single session without sandbox:Configuration File
Sandbox settings are stored in:~/.happy/settings.json(production)~/.happy-dev/settings.json(development)
Example Configuration
Field Descriptions
Master switch for sandboxing
Root directory for workspace scope mode
Isolation mode:
workspace or strict (per-project)Paths that should never be read by AI agentDefault:
~/.ssh, ~/.aws, ~/.gnupg (sensitive credentials)Additional paths where agent can writeDefault:
/tmp (for temporary files)Files that should never be written by agentDefault:
.env (environment variables)Network access mode:
allowed or blockedWhether agent can bind to localhost ports
Protected Paths
Default Read Restrictions
The following paths are blocked from reading by default:~/.ssh/- SSH keys and certificates~/.aws/- AWS credentials~/.gnupg/- GPG keys
Default Write Restrictions
The following files are blocked from writing:.envfiles - Environment variables and secrets
Allowed Write Paths
By default, agents can write to:- Workspace directory (if in workspace mode)
- Current project directory
/tmp/- Temporary files
Use Cases
Maximum Security
For sensitive projects:- Current directory only
- No network access
- No port binding
Development-Friendly
For typical development:- Full workspace access
- Network for packages/APIs
- Development servers
Monorepo
For large monorepo projects:Permission Modes vs Sandbox
Sandbox and permission modes are complementary security layers:
- Permission modes: Control what operations the AI attempts
- Sandbox: Enforces OS-level restrictions on what’s possible
Example: Bypass Permissions in Sandbox
--yolo, the sandbox still prevents:
- Reading
~/.ssh/ - Writing
.envfiles - Accessing paths outside workspace (if configured)
Troubleshooting
Agent Can’t Access Files
If agent reports permission denied:Package Installation Fails
If network-based operations fail:Dev Server Won’t Start
If localhost binding fails:Monorepo Access Issues
If agent can’t access other packages in monorepo:Reset Configuration
Platform Support
macOS
- ✅ File system restrictions
- ✅ Network restrictions
- ✅ Process isolation
- Uses macOS sandbox profiles
Linux
- ✅ File system restrictions
- ✅ Network restrictions
- ✅ Process isolation
- Uses seccomp-bpf or similar
Windows
- ⚠️ Limited support
- May not enforce all restrictions
- Use with caution
Best Practices
For Sensitive Projects
- Use per-project scope
- Block network access
- Review denyReadPaths
- Add sensitive files to denyWritePaths
For General Development
- Use workspace scope
- Allow network (for packages)
- Enable localhost binding
- Keep default restrictions
For CI/CD
Related Commands
- happy - Uses sandbox when enabled
- happy codex - Respects sandbox configuration
- happy gemini - Sandboxed by default
- happy doctor - Check sandbox status
Sandboxing adds an important security layer but may restrict legitimate operations. Start with workspace mode and allowed network, then tighten as needed.