mini-swe-agent README

项目的 README,来自 github.com/SWE-agent/mini-swe-agent。合并为一个 markdown 文件:README.md。

mini-swe-agent banner

The minimal AI software engineering agent

📣 mini-swe-agent now powers Ramp SWE-Bench
📣 mini-swe-agent beats Claude Code and Codex on DeepSWE
📣 Run mini-swe-agent on our new & extremely challenging benchmark, ProgramBench
📣 New tutorial on building minimal AI agents

Docs Slack PyPI - Version

[!WARNING] This is mini-swe-agent v2. Read the migration guide. For the previous version, check out the v1 branch.

In 2024, we built SWE-bench & SWE-agent and helped kickstart the coding agent revolution.

We now ask: What if our agent was 100x simpler, and still worked nearly as well?

mini is

More motivation (for research)

SWE-agent jump-started the development of AI agents in 2024. Back then, we placed a lot of emphasis on tools and special interfaces for the agent. However, one year later, as LMs have become more capable, a lot of this is not needed at all to build a useful agent! In fact, the mini agent

  • Does not have any tools other than bash — it doesn't even need to use the tool-calling interface of the LMs. This means that you can run it with literally any model. When running in sandboxed environments you also don't need to take care of installing a single package — all it needs is bash.
  • Has a completely linear history — every step of the agent just appends to the messages and that's it. So there's no difference between the trajectory and the messages that you pass on to the LM. Great for debugging & fine-tuning.
  • Executes actions with subprocess.run — every action is completely independent (as opposed to keeping a stateful shell session running). This makes it trivial to execute the actions in sandboxes (literally just switch out subprocess.run with docker exec) and to scale up effortlessly. Seriously, this is a big deal, trust me.

This makes it perfect as a baseline system and for a system that puts the language model (rather than the agent scaffold) in the middle of our attention. You can see the result on the SWE-bench (bash only) leaderboard, that evaluates the performance of different LMs with mini.

More motivation (as a tool)

Some agents are overfitted research artifacts. Others are UI-heavy frontend monsters.

The mini agent wants to be a hackable tool, not a black box.

  • Simple enough to understand at a glance
  • Convenient enough to use in daily workflows
  • Flexible to extend

Unlike other agents (including our own swe-agent), it is radically simpler, because it:

  • Does not have any tools other than bash — it doesn't even need to use the tool-calling interface of the LMs. Instead of implementing custom tools for every specific thing the agent might want to do, the focus is fully on the LM utilizing the shell to its full potential. Want it to do something specific like opening a PR? Just tell the LM to figure it out rather than spending time to implement it in the agent.
  • Executes actions with subprocess.run — every action is completely independent (as opposed to keeping a stateful shell session running). This is a big deal for the stability of the agent, trust me.
  • Has a completely linear history — every step of the agent just appends to the messages that are passed to the LM in the next step and that's it. This is great for debugging and understanding what the LM is prompted with.
Should I use SWE-agent or mini-SWE-agent?

You should consider mini-swe-agent your default choice. In particular, you should use mini-swe-agent if

  • You want a quick command line tool that works locally
  • You want an agent with a very simple control flow
  • You want even faster, simpler & more stable sandboxing & benchmark evaluations
  • You are doing FT or RL and don't want to overfit to a specific agent scaffold

You should use swe-agent if

  • You want to experiment with different sets of tools, each with their own interface
  • You want to experiment with different history processors

What you get with both

  • Excellent performance on SWE-Bench
  • A trajectory browser
CLI (mini) Batch inference

mini

swebench

Trajectory browser Python bindings

inspector

agent = DefaultAgent(
    LitellmModel(model_name=...),
    LocalEnvironment(),
)
agent.run("Write a sudoku game")

Let's get started!

Option 1: If you just want to try out the CLI (package installed in anonymous virtual environment)

pip install uv && uvx mini-swe-agent
# or
pip install pipx && pipx ensurepath && pipx run mini-swe-agent

Option 2: Install CLI & python bindings in current environment

pip install mini-swe-agent
mini  # run the CLI

Option 3: Install from source (developer setup)

git clone https://github.com/SWE-agent/mini-swe-agent.git
cd mini-swe-agent && pip install -e .
mini  # run the CLI

Read more in our documentation:

Attribution

If you found this work helpful, please consider citing the SWE-agent paper in your work:

@inproceedings{yang2024sweagent,
  title={{SWE}-agent: Agent-Computer Interfaces Enable Automated Software Engineering},
  author={John Yang and Carlos E Jimenez and Alexander Wettig and Kilian Lieret and Shunyu Yao and Karthik R Narasimhan and Ofir Press},
  booktitle={The Thirty-eighth Annual Conference on Neural Information Processing Systems},
  year={2024},
  url={https://arxiv.org/abs/2405.15793}
}

Our other projects:

SWE-agent    SWE-ReX    SWE-bench    SWE-smith    CodeClash    sb-cli

mini-swe-agent (SWE-agent/mini-swe-agent)

正在搜索数据库…

这是什么?mini-swe-agent 是一个极简的 AI 软件工程智能体,用约 100 行 Python 代码编写,能够自主解决 GitHub issue,或在命令行中为你提供协助,在 SWE-bench verified 上的得分超过 74%。
这是命令行工具,还是可以作为库导入的东西?两者兼有:你既能得到一个命令行工具(mini CLI),也能得到可以直接导入到自己脚本或研究流程中的 Python 绑定。
我该如何让它运行起来?有三种安装方式:在隔离的虚拟环境中立即试用,将 CLI 和 Python 绑定安装到当前环境中,或从源代码安装以进行开发者配置。详见快速开始指南。
这个工具可以搭配哪些 LLM 服务商使用?任何可以通过 litellm、openrouter 或 portkey 访问的模型,包括那些只支持 /completion 或 /response 端点以及交错思考的模型。它不需要工具调用功能。
这个智能体除了 shell 之外还会使用其他工具吗?不会。它刻意只使用 bash 这一种工具,因此适用于任何模型,也永远不需要工具调用接口;它所做的一切都必须通过 shell 完成。
我可以在沙箱或容器中运行它吗?可以。它支持部署到本地环境、Docker/Podman、Singularity/Apptainer、Bubblewrap 等更多环境,因为每个操作都以独立的 subprocess.run 调用运行,很容易替换为 docker exec 之类的方式。
mini-swe-agent 与最初的 SWE-agent 有什么不同?SWE-agent 为研究实验提供自定义工具和可插拔的历史处理器,而 mini-swe-agent 则去掉了这些内容,成为一个极其简化的、使用单一线性历史、仅依赖 bash 的智能体,旨在成为你日常的默认工具。
为什么这个智能体始终保持完全线性的历史记录?每一步都只是把内容追加到发送给模型的消息日志中,因此执行轨迹和提示词完全一致,这让调试、微调和强化学习训练都变得简单直接。
谁已经在使用 mini-swe-agent?据报道,Meta、NVIDIA、Essential AI、IBM、Nebius、Anyscale、普林斯顿大学和斯坦福大学的团队都在使用它。
它是否提供查看智能体所做操作的方法?有的。mini-swe-agent 和 SWE-agent 都自带轨迹浏览器,方便你在运行结束后查看智能体的每个步骤。
作者
SWE-agent
大小
19.8 MB
星标
9.7K
时长
1年
提交 · 90 天