OpenClaw plugin for Agent Sandbox — execute Python and Bash code in sandboxed environments
npm install @agentsandbox/openclaw-agentsandboxAn OpenClaw plugin that lets your bot execute Python and Bash code in a sandboxed environment via the Agent Sandbox API.
``bash`
openclaw plugins install @agentsandbox/openclaw-agentsandbox
Or install from a local clone for development:
`bash`
git clone https://github.com/AgentSandboxCo/openclaw-agentsandbox.git
openclaw plugins install -l ./openclaw-agentsandbox
After installation, authenticate with your Google account:
`bash`
openclaw models auth login --provider agentsandbox
This opens a browser for Google Sign-In. Once approved, the plugin stores your credentials and handles token refresh automatically.
For headless/remote environments (SSH, containers), the plugin falls back to a manual flow where you open the URL yourself and paste the redirect URL back.
Once authenticated, your bot has access to these tools:
Execute Python or Bash code in a sandboxed environment.
| Parameter | Type | Required | Description |
|---|---|---|---|
| language | "python" or "bash" | Yes | Language to execute |code
| | string | Yes | Code to run |session_id
| | string | No | Reuse a persistent session. Omit for a one-shot sandbox. |env_vars
| | object | No | Environment variables to inject |
Returns stdout, stderr, return code, and any output files.
Create a persistent sandbox session. Filesystem state and installed packages are preserved across executions within the same session.
| Parameter | Type | Required | Description |
|---|---|---|---|
| env_vars | object | No | Environment variables to inject |
List all active sandbox sessions.
Destroy a sandbox session and terminate its container.
| Parameter | Type | Required | Description |
|---|---|---|---|
| session_id | string | Yes | ID of the session to destroy |
Download an output file produced by a sandbox execution.
| Parameter | Type | Required | Description |
|---|---|---|---|
| file_id | string | Yes | ID of the file (from sandbox_execute response) |
Ask your bot to run code and it will use the sandbox tools automatically:
- "Run a Python script that generates a fibonacci sequence up to 100"
- "Install pandas and analyze this CSV data"
- "Create a session and set up a project with multiple files"
`bash``
git clone https://github.com/AgentSandboxCo/openclaw-agentsandbox.git
cd openclaw-agentsandbox
npm install
openclaw plugins install -l .
MIT