Skip to content
Developer ToolsOpen sourceArchitecture reviewSelf-hostable
SWE-agent logo

SWE-agent

MIT-licensed Python agent that gives language models shell and test tools to fix real GitHub issues, isolated in Docker runtimes.

Dhanji Bhagat

Dhanji Bhagat

Founder, Emiote

Managed Cloud

Fully hosted platform. Automated backups and SLA.

Reference Cost

Not publicly disclosed (no managed cloud; you pay the model provider directly)

Self-Host Path

Private compute. Zero seat taxes; team runs ops.

Reference Cost

Rough operating estimate: $20 to $40/mo VPS (4GB to 8GB RAM) for Docker runtimes, plus pay-as-you-go model tokens

SWE-agent is an open-source Python agent from Princeton and Stanford researchers that turns a language model into an autonomous software engineer. It exposes an Agent-Computer Interface of shell, file, and test tools, runs the model in a loop inside Docker or local runtimes, and records every trajectory. Teams use it to fix real GitHub issues and benchmark on SWE-bench.

Scope and Currency

This review is based on the public repository (SWE-agent/SWE-agent, branch main, reviewed 2026-09-29): README.md, pyproject.toml (package sweagent, Python 3.11+), config/ directory, .env.example, LICENSE (MIT, verified full text), and the official docs at swe-agent.com (installation from source, hello world tutorial). I did not execute the agent. Star counts and benchmark claims below are maintainer-reported values from the repository and docs, not independent measurements. The sister projects mini-swe-agent and SWE-ReX are covered as separate notes.

1. What It Replaces and Why It Matters

Fixing a GitHub issue by hand means reproducing the bug locally, reading surrounding code, writing a patch, running the test suite, and repeating until green. Evaluation harnesses for this loop are usually bespoke scripts that only the author understands. Three alternatives occupy nearby positions: terminal pair programmers such as Aider for interactive edit and test cycles, generalist autonomous environments such as OpenHands, and the maintainers own mini-swe-agent, which they now recommend over SWE-agent for new work.

SWE-agent takes the research position: a small, hackable Python codebase where the whole agent is governed by a single YAML config, built to answer how far a language model gets when given a real computer interface and graded on SWE-bench. Good fit: research teams and platform engineers who want to study or extend agent behavior with full trajectory logs. Bad fit: teams that want a maintained daily driver for shipping code; the maintainers direct those users to mini-swe-agent.

2. Architecture and Tech Stack Review

| Component | Source Evidence | Evidence Type | | CLI entry point | sweagent = sweagent.run.run:main in pyproject.toml | Package manifest (fact) | | Runtime | Python 3.11+, package sweagent | Manifest (fact) | | Model layer | litellm dependency, --agent.model.name flags in docs | Manifest plus docs (fact) | | Execution layer | swe-rex>=1.4.0 dependency | Manifest (fact) | | Interfaces | Flask plus Textual (web UI plus terminal UI), config/ YAML | Manifest plus repo tree (fact) | | Secrets | GITHUB_TOKEN in .env.example | Config sample (fact) | | License | LICENSE, MIT, 2024, six named authors | Primary source (fact) | | Docs site | mkdocs plus docs/ directory | Repo tree (fact) |

The core idea is the Agent-Computer Interface (ACI): instead of asking the model for a patch in one shot, SWE-agent gives it a persistent shell with a small set of commands (open files, edit lines, run tests, submit) and lets it loop. Execution happens through SWE-ReX, the sister runtime project, which provides local and Docker-backed shells. Every run writes a trajectory file, so failures are replayable step by step.

Agent Loop

sequenceDiagram
    autonumber
    participant Dev as Developer
    participant CLI as sweagent CLI
    participant LM as Language model (via LiteLLM)
    participant ACI as Agent-Computer Interface
    participant ENV as SWE-ReX runtime (Docker or local)
    Dev->>CLI: sweagent run --env.repo.github_url=... --problem_statement.github_url=...
    CLI->>ENV: Provision repo snapshot
    loop Thought, action, observation
        CLI->>LM: State plus available commands
        LM->>ACI: Shell command (open, edit, run tests)
        ACI->>ENV: Execute in isolated runtime
        ENV->>ACI: Exit code plus output
        ACI->>CLI: Observation appended to trajectory
    end
    CLI->>Dev: Patch plus full trajectory log

3. Visual Tour and Interface Proof

SWE-agent hello world tutorial in the official docs, showing the sweagent run command with model and cost limit flags

The screenshot above is the official hello world tutorial, which is the honest front door of the project: one sweagent run command with explicit model selection and a per-instance cost limit. The project mark used on this page is the official hand asset from assets/swe-agent-hand.svg, copied byte-identical. Banner variants in the same directory were verified and rejected for card use because of their wide aspect ratio.

4. Total Cost of Ownership

