欣淇
发布于 2026-05-10 / 0 阅读
0
0

🛠 SWE-agent:19k Stars 的 AI 程序员,扔个 GitHub Issue 它自动帮你修好

🛠 SWE-agent:19k Stars 的 AI 程序员,扔个 GitHub Issue 它自动帮你修好

你有没有遇到过这种情况:GitHub 仓库里躺着一个 Issue —— "修复这个 bug"、"优化那个功能" —— 你一看,代码改起来倒不难,但手头正在忙别的事,懒得切上下文。别问为啥,我经常因为这个拖一周。

SWE-agent 就是来解决这个痛点的。它来自 Princeton + Stanford 的研究团队,NeurIPS 2024 接收论文 —— 你把自己的 LLM(GPT-4o、Claude Sonnet 4 随便选)接进去,扔一个 GitHub Issue 链接,它就自己把 repo 拉下来、分析代码、改代码、提交 patch,全程不需要你动手。

项目数据

  • ⭐ 19,179 Stars | 🍴 2,067 Forks | 🐍 Python
  • 📄 MIT 协议 | 最新版本 1.0
  • 🏆 SWE-bench Verified 开源项目 SoTA
  • ⚙️ 核心思路:Agent-Computer Interface

    SWE-agent 的卖点不是"帮你写代码",而是给 LLM 提供了一套完整的工具接口 —— 读文件、搜索代码、执行命令、git diff —— 让模型自己决定怎么修 bug。不是翻译 README 的那种套壳,是真·自治 agent。

    最骚的是,你只需要三条命令就能跑起来:

    git clone https://github.com/SWE-agent/SWE-agent.git
    cd SWE-agent
    pip install --editable .
    

    然后配一下 API key(选一个就行):

    export ANTHROPIC_API_KEY=<你的 key>
    # 或
    export OPENAI_API_KEY=<你的 key>
    

    搞定之后,扔一个 Issue 给它:

    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
    

    它就会自动拉 repo、设环境、分析代码、修 bug、出 patch。整个过程在 Docker 沙箱里运行,安全干净。

    🔐 不只是修 bug

    SWE-agent 还跑出了 EnIGMA 模式 —— 做攻防安全的 CTF(Capture The Flag)挑战,也在多个安全 benchmark 上拿了 SoTA。同一个框架,修代码和挖洞都能干。

    当然,开发团队现在主推的是 Mini-SWE-Agent(100 行 Python 实现 SWE-bench Verified 65%),SWE-agent 更多是做研究和跑 benchmark 的主力。

    要点总结:

  • 装好只需 git clone + pip install,API key 配一次就行
  • 一行命令修 GitHub Issue,Docker 沙箱隔离运行
  • 支持 Claude / GPT-4o / 任意 LLM,模型可插拔
  • 学术项目、MIT 协议、可商用、可改
  • 想轻量可以切 Mini-SWE-Agent

  • 🛠 SWE-agent: 19k Stars AI Coder — Drop a GitHub Issue, It Fixes It Automatically

    Ever had that moment? A GitHub Issue sits in your repo — "fix this bug", "refactor that module" — and you keep putting it off because switching context feels like a hassle. I know the feeling.

    SWE-agent is built for exactly this. A NeurIPS 2024 paper from Princeton + Stanford, it lets your LLM of choice (GPT-4o, Claude Sonnet 4, whatever) autonomously fix real GitHub issues. It clones the repo, analyzes the code, applies patches — all without you touching the keyboard.

    Key numbers: ⭐ 19,179 Stars | 🍴 2,067 Forks | 🐍 Python | MIT License

    The idea: Instead of a chatbot that talks about code, SWE-agent gives the LLM real tools — read files, search code, run commands, git diff — so it can actually do the debugging. No fluff, just agent-computer interface.

    Quick start:

    git clone https://github.com/SWE-agent/SWE-agent.git
    cd SWE-agent
    pip install --editable .
    export ANTHROPIC_API_KEY=<your key>
    

    Then fix an issue with one command:

    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
    

    Runs inside a Docker sandbox. Clean, safe, and state-of-the-art on SWE-bench.

    Also does cybersecurity CTFs via EnIGMA mode.

    Bottom line: If you're tired of manually fixing every GitHub issue in your open-source repo, SWE-agent is the closest thing to hiring AI intern who actually commits. Try Mini-SWE-Agent for a lighter version.


    评论