$git clone https://github.com/instavm/coderunnerCodeRunner helps you sandbox your AI agents and its actions inside a sandbox.
| 1 | <div align="center"> |
| 2 | |
| 3 | [](https://github.com/instavm/coderunner/stargazers) |
| 4 | [](https://github.com/instavm/coderunner/blob/master/LICENSE) |
| 5 | </div> |
| 6 | |
| 7 | # CodeRunner: A local sandbox for your AI agents |
| 8 | |
| 9 | CodeRunner helps you sandbox your AI agents and its actions inside a sandbox. |
| 10 | |
| 11 | **Key use case:** You can run multiple Claude Code or AI agents in our sandbox without any fear of data loss and exfilteration. |
| 12 | |
| 13 | |
| 14 | |
| 15 | ## Quick Start |
| 16 | |
| 17 | **Prerequisites:** Mac with macOS and Apple Silicon (M1/M2/M3/M4), Python 3.10+ |
| 18 | |
| 19 | ```bash |
| 20 | git clone https://github.com/instavm/coderunner.git |
| 21 | cd coderunner |
| 22 | chmod +x install.sh |
| 23 | ./install.sh |
| 24 | ``` |
| 25 | |
| 26 | ### Stop and resume |
| 27 | |
| 28 | Stop the sandbox when you are done: |
| 29 | |
| 30 | ```bash |
| 31 | container stop coderunner |
| 32 | ``` |
| 33 | |
| 34 | Resume the same sandbox later, preserving uploads, kernels, and installed packages: |
| 35 | |
| 36 | ```bash |
| 37 | container start coderunner |
| 38 | ``` |
| 39 | |
| 40 | To start over with a clean sandbox, delete the container and run the installer again: |
| 41 | |
| 42 | ```bash |
| 43 | container delete coderunner && ./install.sh |
| 44 | ``` |
| 45 | |
| 46 | |
| 47 | ## Run Claude Code inside a Sandbox |
| 48 | |
| 49 | `./install.sh` (if not already done) |
| 50 | |
| 51 | `container exec -it coderunner /bin/bash` |
| 52 | |
| 53 | `root@coderunner:/app# npm install -g @anthropic-ai/claude-code` |
| 54 | |
| 55 | <img width="741" height="410" alt="image" src="https://github.com/user-attachments/assets/620490cb-4e85-4c37-bc57-ab2fa1762c78" /> |
| 56 | |
| 57 | ## Other Integration Options |
| 58 | |
| 59 | MCP server will be available at: `http://coderunner.local:8222/mcp` |
| 60 | |
| 61 | **Install required packages** (use virtualenv and note the python path): |
| 62 | ```bash |
| 63 | pip install -r examples/requirements.txt |
| 64 | ``` |
| 65 | |
| 66 | #### 1. Claude Desktop Integration |
| 67 | |
| 68 | |
| 69 | <details> |
| 70 | <summary>Configure Claude Desktop to use CodeRunner as an MCP server:</summary> |
| 71 | |
| 72 |  |
| 73 | |
| 74 |  |
| 75 | |
| 76 |  |
| 77 | |
| 78 | 1. **Copy the example configuration:** |
| 79 | ```bash |
| 80 | cd examples |
| 81 | cp claude_desktop/claude_desktop_config.example.json claude_desktop/claude_desktop_config.json |
| 82 | ``` |
| 83 | |
| 84 | 2. **Edit the configuration file** and replace the placeholder paths: |
| 85 | - Replace `/path/to/your/python` with your actual Python path (e.g., `/usr/bin/python3` or `/opt/homebrew/bin/python3`) |
| 86 | - Replace `/path/to/coderunner` with the actual path to your cloned repository |
| 87 | |
| 88 | Example after editing: |
| 89 | ```json |
| 90 | { |
| 91 | "mcpServers": { |
| 92 | "coderunner": { |
| 93 | "command": "/opt/homebrew/bin/python3", |
| 94 | "args": ["/Users/yourname/coderunner/examples/claude_desktop/mcpproxy.py"] |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | ``` |
| 99 | |
| 100 | 3. **Update Claude Desktop configuration:** |
| 101 | - Open Claude Desktop |
| 102 | - Go to Settings → Developer |
| 103 | - Add the MCP server configuration |
| 104 | - Restart Claude Desktop |
| 105 | |
| 106 | 4. **Start using CodeRunner in Claude:** |
| 107 | You can now ask Claude to execute code, and it will run safely in the sandbox! |
| 108 | </details> |
| 109 | |
| 110 | #### 2. Claude Code CLI |
| 111 | |
| 112 | <details> |
| 113 | <summary>Use CodeRunner with Claude Code CLI for terminal-based AI assistance:</summary> |
| 114 | |
| 115 | **Quick Start:** |
| 116 | |
| 117 | ```bash |
| 118 | # 1. Install and start CodeRunner (one-time setup) |
| 119 | git clone https://github.com/instavm/coderunner.git |
| 120 | cd coderunner |
| 121 | sudo ./install.sh |
| 122 | |
| 123 | # 2. Install the Claude Code plugin |
| 124 | claude plugin marketplace add https://github.com/instavm/coderunner-plugin |
| 125 | claude plugin install instavm-coderunner |
| 126 | |
| 127 | # 3. Reconnect to MCP servers |
| 128 | /mcp |
| 129 | ``` |
| 130 | |
| 131 | **Installation Steps:** |
| 132 | |
| 133 | 1. Navigate to Plugin Marketplace: |
| 134 | |
| 135 |  |
| 136 | |
| 137 | 2. Add the InstaVM repository: |
| 138 | |
| 139 |  |
| 140 | |
| 141 | 3. Execute Python code with Claude Code: |
| 142 | |
| 143 |  |
| 144 | |
| 145 | That's it! Claude Code now has access to all CodeRunner tools: |
| 146 | - **execute_python_code** - Run Python code in persistent Jupyter kernel |
| 147 | - **navigate_and_get_all_visible_text** - Web scraping with Playwright |
| 148 | - **list_skills** - List available skills (docx, xlsx, pptx, pdf, image processing, etc.) |
| 149 | - **get_ |