# SWE-agent - Deep Dive

> **TL;DR**: SWE-agent is Princeton's open-source AI system (17,900+ stars) that automatically fixes GitHub issues. It introduced the Agent-Computer Interface (ACI) concept - a specially designed interface that helps LLMs interact with codebases effectively. Achieves state-of-the-art results on SWE-bench (12.5% → 77.4% with latest versions). Used by Meta, NVIDIA, and others. MIT licensed.

---

## What Is SWE-agent?

**SWE-agent** is an autonomous software engineering system that takes GitHub issues as input and generates pull requests as output. It was developed by Princeton University researchers and represents a paradigm shift in how LLMs interact with development environments.

### The Core Innovation: Agent-Computer Interface (ACI)

```
┌─────────────────────────────────────────────────────────────────────┐
│                    THE ACI CONCEPT                                   │
├─────────────────────────────────────────────────────────────────────┤
│                                                                     │
│   Traditional Approach:                                             │
│   "Just give the LLM access to bash and hope for the best"         │
│                                                                     │
│   ACI Approach:                                                     │
│   "Design a custom interface specifically for LLM agents"           │
│                                                                     │
│   KEY INSIGHT:                                                      │
│   Interface design is as important as model capability              │
│                                                                     │
│   ACI FEATURES:                                                     │
│   ├── Compact command design (minimal actions)                      │
│   ├── Informative feedback (explicit success/failure)               │
│   ├── Context management (collapsed history)                        │
│   ├── Built-in linter (syntax validation)                          │
│   └── Error recovery (retry on malformed output)                   │
│                                                                     │
└─────────────────────────────────────────────────────────────────────┘
```

---

## Quick Stats

| Metric | Value |
|--------|-------|
| **GitHub Stars** | 17,900+ |
| **Forks** | 1,900+ |
| **Contributors** | 89+ |
| **License** | MIT |
| **Created By** | Princeton NLP |
| **Published** | NeurIPS 2024 (Oral) |

---

## How It Works

### The Workflow

```
┌─────────────────────────────────────────────────────────────────────┐
│                    SWE-AGENT WORKFLOW                                │
├─────────────────────────────────────────────────────────────────────┤
│                                                                     │
│   INPUT                                                             │
│   ├── Repository snapshot (specific commit)                         │
│   └── GitHub issue description                                      │
│                              ↓                                      │
│   AGENT LOOP                                                        │
│   ├── 1. Agent generates "thought" and "action"                    │
│   ├── 2. Action executed in sandboxed environment                  │
│   ├── 3. Observation captured and fed back                         │
│   ├── 4. Context updated (history collapsed)                       │
│   └── 5. Repeat until issue resolved                               │
│                              ↓                                      │
│   OUTPUT                                                            │
│   └── Patch file (pull request)                                    │
│                                                                     │
└─────────────────────────────────────────────────────────────────────┘
```

### ACI Design Principles

| Principle | Implementation |
|-----------|---------------|
| **Compact Commands** | File navigation and editing in minimal actions |
| **Informative Feedback** | "Your command ran successfully and did not produce any output" |
| **Context Management** | Past observations collapsed to single lines |
| **Guardrails** | Built-in linter prevents syntactically incorrect code |
| **Error Recovery** | Malformed generations trigger retry prompts |

---

## Performance

### SWE-bench Results

| Model/Version | Performance |
|---------------|-------------|
| **Baseline (non-interactive)** | 3.8% |
| **SWE-agent 1.0 + Claude 3.7** | 12.5% (SoTA on Full) |
| **Mini-SWE-Agent** | 65% (in 100 lines of Python!) |
| **Live-SWE-agent** | 77.4% (SWE-bench Verified) |
| **Live-SWE-agent** | 45.8% (SWE-bench Pro) |

### Other Benchmarks

| Benchmark | Score |
|-----------|-------|
| **HumanEvalFix** | 87.7% |

---

## Supported LLMs

SWE-agent is model-agnostic:

| Model | Status |
|-------|--------|
| **GPT-4o** | Supported |
| **Claude Sonnet 4** | Supported |
| **Claude 3.7** | State-of-the-art results |
| **Open-weights models** | SWE-agent-LM-32b |
| **Any model** | Mini-SWE-Agent works with any LLM |

---

## Comparison with Alternatives

