mini-swe-agent
A radically simple, ~100-line Python AI software engineering agent that solves tasks using only bash.
Repository Health
Technical Analysis
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
minicommand-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.
Used by 2 apps in this directory
CubeSandbox
Developer Tools · Security · AI Agents
Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.
GitNexus
Developer Tools · AI Code Assistants
Index any codebase into an interactive knowledge graph and give your AI agents deep architectural context via MCP — with zero servers required.