skillfed

swe-rex

Sandboxed code execution for AI agents, locally or on the cloud.

swe-rex v1.4.0 3.2M downloads/30d#2,724 on PyPI570
Permissive license Active released

What it is and what it does

SWE-ReX is a runtime abstraction layer that lets AI agents execute shell commands in sandboxed environments without caring whether they run locally, in Docker, on AWS, or on Modal. It handles the messy details of spawning sessions, detecting command completion, capturing output and exit codes, and managing multiple parallel shells—so your agent code stays the same whether you're testing locally or scaling to dozens of parallel runs.

The package is built on fastapi and uvicorn, suggesting it exposes a web service interface for remote execution. It integrates with pexpect and bashlex to parse and interact with shell sessions, and uses pydantic for configuration validation. It's designed for developers building AI agents that need to run arbitrary commands in controlled environments without reimplementing infrastructure plumbing.

Use it for:

  • Let an AI agent run code-fixing commands in an isolated Docker container without hardcoding container-specific logic in your agent.
  • Evaluate an AI agent on a benchmark by spinning up parallel shell sessions and running the agent on each without managing infrastructure.
  • Build a multi-tool agent that uses ipython, gdb, and bash interactively, with SWE-ReX handling session multiplexing and output parsing.
  • Deploy an agent to Modal or AWS and have it execute shell commands remotely while your agent code remains unchanged.
  • Run many agents in parallel locally or on the cloud without writing custom process management or container orchestration code.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

SWE-ReX provides a runtime interface for AI agents to execute shell commands in sandboxed environments—local, Docker, AWS, or Modal—with a unified API that abstracts away infrastructure details.

Yes, if you are building AI agents that need to execute shell commands in sandboxed or remote environments. The package solves a real infrastructure abstraction problem and is actively maintained with no known vulnerabilities. Install friction is low and the permissive MIT license removes legal friction. Start with the base install; add optional dependencies only if you need Modal, Fargate, or Daytona support.

Install

swe-rex on PyPI

pip

pip install swe-rex

uv

uv add swe-rex

poetry

poetry add swe-rex

Installing swe-rex

Before you install

Low friction install with a pure-Python wheel. Active maintenance (last commit 2026-08-10) and recent releases (1.4.0 on 2025-08-14) suggest ongoing support. Eight runtime dependencies including fastapi, uvicorn, and pydantic indicate a web-service-oriented architecture.

License in practice

MIT license (permissive) allows unrestricted use, modification, and distribution with minimal legal friction for commercial or private projects.

Quickstart

pip install swe-rex

from swe_rex import LocalExecutor

executor = LocalExecutor()
result = executor.run_command('echo hello')

Requires Python >=3.10. For cloud platforms (Modal, Fargate, Daytona), additional optional dependencies and platform credentials are needed.

Verify before relying

  • Exact API surface and how to instantiate executors for different platforms (Docker, AWS, Modal) beyond the install extras shown.
  • Whether interactive tools like ipython or gdb require special configuration or just work out of the box.
  • Performance characteristics and latency overhead when running commands remotely vs. locally.
  • Limits on parallel agent count or resource consumption when scaling to many concurrent sessions.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 8 — fastapi, uvicorn, requests, pydantic, pexpect, bashlex, python-multipart, rich
Maintenance actively maintained — 365 days since the last release
Last repo commit
First released
Downloads 3,151,672/month — #2,724 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: swe_rex-1.4.0-py3-none-any.whl

Keywords: nlp, agents, code

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.11

Tags

ai agent shell executionsandboxed code executionremote command execution frameworkagent infrastructure abstractionparallel shell environment managementdocker container execution apiinteractive shell session control
agent-infrastructuresandbox-executionparallel-shells

More Artificial Intelligence packages

Further reading