SWE-ReX: a runtime interface for sandboxed shell environments
Sandboxed code execution for AI agents, locally or on the cloud. Massively parallel, easy to extend. Powering SWE-agent and more.
At a glance
- What is it?
- SWE-ReX lets an AI agent run shell commands locally or on Docker, AWS, Modal and other backends through one interface. It is built for agent developers who want parallel runs without rewriting their infrastructure code.
- Who is it for?
- SWE-ReX is for agent developers who need to run shell commands in sandboxes across several backends without rewriting their agent code, and who accept that parallel runs mean parallel cost. It is not for someone who wants a finished coding agent, since SWE-ReX is the execution layer and the agent logic is yours.
- 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 15 days 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 17, 2026, and from our analysis. They are not legal advice.
Editorial analysis
What problem SWE-ReX solves for agent developers
An agent that writes and runs code needs a shell. The moment you have more than one agent, the shell stops being a detail and becomes infrastructure: which machine, which container, how you tell that a command finished, how you get the exit code back, how you keep two agents from stepping on each other. SWE-ReX exists to absorb that work. The README describes it as a runtime interface for interacting with sandboxed shell environments, and the project's own framing is that it lets you focus on developing and evaluating your agent rather than on infrastructure. The audience is narrow and specific: people building coding agents or evaluation harnesses, not people who want a chat interface that happens to write code.
The design goal is portability of agent code. The README states that whether commands run locally or remotely in Docker containers, AWS remote machines, Modal, or something else, your agent code remains the same. That claim is the whole product. If you have ever written a benchmark harness that shells out to Docker and then had to port it to a cloud runner, the cost of that port is what SWE-ReX is trying to remove. The repository topics list agent, agents, ai, aws, cloud, coding-agents, docker, fargate, modal and swe-agent, which matches the README's list of supported environments.
How the shell session abstraction actually works
SWE-ReX does not model a command as a subprocess call that returns a string. It models a session. The README says SWE-ReX will recognize when commands are finished, extract the output and exit code, and return them to your agent. That is a different contract from subprocess.run: the runtime has to watch a live terminal, decide that the prompt has come back, and slice the output at the right boundary. This is why pexpect and bashlex are in the dependency list in pyproject.toml. pexpect is a Python implementation of expect, which is the standard tool for driving interactive programs; bashlex parses shell syntax. The presence of both suggests the runtime inspects what you asked for before it sends it to the terminal, rather than blindly piping bytes.
The second consequence is that sessions are first class. The README states that your agent can use interactive command line tools like ipython and gdb, and can interact with multiple such shell sessions in parallel, similar to how a human has a shell, ipython and gdb running at the same time. A debugger is the sharpest test of this design. You cannot run gdb through a one-shot exec call and get anything useful; you need a persistent terminal that accepts input while a process is stopped. If you only ever run make and pytest, this capability is overhead you may not want. If you drive a REPL or a debugger, it is the reason to pick this library over a thin Docker wrapper.
The third layer is the server. pyproject.toml lists fastapi, uvicorn, python-multipart and pydantic>=2 as core dependencies, and the repository has a src/ directory and a docs/ tree built with mkdocs.yml. FastAPI plus uvicorn means there is an HTTP surface in the package. The README does not describe the wire protocol or when you would talk to that server directly, so treat the HTTP layer as an implementation detail until the documentation at swe-rex.com says otherwise.
Installing SWE-ReX and starting a first session
The README gives the install commands directly. The base package has no cloud backend, so install it first and add extras only for the backends you actually use.
pip install swe-rex
# With modal support
pip install 'swe-rex[modal]'
# With fargate support
pip install 'swe-rex[fargate]'
# With daytona support (WIP)
pip install 'swe-rex[daytona]'
# Development setup (all optional dependencies)
pip install 'swe-rex[dev]'The extras are not cosmetic. The modal extra pulls in modal>=1.0 and boto3, per pyproject.toml, and the fargate extra pulls in boto3 alone. The daytona extra is marked WIP in the README, so do not build a production path on it yet. The base install requires Python 3.10 or newer.
After installing, the README's next instruction is to head to the documentation at https://swe-rex.com/. That is the honest state of things: the README does not include a runnable code example, so there is no first-session snippet to copy here without inventing one. What the README does state is the behaviour you should expect once you are in: you send commands, SWE-ReX detects completion, and it returns output plus exit code. Set up your environment with a backend you can reach, run a trivial command such as a directory listing, and confirm you get both the text and the exit status back before you build anything on top. If the exit code does not come through, the session detection is not working for your shell prompt, and that is the first thing to investigate.
Where SWE-ReX is the wrong tool
The clearest limitation is that SWE-ReX is a runtime, not an agent. The README positions it as something SWE-agent uses, and the repository's own dependency list contains no model client, no prompting layer and no task loop. If you want an agent that reads an issue and opens a pull request, installing swe-rex gives you none of that. You are expected to write the agent and call SWE-ReX for execution.
The second limitation is the cost profile that comes with the feature the README advertises most loudly. Massively parallel runs across AWS, Modal or Fargate mean many sandboxes alive at once, and each one bills. SWE-ReX makes the parallelism easy to express; it does not make it cheap, and nothing in the README suggests it manages a budget, queues work or caps concurrency for you. An evaluation that runs 30 instances in parallel is a decision about money as much as about architecture.
The third is interactive session detection. Because the runtime infers completion from terminal output, an unusual prompt, a program that prints a prompt-like string, or a command that never returns can confuse the boundary between one command and the next. The README does not document a timeout, a retry policy or a manual override for that detection. If your workload is a fixed set of non-interactive commands, a plain container exec is simpler and has fewer moving parts.
SWE-ReX compared with a plain Docker execution wrapper
The obvious alternative is not another agent framework but the thing most teams build first: a thin wrapper around docker exec or a subprocess call, with your own container lifecycle code. The difference in approach is the unit of abstraction. A wrapper treats each command as an isolated call: start a process, capture stdout and stderr, return the exit code. SWE-ReX treats a shell as a long-lived session that you attach to, which is what makes interactive tools like ipython and gdb possible at all. The cost of that choice is that SWE-ReX must parse terminal output to know when a command ended, and that parsing is the part most likely to break on an unusual environment. A wrapper never has that problem because it never tries to understand the terminal.
The second difference is backend switching. With a hand-rolled wrapper, moving from local execution to Modal or Fargate means writing a second implementation and keeping both in sync. SWE-ReX's stated purpose is that this switch does not change your agent code. Whether that holds in practice for your backends is something only the documentation at swe-rex.com can tell you, since the README lists the supported environments without describing the swap.
Maintenance, licence and upgrade cost
SWE-ReX is MIT licensed, stated in the repository metadata and in the LICENSE.txt file at the top level, and pyproject.toml declares the MIT classifier. MIT is permissive: you can use it in closed products, and the practical obligation is preserving the copyright notice. That is not legal advice, and if you redistribute the package inside a commercial product you should read LICENSE.txt yourself.
On maintenance, the facts are concrete. The repository is not archived. The last push was on 2026-09-07, which is recent relative to today's date of 2026-09-20. The most recent release is v1.4.0 from 2025-08-14, preceded by v1.2.1 in March 2025 and v1.2.0 in February 2025. There is a CHANGELOG.md at the top level, so version-to-version changes are tracked in the repository rather than only in release notes. The gap between the August 2025 release and the September 2026 push suggests active work between releases, but the README does not say what changed, so check CHANGELOG.md before upgrading.
The upgrade cost is mostly in the optional backends. The base dependencies are ordinary Python packages with no pinned versions in pyproject.toml, which means a fresh install can pull newer fastapi or pydantic releases than the ones the project was developed against. The daytona extra depends on daytona-sdk >= 0.21 and is marked WIP, so that is the extra most likely to break. If you depend on Modal or Fargate, pin your versions and read the changelog before moving.
Editorial conclusion
SWE-ReX is for agent developers who need to run shell commands in sandboxes across several backends without rewriting their agent code, and who accept that parallel runs mean parallel cost. It is not for someone who wants a finished coding agent, since SWE-ReX is the execution layer and the agent logic is yours. Before adopting it, check the documentation at swe-rex.com for the backend you intend to use, because the README only shows the pip install lines and the optional extras, and verify that the Python version you have is 3.10 or newer, which pyproject.toml requires.
Frequently asked questions
What is Swe AI agent?
The question appears to refer to SWE-ReX, which is not an agent itself but a runtime interface for interacting with sandboxed shell environments. The README describes it as the execution layer that SWE-agent uses, so it runs commands for an agent rather than deciding what to run.
How do I install SWE-ReX?
The README gives pip install swe-rex for the base package, plus extras such as swe-rex[modal] and swe-rex[fargate] for cloud backends. It requires Python 3.10 or newer, and the README then points to the documentation at swe-rex.com.
Does SWE-ReX support interactive tools like gdb?
Yes. The README states that SWE-ReX lets your agent use interactive command line tools such as ipython and gdb, and that it can manage multiple shell sessions in parallel. This is possible because the runtime watches a live terminal rather than running one-shot commands.
Which cloud backends does SWE-ReX support?
The README names local execution, Docker containers, AWS remote machines and Modal, and the install extras cover modal, fargate and daytona. The daytona extra is marked WIP in the README, so it is not a settled backend yet.
What licence does SWE-ReX use?
SWE-ReX is MIT licensed. The repository metadata and pyproject.toml both declare the MIT licence, and LICENSE.txt is at the top level of the repository.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/swe-agent-swe-rex)