| Dimension | Managed Alternative | Self-Hosted SWE-agent | | License | Vendor subscription | $0 (MIT, verified) | | Compute | Included | Rough estimate: $20 to $40/mo VPS (4GB to 8GB RAM) for Docker runtimes | | Model usage | Included or metered | Pay-as-you-go to Anthropic or OpenAI; tutorial caps a single run at $2.00 via --agent.model.per_instance_cost_limit | | GitHub access | Included | $0 (token with public_repo scope; repo scope only for private repos) | | Maintenance | Vendor-managed | Your responsibility (Python env, Docker, config upgrades) | | Data ownership | Vendor-controlled | Your infrastructure plus trajectory files on your disk | | Operational burden | Low | Medium (research-grade tooling, see The Bad) |

All infrastructure figures above are labeled estimates from standard VPS tiers, not project-published numbers. The one verified cost control is the per-instance cost limit flag documented in the hello world tutorial. Never assume self-hosting costs $0: the license is free, the tokens are not.

The Bad: What to Know Before Adopting

  • The maintainers state that most current development effort goes to mini-swe-agent, which they recommend for new work. Adopting SWE-agent today means adopting the older branch of the family.
  • The happy path assumes Docker. Without container isolation the model executes shell commands with your user privileges, which is the wrong default for untrusted problem statements.
  • Token spend scales with repository size and loop length. A lost agent that keeps listing directories and rerunning suites burns budget with nothing to show; the cost limit flag exists because this failure mode is routine.
  • Trajectory files record everything the agent saw, including secrets printed to stdout. Publishing trajectories without scrubbing leaks tokens and keys.
  • Python-only with a research-grade UX. There is no managed cloud, no SLA, and breaking config changes arrive with academic release notes rather than migration guides.
  • EnIGMA mode targets offensive cybersecurity challenges. That is legitimate security research, but it means the same codebase that fixes your bugs is designed to operate exploit tooling, which belongs in isolated labs under explicit policy.

Security Note

.env.example requires a single secret: GITHUB_TOKEN with public_repo scope for public repos and full repo scope for private ones. A repo-scoped token can clone private code and open pull requests, so a leaked token is a code-exfiltration and supply-chain risk, not just an API quota risk. The deeper threat model is code execution: the agent runs model-generated shell commands, so the trust boundary is the SWE-ReX runtime plus Docker, never the model output. Run untrusted repositories and untrusted problem statements only in Docker-backed runtimes, keep trajectory artifacts out of public storage, and scope the GitHub token to the narrowest repos that the task needs.

Licensing

MIT License, copyright 2024 John Yang, Carlos E. Jimenez, Alexander Wettig, Shunyu Yao, Karthik Narasimhan, and Ofir Press. The full license text was verified in the repository. Commercial use, modification, and redistribution are permitted with the copyright notice included. Verify the file at the official repository before commercial integration, since the copyright holder list is the compliance surface.

Quickstart and Deployment

Verified against the official from-source installation guide and hello world tutorial:

git clone https://github.com/SWE-agent/SWE-agent.git
cd SWE-agent
python -m pip install --upgrade pip && pip install --editable .
sweagent --help

Configure model access (verified variable names from the tutorial):

export ANTHROPIC_API_KEY=<your key>
export OPENAI_API_KEY=<your key>

Run the trivial example from the docs (verified command shape, model identifier, and flags):

sweagent run \
  --agent.model.name=claude-sonnet-4-20250514 \
  --agent.model.per_instance_cost_limit=2.00 \
  --env.repo.github_url=https://github.com/SWE-agent/test-repo \
  --problem_statement.github_url=https://github.com/SWE-agent/test-repo/issues/1

No ports, environment variables, or flags beyond the above were used. For anything beyond this path, follow the official docs instead of improvising flags.

Who Should Use This

Good fit: research groups studying agent behavior who need hackable Python, full trajectory logs, and SWE-bench compatibility; platform teams evaluating ACI design before building their own harness; security labs running EnIGMA-style CTF work in isolated Docker environments. Bad fit: product teams wanting a maintained coding assistant with support and SLAs (use mini-swe-agent or a managed product); shops without Docker discipline; anyone who needs guaranteed cost ceilings beyond per-run flags.

Deeper Insight

The durable contribution is the interface, not the scores. By fixing a small command set and letting the model loop against real tool output, SWE-agent showed that agent quality comes from the fidelity of the observation channel more than from prompt cleverness. Trajectories as first-class artifacts made failures debuggable, which is why the design survived into mini-swe-agent even as the codebase was rewritten. When evaluating any coding agent, ask what the model can observe and what is recorded; the rest is packaging.

What I Would Change

If I operated this system, I would make Docker-backed execution the non-overridable default for any run touching a network-cloned repository, moving the current local-runtime convenience path behind an explicit flag that states the privilege risk. I would also add trajectory secret scrubbing at write time, since logs that echo environment output are the most likely exfiltration path in published research artifacts. Both are engineering opinion, not project fact.