mini-swe-agent

A radically simple, ~100-line Python AI software engineering agent that solves tasks using only bash.

Framework
PyPI
v2.4.6
6,599stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
84/100Excellent
Development Activity92
Maintenance100
Community68
Maturity36
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
87/100Excellent
Architecture88
Code Quality84
Innovation90
Learning Curve86

mini-swe-agent is a minimal AI software engineering agent built by the Princeton and Stanford team behind SWE-bench and SWE-agent. The core agent is roughly 100 lines of Python: it gives a language model nothing but a bash shell, appends every step to a completely linear message history, and executes each action with an independent subprocess.run call. Despite that simplicity it scores over 74% on the SWE-bench verified benchmark.

It works as both a command-line tool (the mini CLI) and a Python library for building and running agents, and is compatible with essentially any model through litellm, OpenRouter, and Portkey. Because actions are stateless subprocess calls, the same agent runs unchanged across local environments, Docker, Podman, Singularity, and other sandboxes, making it a strong baseline for research, fine-tuning, and everyday coding automation.

What You Get

  • A ~100-line agent core plus small environment, model, and run modules
  • The mini command-line tool for interactive and batch use
  • Python bindings to construct and run agents (DefaultAgent, LocalEnvironment, LitellmModel)
  • Model-agnostic support via litellm, OpenRouter, and Portkey
  • Pluggable execution across local, Docker, Podman, Singularity, and other sandboxes

Common Use Cases

  • Automatically solving GitHub issues or coding tasks from the command line
  • Running large-scale SWE-bench and benchmark evaluations
  • Serving as a simple, non-overfitted baseline for agent research and fine-tuning

Under The Hood

Architecture - The package under src/minisweagent is cleanly split into agents (the ~100-line control loop), environments (local, Docker, and other execution backends), models (litellm-based LLM wrappers), config (YAML agent configs), and run (CLI entry points and batch runners). The design principles are deliberate: only a bash tool, a strictly linear message history equal to the trajectory, and stateless action execution via subprocess.run so swapping in docker exec is trivial.

Tech Stack - Pure Python built on litellm for universal model access, plus pydantic v2, typer for the CLI, textual and rich for the terminal UI, jinja2 for templating, tenacity for retries, and datasets for benchmark data. Packaging is standard pyproject-based with dev/full optional extras.

Code Quality - The project is very actively maintained (over 1,000 commits, 64 releases) with a real test suite under tests/ covering agents, environments, models, and run scripts, plus Codecov-tracked coverage. The intentional minimalism of the agent core keeps the critical path easy to audit and debug.

API Design - The developer experience is a highlight: the CLI is a single mini command, and the Python API is just a few lines (instantiate a model and environment, then agent.run(task)). Extensive documentation, a quickstart, a cookbook, and a trajectory inspector make both casual and advanced usage approachable.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search