| Aspect | SWE-agent | OpenHands | Devin |
|--------|-----------|-----------|-------|
| **Focus** | Bug fixing | General dev | Quick tasks |
| **Stars** | 17.9k | 66k | Proprietary |
| **Open Source** | Yes (MIT) | Yes (MIT) | No |
| **Key Innovation** | ACI design | Multi-agent | Simplicity |
| **Best For** | GitHub issues | Complex projects | Beginners |

---

## Variants

### Mini-SWE-Agent

A simplified 100-line version proving that complex scaffolding isn't always necessary:

```bash
pip install mini-swe-agent
```

| Feature | Value |
|---------|-------|
| **Size** | 100 lines of Python |
| **Performance** | 65% on SWE-bench Verified |
| **Requirement** | Any LLM (no tool-calling needed) |
| **Uses** | Just bash |

### Live-SWE-agent

The latest evolution with autonomous scaffold improvement:

| Feature | Value |
|---------|-------|
| **Performance** | 77.4% on SWE-bench Verified |
| **Architecture** | Self-evolving scaffold |
| **Best on** | 45.8% on SWE-bench Pro |

### EnIGMA Mode

Cybersecurity specialization:
- Solves capture-the-flag challenges
- Vulnerability detection
- Security penetration testing

---

## Installation

### Quick Start (Browser)

Try directly in GitHub Codespaces - no local installation required.

### Standard Installation

```bash
git clone https://github.com/SWE-agent/SWE-agent.git
cd SWE-agent
pip install -e .
```

### Configuration

Single YAML file for all customization - highly hackable for research.

---

## Use Cases

### 1. Automated GitHub Issue Resolution

```
Input: GitHub issue URL
Output: Pull request with fix
```

### 2. Bug Fix Automation

- Navigate codebases autonomously
- Identify and fix bugs
- Strong in error-heavy environments

### 3. Cybersecurity (EnIGMA)

- CTF challenges
- Vulnerability detection
- Penetration testing

### 4. Code Maintenance

- Fixing merge conflicts
- Addressing linter failures
- Getting PRs over the finish line

---

## Real-World Adoption

Used by major companies:
- **Meta**
- **NVIDIA**
- **Essential AI**
- **Anyscale**

**Impact**: About 20% of commits to OpenHands codebase are authored/co-authored by AI agents.

---

## Research Background

### Paper

**Title**: "SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering"

| Venue | NeurIPS 2024 (Oral) |
|-------|---------------------|
| **arXiv** | 2405.15793 |
| **Key Finding** | Interface design is critical for agent success |

### Authors (Princeton NLP)

- John Yang
- Carlos E. Jimenez
- Alexander Wettig
- Shunyu Yao
- Karthik Narasimhan
- Ofir Press

---

## How This Connects to Our Other Deep Dives

| Deep Dive | Connection |
|-----------|------------|
| **OpenHands** | Competing approach to autonomous coding |
| **SWE-bench** | The benchmark SWE-agent was designed for |
| **Continue** | Different paradigm (assistant vs autonomous) |
| **Agentic Design Patterns** | ACI is an agentic pattern |

---

## Key Links

| Resource | URL |
|----------|-----|
| GitHub | https://github.com/SWE-agent/SWE-agent |
| Documentation | https://swe-agent.com/ |
| arXiv Paper | https://arxiv.org/abs/2405.15793 |
| Mini-SWE-Agent | https://github.com/SWE-agent/mini-swe-agent |

---

## Bottom Line

SWE-agent proves that **interface design matters as much as model capability**.

**Why it matters**:
- State-of-the-art bug fixing (77.4% on SWE-bench Verified)
- The ACI concept is fundamental for agent design
- Mini-SWE-Agent shows simplicity can win
- Real-world adoption by major companies

**The key insight**: You don't just need a better LLM - you need a better interface for the LLM to interact with the world. SWE-agent's ACI design dramatically improves agent performance compared to naive approaches.

For our repository, SWE-agent represents the research frontier of AI-assisted development - showing what's possible when you design systems specifically for LLM agents.

---

*Document created: January 2026*
*Sources: [GitHub - SWE-agent](https://github.com/SWE-agent/SWE-agent), [arXiv 2405.15793](https://arxiv.org/abs/2405.15793), [SWE-agent Documentation](https://swe-agent.com/)*
