runtime · verified 2026-08-28 ✓ Verified

swe-rex

Verified2026-08-28: local sandboxed execution verified; agent code execution sandbox (local/cloud, parallel).

Sandboxed code execution for coding agents: run commands and tests safely locally or in the cloud, in parallel.

Category: runtime Complete entry Security: Security reviewed Domain: Coding Agents & Terminal Verified 2026-08-28 v1.4.0~1.4.0 Conflicts: none Source: Trove (independent adaptation, unofficial)

Install: pip install -i https://pypi.tuna.tsinghua.edu.cn/simple swe-rex==1.4.0 && swerex-remote --help

What you will run into

What this tool solves: letting your Agent execute code in a sandbox — isolated local/cloud execution with parallelism (by SWE-agent). Agent code no longer touches your machine directly: swerex-remote starts the sandbox execution server, and the agent client connects and runs commands. When to use it:

  • You want an isolated code execution environment for your Agent (run commands, run tests);
  • You need parallel execution (sandbox isolation + parallelism);
  • You want to wire the sandbox into your own Agent flow with the Python API (RemoteSandbox).

When not to use it: you don't need isolated execution and can run locally; or you don't have Docker (sandbox execution depends on Docker, sandbox run not tested in this environment). Notes: heavy entry — sandbox execution depends on Docker; the CLI/library install itself is verified, sandbox runtime is not (no Docker environment).

Path: Quick fix (30s, one command) -> Step by step (skimmable) -> How to confirm it works (success criteria). In a hurry? Jump to Quick fix.

Why this happens

How it works: the pip package swe-rex provides the swerex-remote CLI (sandbox execution server: --host/--port/--auth-token) + the Python library swerex (RemoteSandbox client: host/port/auth_token → run("command")). Start the server first, then the client connects and executes. Key concepts:

  • swerex-remote: sandbox execution server (needs Docker + auth token);
  • RemoteSandbox: Python client API;
  • auth-token: connection authentication.

Where it writes: the pip environment; sandbox containers are managed by Docker (needs Docker).

Quick fix (skip the explanation, just run it)

note: verified path in this environment; Tsinghua mirror required on mainland
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple swe-rex==1.4.0
swerex-remote --help

Expected output: usage: swerex-remote [-h] [--host HOST] [--port PORT] --auth-token AUTH_TOKEN

Step by step

Step 1: Install the package (why the version is locked: 1.4.0 is the verified collection version)

Why: pip install (Tsinghua mirror on mainland). After install verify the CLI argument surface + the library imports — both verified in this environment.

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple swe-rex==1.4.0
swerex-remote --help

Expected output: usage: swerex-remote [-h] [--host HOST] [--port PORT] --auth-token AUTH_TOKEN

python3 -c "import swerex; print('swerex OK')"

Expected output: swerex OK After install, confirm:

  • swerex-remote --help prints the server argument surface;
  • import swerex doesn't error.

Stuck? How to recover:

  • pip slow → confirm the Tsinghua mirror prefix;
  • Python version → confirm >= 3.10.

Step 2: Start the sandbox execution server (needs Docker + auth token; sandbox run not tested in this environment)

Why: swerex-remote --host 127.0.0.1 --port 8000 --auth-token <token> starts the server. Sandbox execution depends on Docker — no Docker in this environment, server run not tested; the command form comes from --help.

swerex-remote --host 127.0.0.1 --port 8000 --auth-token <token>

Expected output: 服务器监听(供 agent 客户端连接执行代码) After install, confirm:

  • the server listens on 127.0.0.1:8000 (needs a Docker environment to verify).

Stuck? How to recover:

  • Docker missing error → sandbox execution depends on Docker (precheck reports docker-missing); install/start Docker first;
  • port taken → change --port.

Step 3: Wire in with the Python API (official form)

Why: the RemoteSandbox client connects to the server and executes commands. Needs the Step 2 server running; not tested in this environment (no Docker).

python3 - <<'PY'
import asyncio
from swerex import RemoteSandbox
async def main:
sandbox = RemoteSandbox(host="127.0.0.1", port=8000, auth_token="<token>")
print(await sandbox.run("echo hi"))
asyncio.run(main)
PY

Expected output: hi(需先启动服务器;本环境未实测——无 Docker) Stuck? How to recover:

  • connection refused → confirm the server is running (Step 2) and the port matches;
  • token mismatch → server and client auth-tokens must match.

How to confirm it works

Step 1: Confirm the package and import surface

Why: swerex-remote --help printing the server argument surface + import swerex not erroring means the install and library path work (verified in this environment).

swerex-remote --help
python3 -c "import swerex; print('swerex OK')"

