TL;DR
SWE-agent is a language model that fixes bugs in real Python projects by working through a small set of purpose-built commands: find a file, open it, scroll it, search the repository, edit a range of lines, and run code. The authors call that command set and its feedback format an agent-computer interface (ACI). On the full SWE-bench test set of 2,294 GitHub issues, SWE-agent with GPT-4 Turbo resolved 12.47 percent of tasks, against 3.8 percent for the previous best system, and it did this without changing the model's weights.
Builds on: Agent-Computer Interface, LLM Agent, ReAct Prompting · Leads to: SWE-bench: Can Language Models Resolve Real-World GitHub Issues? as the benchmark it is scored on, and later coding agents that use tools designed for the model
Why it mattered
The paper gave coding agents a measured result on SWE-bench. Before it, the strongest systems that wrote patches for SWE-bench were non-interactive: a retrieval step picked likely files, and the model wrote one patch in a single shot. The best of those resolved 3.8 percent of the full benchmark. SWE-agent showed that giving the model an interactive loop with the right tools raised that to 12.47 percent on the full set and 18.00 percent on the Lite subset of 300 tasks.
The paper also gave the field a framing. It treats an agent as a new kind of end user with its own needs, and argues that its interface should be designed for those needs the way an integrated development environment is designed for a programmer. The code, data and leaderboard are public. By late 2026 the paper had about 2,600 citations on Semantic Scholar.
The problem
A language model that can call a Linux shell through tool use can, in principle, do software engineering. The shell is general, but it was built for people who can read a screen, remember what they did, and ignore clutter. A model working through the shell runs into three problems.
First, the commands have many options. Many bash commands document dozens of options, and each command's documentation is long. A model that has to compose several commands to make one change spends many turns on mechanics. The paper notes that chains of cd, ls and cat are extremely inefficient for localization.
Second, the feedback is weak. Many shell commands print nothing when they succeed, and when an edit is malformed the shell may accept it silently. The model then has no reliable picture of the file it is changing.
Third, the context fills up. Every output stays in the prompt, so a broad search or a long file dump pushes out what the model needs. A window of 128,000 tokens (GPT-4 Turbo) or 200,000 tokens (Claude 3 Opus) sounds large, but a multi-step repair with raw shell output uses it quickly.
The paper's question was narrow. The model stays fixed, so which interface makes the same model do better?
How it works
The walkthrough traces one turn of SWE-agent on a toy issue. Suppose the issue says that a function add in calc.py returns the wrong sum.
flowchart LR
A["Issue text and instructions"] --> B["LM writes a thought and one command"]
B --> C["ACI runs the command"]
C --> D["Concise feedback: viewer window, search summary, lint check"]
D --> E{"Submitted?"}
E -- no --> B
E -- yes --> F["Repository diff is the patch"]
-
The agent receives the task. The input is the issue text plus a system prompt that lists the available commands and gives an example. Nothing has run yet.
-
The model writes a thought and a command. Each turn it must output a short reasoning note and exactly one command, such as
find_file "calc.py". The thought-then-action pattern follows ReAct (ReAct Prompting). If the output does not parse, the system sends an error and asks again. -
The ACI runs the command and shortens the answer.
find_filereturns a short list of matching paths. A search that matches more than 50 lines returns no list and asks for a narrower query. A raw shellfindwould print every path. -
The model opens the file. The command
open "calc.py"shows at most 100 lines, each with a line number, plus the full path, the total line count and how many lines are hidden above and below. A 300-line file shows 100 lines and hides 200;scroll_downmoves the window. -
The model edits a range. The model issues an edit that replaces lines 3 to 3 with
return a + bin place ofreturn a - b. The edit takes three arguments, a start line, an end line and the new text, and replaces that whole range in one step. A linter checks the candidate file first. If the edit would create a syntax error, it is discarded and the model is asked to try again. -
The viewer shows the result. After a successful edit the viewer displays the updated lines at once, so the model does not need another command to see what it changed.
-
The model runs a check and submits. It writes a small reproduction script, runs it with
python, sees the corrected output, and submits. The submitted state of the repository is the patch that gets scored.
Two smaller rules run through every step. Observations older than the last 5 turns are collapsed to one line each, so the prompt keeps the plan and the actions but not stale file contents. And a run that exceeds its per-instance budget of 4 dollars has its existing edits submitted automatically.
The math
The main quantity is the resolve rate: the share of tasks whose patch makes every relevant test pass. For a benchmark split of N tasks, of which k are resolved,
The paper reports it as a percentage. Its other metric is average API cost, taken over the instances that were resolved.
Step 2 in symbols: the loop
Let be the turn index. At each turn the model produces a pair , a thought and one command. The ACI maps the command and the repository state to an observation and a new state:
The next output depends on the task, the history of thoughts and commands, and the collapsed observations. A cost budget bounds the loop: the run ends when the model submits or when the cumulative API cost passes , which the paper sets to 4 dollars.
Step 3 in symbols: the search cap
Let be the number of lines a search matches, and let the cap be . The output is
Step 5 in symbols: the edit guard
Let be the file at turn , and let be the file after the proposed edit replaces a range of lines. The edit is kept only if the linter accepts :
Results
Table 1 of the paper compares three settings on the full SWE-bench test set and on the Lite subset of 300 tasks.
| Setting | Model | Full: % resolved | Full: avg cost | Lite: % resolved | Lite: avg cost |
|---|---|---|---|---|---|
| RAG | GPT-4 Turbo | 1.31 | 0.13 | 2.67 | 0.13 |
| RAG | Claude 3 Opus | 3.79 | 0.25 | 4.33 | 0.25 |
| Shell-only | GPT-4 Turbo | not run | not run | 11.00 | 1.46 |
| SWE-agent | GPT-4 Turbo | 12.47 | 1.59 | 18.00 | 1.67 |
| SWE-agent | Claude 3 Opus | 10.46 | 2.59 | 13.00 | 2.18 |
The text says that SWE-agent with GPT-4 Turbo solved 286 of 2,294 full-set tasks (12.47 percent) and 54 of 300 Lite tasks (18.00 percent). Compared with the RAG baseline on Lite, SWE-agent costs 8 to 13 times more and resolves a 6.7-fold higher share. Against shell-only with the same model, the relative gain is 64 percent. On HumanEvalFix, a short code-repair benchmark, the text reports 88.3 percent pass@1 (the abstract gives 87.7 percent).
Each ablation on Lite is run with the same model and compared with the full configuration, which scores 18.0 percent. The drop is that baseline minus the variant:
- No search tools: 15.7 percent, a drop of 2.3 points.
- Iterative search, showing one result at a time: 12.0 percent, a drop of 6.0 points. Agents stepped through matches one by one until they ran out of budget.
- No file editor, only shell redirection and sed: 10.3 percent, a drop of 7.7 points.
- Viewer window of 30 lines: 14.3 percent, a drop of 3.7 points.
- Viewer showing the whole file: 12.7 percent, a drop of 5.3 points.
- Edit without linting: 15.0 percent, a drop of 3.0 points.
The paper's behavioural analysis adds these numbers. 51.7 percent of the 2,294 full-set trajectories (1,185 of them) had at least one failed edit. Any edit attempt eventually succeeded 90.5 percent of the time, but that fell to 57.2 percent after a single failed edit. Successful runs had a median cost of 1.21 dollars and 12 steps, against a mean of 2.52 dollars and 21 steps for unsuccessful ones. Of the resolved runs, 93.0 percent were submitted before exhausting their budget, against 69.0 percent of all runs. A GPT-4o judge sorted 248 unresolved Lite trajectories into nine failure categories and agreed with the authors on 87 percent of a hand-labelled check. About half of the failures (52.0 percent) were incorrect or overly specific implementations, and cascading failed edits made up another 23.4 percent.
The limits are clear from the paper. The ACI was tuned on a small development set, using qualitative review and a grid search over window size, history processing and temperature. The results are for two closed models and one benchmark of Python repositories, and the paper reports that open models of the time performed poorly in this setting, partly because their context windows were too small.
Reading guide
The paper has seven numbered sections and two appendices. Read it in this order.
- Introduction. Needs Agent-Computer Interface and LLM Agent. The three claims (ACI design matters, the interface beats the shell, the design principles) are all stated here.
- The Agent-Computer Interface. Needs Agent-Computer Interface. The four design principles (simple actions, compact actions, concise feedback, guardrails) are the paper's core argument.
- SWE-agent: Designing an ACI. Needs ReAct Prompting for the thought-and-action loop and Tool Use for how a model calls a command. The search, viewer, editor and context-management subsections map one-to-one to the How it works walkthrough above.
- Experimental Setup. Needs SWE-bench: Can Language Models Resolve Real-World GitHub Issues? for the benchmark and Language Model for the models. The RAG and shell-only baselines are described here.
- Results. Needs In-Context Learning only for the background on demonstrations used in the prompt. The ablations and behaviour analysis in 5.1 and 5.2 are the numbers quoted above.
- Related Work. Needs LLM Agent. To the authors' knowledge, SWE-agent is the first work to explore language agents for end-to-end software engineering.
- Discussion. Compares interface design with human-computer interaction. For a related agent that improves across attempts, see Reflexion: Language Agents with Verbal Reinforcement Learning.
The appendices hold the hyperparameter sweep, per-model results and trajectory analysis. They are optional on a first read.
Check yourself
QuestionWhat is the resolve rate of a run that resolves 286 of the 2,294 full SWE-bench test tasks?Show answer
Divide k by N: 286 divided by 2,294 is about 0.1247, so the resolve rate is 12.47 percent, the figure the paper reports for SWE-agent with GPT-4 Turbo.
QuestionA search matches exactly 50 lines. Does the ACI return the list, and why does a cap at 50 exist?Show answer
Yes. The cap is inclusive: the output is the summary when the count is at most 50, and only a request for a narrower query when it is more than 50. The cap keeps each search output short enough to read in one turn and pushes the agent to refine broad queries.
QuestionWhy does the paper use a 100-line file viewer rather than showing the whole file?Show answer
The ablations show that a whole-file view scored 12.7 percent on Lite, below the 18.0 percent of the full system, and a 30-line window scored 14.3 percent. Too much content fills the prompt with text the model does not need, and too little forces extra scrolling. The paper reports both extremes as worse than its chosen window.
QuestionSWE-agent scores 18.00 percent on Lite and the no-linting variant scores 15.0 percent. What is the gap in points, and what does the linter do?Show answer
The gap is 18.00 minus 15.0, which is 3.0 points. The linter checks a candidate edit and discards it if it introduces an error, so the agent does not keep working on a broken file. Without it, the agent loses those 3 points on this benchmark.
QuestionA colleague says a stronger model would make the interface unnecessary. Using the paper's ablations, how would you answer?Show answer
The paper fixes the model and changes only the interface, and the interface moved the Lite score by 2.3 to 7.7 points in every ablation. Iterative search alone cost 6.0 points, which is a large effect from one design choice. A stronger model still needs commands that are short to use and output that is short to read, so the interface is not a substitute for a better model.
Sources
- SWE-agent paper, arXiv:2405.15793: https://arxiv.org/abs/2405.15793
- ReAct, arXiv:2210.03629: https://arxiv.org/abs/2210.03629