Self-hosted service
SWE-agent/SWE-ReX avatar
SWE-agent/SWE-ReX

SWE-ReX: a shell runtime that keeps agent code separate from where the sandbox runs

Sandboxed code execution for AI agents, locally or on the cloud. Massively parallel, easy to extend. Powering SWE-agent and more.

591 stars119 forksPythonMIT

At a glance

What is it?
SWE-ReX is a Python runtime interface for driving sandboxed shell sessions from an AI agent. Its selling point is that the same agent code targets local execution, Docker, AWS, Modal or Daytona without changes, but the README is a thin surface over a documentation site you have to read before adopting it.
Who is it for?
Adopt SWE-ReX if you are building or evaluating a coding agent and you have already hit the point where sandbox plumbing is competing with agent logic for your attention. Skip it if your agent only ever runs a fixed sequence of commands in a single container you control, because the abstraction buys you nothing there and adds a dependency.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 1 day ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

The infrastructure tax that SWE-ReX is trying to remove

An agent that edits code has to run commands somewhere, and it has to know when those commands are done. Doing that by hand means writing container lifecycle code, wiring up SSH or an exec API, reading process exit codes, and handling the case where a command never returns. The README frames the project as an answer to exactly that: "We built SWE-ReX to help you focus on developing and evaluating your agent, not on infrastructure." The intended audience is narrow and identifiable. It is people running coding agents against benchmarks or fleets, the kind of workload where the README claims support for "fast, massively parallel" runs and shows SWE-agent driving 30 SWE-bench instances at once. If you are writing a single-shot script that shells out to pytest in a container you already manage, this is not aimed at you.

How command completion is detected inside a shell session

The mechanism the README describes is session-oriented rather than process-oriented. SWE-ReX does not simply spawn a subprocess and wait on it. It attaches to a running shell session and, in the project's words, "will recognize when commands are finished, extract the output and exit code and return them to your agent." That distinction matters because it is what allows interactive tools to work. A subprocess wrapper cannot drive ipython or gdb, since neither terminates on its own; a session that can detect completion boundaries can. The README lists ipython and gdb by name as the interactive tools this enables. It also states that multiple such sessions can run in parallel, "similar to how humans can have a shell, ipython, gdb, etc. all running at the same time." The README does not explain how completion is detected, whether via prompt matching, sentinel markers or something else. That detail lives on the documentation site, and you should read it before trusting the behaviour on an unusual prompt or a shell that emits escape sequences.

One agent codebase, several execution backends

The abstraction boundary is the runtime interface. The README states that whether commands run locally or in Docker containers, on AWS remote machines, or on Modal, "your agent code remains the same." That is the whole architectural claim, and it is a reasonable one to make for a library whose job is to normalize an execution target behind a common API. The topics list on the repository confirms the intended spread: docker, aws, fargate, modal. The README also notes that this design supports "a broad range of platforms, including non-Linux machines without Docker," which is the practical reason the remote backends exist at all. The stated motivation is not only portability. The README says the project came out of work on SWE-agent and SWE-agent enigma, and that using it helped "disentangle agent logic from infrastructure concerns, making SWE-agent more stable and easier to maintain." That is a maintainability argument from the maintainers themselves, not a performance claim, and it is worth reading as such.

Installing SWE-ReX and choosing a backend extra

The base install is a single command: `pip install swe-rex`. Backends beyond the default are optional extras. Modal support comes from `pip install 'swe-rex[modal]'` and Fargate support from `pip install 'swe-rex[fargate]'`. There is a third extra, `pip install 'swe-rex[daytona]'`, but the README annotates it as WIP, so treat Daytona as unfinished rather than supported. A development setup that pulls all optional dependencies is available as `pip install 'swe-rex[dev]'`. The README stops there and points to the documentation site for actual usage, which is the honest limitation of this review: the repository README gives you installation and a description of intent, not a worked example of constructing a runtime, opening a session and reading back an exit code. If you need the API surface before deciding, the docs site at swe-rex.com is the only source in this material. The package is on PyPI, and the latest release listed is v1.4.0 from August 2025, following v1.2.1 and v1.2.0 earlier that year.

Where the abstraction leaks and when to skip it

A runtime that hides the execution target also hides the target's failure modes, and that is the real cost. If a Docker container dies mid-command, or an AWS instance is reclaimed, the agent sees a session that stopped responding, and the library's job is to turn that into something actionable. The README does not describe error handling, timeouts or retry semantics at all, so you cannot tell from this material how a dead backend surfaces to agent code. There is a second, subtler boundary: the completion-detection heuristic is tuned for shell sessions. An agent that needs to run a command with no reliable end marker, or one that produces output indistinguishable from a prompt, is working against the design rather than with it. The parallel-session feature is also a resource decision, not a free one. Running many sessions against many remote backends multiplies whatever those backends cost, and the README's parallel framing is about throughput, not about efficiency per run.

Docker SDK versus SWE-ReX: the difference is who owns the session

The obvious alternative for the local case is the Docker SDK for Python, or plain `docker exec`, both of which can run a command in a container and return its exit code. The difference is what each one models. The Docker SDK models containers and one-shot exec calls: you start a container, you run a command, you read the result, and if you want a persistent interactive shell you build the plumbing yourself, including the part where you decide a command has finished. SWE-ReX models the session first. It keeps a shell alive, tracks completion inside it, and lets several of those sessions coexist, which is why interactive tools work without extra effort from the caller. The trade is that you inherit SWE-ReX's completion heuristic and its backend abstraction instead of Docker's much larger and better-documented surface. For a single container and a fixed command list, the Docker SDK is the smaller dependency and the more predictable one. For an agent that needs to poke at a debugger in one session while running tests in another, the session model is doing work the Docker SDK does not.

Licence, release cadence and the cost of keeping up

SWE-ReX is MIT licensed, which places few restrictions on how you embed it, including in closed-source agent products; that is a factual statement about the licence text, not legal advice, and you should have counsel review anything that matters commercially. The release history in this material shows v1.2.0 and v1.2.1 in February and March 2025, then v1.4.0 in August 2025, with the repository last pushed in September 2026. The gap between minor releases suggests the API is not churning monthly, but the jump from 1.2 to 1.4 with no 1.3 listed in this material means you should check the release notes rather than assume a smooth upgrade path. The maintenance cost that matters more is the extras: `swe-rex[fargate]` and `swe-rex[modal]` pull in cloud provider SDKs, and those move on their own schedules. Pinning swe-rex without pinning its backend extras is how a working agent pipeline breaks on a Tuesday. The daytona extra being marked WIP means you should not build on it yet, whatever the topic list implies.

Editorial conclusion

Adopt SWE-ReX if you are building or evaluating a coding agent and you have already hit the point where sandbox plumbing is competing with agent logic for your attention. Skip it if your agent only ever runs a fixed sequence of commands in a single container you control, because the abstraction buys you nothing there and adds a dependency. Before committing, verify three things on the documentation site: which backends are actually released versus marked WIP, how the completion-detection heuristic behaves against the interactive tools your agent invokes, and what the Fargate and Modal extras pull in.

Official sources

  1. License: MIT
  2. Project website
  3. README
  4. Releases
  5. SWE-agent/SWE-ReX on GitHub
Community notes

Community notes