Expected output: usage: swerex-remote [-h] [--host HOST] [--port PORT] --auth-token AUTH_TOKEN;swerex OK Stuck? How to recover:

  • command not found → activate the venv first in venv setups, confirm Python >= 3.10;
  • import failed → confirm pip and python3 are in the same environment.

Step 2: Confirm the sandbox path (needs Docker, not tested in this environment)

Why: the server can listen + the client's run("echo hi") returns hi means the sandbox execution path is complete; sandbox execution depends on Docker, and without Docker it reports docker-missing.

swerex-remote --host 127.0.0.1 --port 8000 --auth-token <token>

Expected output: 服务器监听(供 agent 客户端连接执行代码)

python3 - <<'PY'
import asyncio
from swerex import RemoteSandbox
async def main:
sandbox = RemoteSandbox(host="127.0.0.1", port=8000, auth_token="<token>")
print(await sandbox.run("echo hi"))
asyncio.run(main)
PY

Expected output: hi(需先启动服务器;本环境无 Docker 未实测) Stuck? How to recover:

  • Docker missing error → install/start Docker first (precheck reports docker-missing);
  • connection refused / token mismatch → confirm the server is running, and port and auth-token match on both sides.

Other environments

  • Sandbox execution: depends on Docker, containers managed by Docker; no Docker in this environment, server run and sandbox execution honestly marked not tested.
  • Server form: swerex-remote is a foreground/managed process; stop the process when not needed (no system service registration).
  • Write surface: pip environment + Docker containers, doesn't write user config directories.
  • Co-install: judged possible-compatible with code-review-graph / repomix — write surfaces don't overlap (sandbox containers / graph data / output files), co-install not tested.

Daily usage

Startup and entry

  • Server: swerex-remote --host ... --port ... --auth-token ...;
  • Client: RemoteSandbox (Python API).

Common operations

Operation 1: View the CLI surface (verified in this environment)

swerex-remote --help

Expected output: 服务器参数面(--host/--port/--auth-token) Operation 2: Verify the library imports (verified in this environment)

python3 -c "import swerex; print('swerex OK')"

Expected output: swerex OK Operation 3: Start the sandbox execution server (needs Docker + auth token; sandbox run not tested in this environment)

swerex-remote --host 127.0.0.1 --port 8000 --auth-token <token>

Expected output: 服务器监听(供 agent 客户端连接执行代码) Operation 4: Wire in with the Python API (official form)

python3 - <<'PY'
import asyncio
from swerex import RemoteSandbox
async def main:
sandbox = RemoteSandbox(host="127.0.0.1", port=8000, auth_token="<token>")
print(await sandbox.run("echo hi"))
asyncio.run(main)
PY

Expected output: hi(需先启动服务器;本环境未实测——无 Docker)

Data and directories

  • pip environment; sandbox containers managed by Docker (images/data on the Docker side).

Uninstall & cleanup

note: pip package auto-uninstall (idempotent); sandbox containers cleaned as needed
pip uninstall -y swe-rex 2>/dev/null || true
command -v swerex-remote >/dev/null 2>&1 && echo '残留: swerex-remote 仍存在' || echo 'swe-rex removed: OK'

Expected output: swe-rex removed: OK

Dependency warnings

  • Version: [1.4.0, 1.4.0] locked (verified collection version; release v1.4.0 has no separate assets, distributed via PyPI).
  • Environment: Python >= 3.10; sandbox execution needs Docker (sandbox run not tested in this environment).
  • Network: pip via the Tsinghua mirror (verified mainland path).
  • Write surface: pip environment; sandbox containers managed by Docker.
  • Background process: swerex-remote is a server form (foreground/managed process).
  • Co-install: judged possible-compatible with code-review-graph / repomix — write surfaces don't overlap (sandbox containers / graph data / output files), co-install not tested.

FAQ

  • Q: Can I use it without Docker? A: install and CLI/library smoke work (verified in this environment); sandbox execution (swerex-remote starting the server) depends on Docker, not tested.
  • Q: How do I stop the server? A: Ctrl+C for a foreground process, or manage it as a managed process (systemd etc.).
  • Q: What is auth-token? A: the connection auth token, generated by yourself (e.g. openssl rand -hex 16); server and client must match.
  • Q: Install with repomix / code-review-graph? A: judged possible-compatible — write surfaces don't overlap (sandbox containers / output files / graph data), co-install not tested.
  • Q: Where to report problems? A: install/uninstall issues on this marketplace go through the entry feedback channel; project issues go to the author's repository.
Verification Evidence
  • Verified: local repro log (2026-08-28, pip install + swerex-remote --help + import smoke).
  • Not tested: the sandbox execution server and RemoteSandbox runtime (no Docker) — commands from --help/official docs, honestly labeled.

← Trove | evidence & precheck records kept locally; conclusions and sources published here