Skills2026年4月6日·1 分钟阅读

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.

Agent 就绪

先审查再安装

这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。

Needs Confirmation · 66/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
SWE-agent — Automated Bug Fixing with AI Agents
先审查命令
npx -y tokrepo@latest install ec5f0e4b-ca6b-4379-8ec2-0e0ef63b9fa5 --target codex

先 dry-run,确认写入项后再运行此命令。

TL;DR
SWE-agent autonomously navigates codebases and writes patches to fix GitHub issues.
§01

What it is

SWE-agent is an AI agent system from Princeton NLP that autonomously fixes GitHub issues. Given a bug report or feature request, it navigates the codebase, understands the problem, writes a patch, and submits a pull request. It uses a custom agent-computer interface (ACI) designed for code editing that gives the AI structured commands for file navigation, editing, and testing.

SWE-agent targets research teams studying AI coding capabilities and development teams exploring automated bug fixing. It demonstrates how purpose-built tool interfaces improve AI agent performance on real-world software engineering tasks.

§02

Why it saves time or tokens

SWE-agent's custom ACI reduces the tokens needed for code exploration compared to generic tool-use approaches. Instead of reading entire files, the agent uses structured commands to navigate, search, and edit specific sections. This focused interaction pattern means fewer wasted tokens on irrelevant code and faster convergence on the fix.

§03

How to use

  1. Clone the SWE-agent repository and install dependencies
  2. Configure your LLM API key (OpenAI, Anthropic, etc.)
  3. Point SWE-agent at a GitHub issue and let it attempt a fix
§04

Example

# Run SWE-agent on a GitHub issue
python run.py \
  --model_name claude-sonnet-4-20250514 \
  --data_path issue.json \
  --config_file config/default.yaml

# SWE-agent will:
# 1. Read the issue description
# 2. Explore the repository structure
# 3. Find relevant files
# 4. Write and test a patch
# 5. Submit the fix
ACI CommandPurpose
find_fileLocate files by name
search_dirSearch for text patterns
openView file contents
editModify specific lines
submitPropose the patch
§05

Related on TokRepo

§06

Common pitfalls

  • SWE-agent works best on well-described issues with clear reproduction steps; vague issues produce unreliable patches
  • The agent may propose patches that pass tests but introduce subtle regressions; human review is still essential
  • Running SWE-agent on large repositories with complex build systems increases token costs and reduces success rates

常见问题

What is the success rate of SWE-agent?+

SWE-agent's success rate varies by model and benchmark. On the SWE-bench dataset of real-world GitHub issues, it resolves a meaningful percentage of tasks end-to-end. Success rates improve with more capable models and well-structured issue descriptions. Check the SWE-bench leaderboard for current numbers.

What LLM models does SWE-agent support?+

SWE-agent supports OpenAI GPT-4, Anthropic Claude, and other LLM providers. The choice of model significantly affects performance. More capable models produce better patches. You configure the model in the SWE-agent config file.

Can SWE-agent fix any type of bug?+

SWE-agent performs best on bugs with clear symptoms, error messages, or test failures. It handles code logic bugs, missing error handling, and simple feature additions well. Complex architectural issues, performance bugs, or security vulnerabilities are harder for it to address autonomously.

How does the agent-computer interface (ACI) help?+

The ACI provides structured commands (find, open, edit, search) instead of raw shell access. This constrains the agent's action space, reducing errors and token waste. The ACI also provides formatted output that the AI can parse reliably, improving its ability to navigate large codebases.

Can I use SWE-agent on my private repositories?+

Yes. SWE-agent runs locally and accesses repositories through Git. You clone your private repo, create an issue description file, and point SWE-agent at it. The code and patches stay on your machine. Only the issue description and code diffs are sent to the LLM API.

引用来源 (3)
🙏

来源与感谢

Created by Princeton NLP. Licensed under MIT.

SWE-agent — ⭐ 15,000+

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产