Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsApr 6, 2026·3 min de lecture

SWE-agent — Automated Bug Fixing with AI Agents

AI agent system from Princeton NLP that autonomously fixes GitHub issues. Navigates codebases, writes patches, and submits pull requests. Resolves 12% of real-world SWE-bench tasks. 15,000+ stars.

Introduction

SWE-agent is an AI agent system from Princeton NLP that autonomously resolves real-world GitHub issues with 15,000+ GitHub stars. Give it an issue URL and it clones the repository, navigates the codebase, identifies the bug, writes a patch, and validates the fix — achieving 12.5% on the SWE-bench benchmark of real-world software engineering tasks. It uses a custom Agent-Computer Interface (ACI) designed specifically for code navigation and editing. Best for researchers studying AI coding capabilities and teams experimenting with automated bug fixing. Works with: Claude, GPT-4. Setup time: under 5 minutes.


How It Works

1. Issue Analysis

SWE-agent reads the GitHub issue and understands:

  • What is broken
  • Expected vs actual behavior
  • Relevant error messages and stack traces

2. Codebase Navigation

Using its Agent-Computer Interface (ACI):

# The agent navigates like a developer
find_file "auth_handler.py"
open_file "src/auth/auth_handler.py"
search_file "validate_token"
goto_line 145

3. Bug Identification

The agent reads relevant code, traces the logic, and pinpoints the issue:

Analyzing: src/auth/auth_handler.py:145
Issue: Token expiry check uses UTC timestamp but comparison uses local time
Fix: Convert both to UTC before comparison

4. Patch Generation

Writes and applies the fix:

# Before
if token.expiry < datetime.now():

# After (SWE-agent fix)
if token.expiry < datetime.now(timezone.utc):

5. Validation

Runs existing tests to verify the fix:

Running test suite...
test_auth_valid_token: PASS
test_auth_expired_token: PASS (was FAIL)
test_auth_refresh: PASS
All tests passing.

Agent-Computer Interface (ACI)

Custom commands designed for code navigation:

Command Action
find_file Search for files by name
open_file Open and display file content
search_file Search within current file
search_dir Search across directory
goto_line Jump to specific line
edit Edit lines in current file
submit Submit the patch

SWE-bench Results

Model Resolve Rate
Claude Sonnet 12.5%
GPT-4 10.3%
GPT-3.5 3.8%

Key Stats

  • 15,000+ GitHub stars
  • Princeton NLP research
  • 12.5% SWE-bench resolve rate
  • Custom Agent-Computer Interface
  • Supports Claude and GPT-4

FAQ

Q: What is SWE-agent? A: SWE-agent is an AI system from Princeton NLP that autonomously fixes real-world GitHub issues by navigating codebases, writing patches, and validating fixes.

Q: Is SWE-agent free? A: Yes, open-source under MIT license. You need LLM API keys.

Q: Can SWE-agent fix any bug? A: It resolves about 12.5% of real-world software engineering tasks. It works best on well-specified bugs with clear reproduction steps.


🙏

Source et remerciements

Created by Princeton NLP. Licensed under MIT.

SWE-agent — ⭐ 15,000+

Thanks to Princeton NLP for advancing the frontier of automated software engineering.

Discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires