agent-mini
v0.7.0 · MIT · Python 3.11+

A small AI agent you can read in an afternoon

Agent Mini runs shell commands, edits files, searches the web and remembers things. It is tuned for small models running on your own machine, and it works with any OpenAI-compatible API too.

~3,100lines of Python
3dependencies: httpx, click, rich
10built-in tools, plus your plugins
97%eval pass rate on a 4B model
$ pip install agent-mini
$ ollama pull qwen3.5:9b    # or qwen3.5:4b on a smaller machine
$ agent-mini init           # writes ~/.agent-mini/config.json
$ agent-mini chat

agent-mini init turns on approval for the shell and file edits. agent-mini doctor checks the provider, model and setup if something doesn't work.

Demo

Ask, check the diff, undo

Agent Mini adding "buy milk" to todo.txt: it reads the file, asks for approval and shows the diff, edits the file, and /undo puts it back.
With approval on, the agent reads todo.txt, shows the diff before it edits, and /undo puts the file back. qwen3.5:9b on Ollama; pauses longer than 3 seconds are trimmed.
Built for small models

Measured on 36 real tasks, not guessed

Small models make their own kind of mistakes: paths that start with /, renames done by copying, edits that lose tabs. Agent Mini is tuned against an eval harness of 36 tasks, each run three times. Every fix came from reading the transcripts of the runs that failed.

Ollama on an M4 Pro (48 GB), measured 2026-10-14. Each tile's bars start at zero.

Show as a table
Per task4b · v0.4.04b · v0.59b · v0.4.09b · v0.5
Pass rate88.0% (95/108)97.2% (105/108)97.2% (105/108)96.3% (104/108)
Tasks passed in all 3 runs27/3634/3634/3634/36
Tool calls3.02.32.72.2
Seconds10.35.811.49.5
Prompt tokens6,6085,1216,2754,831
Timeouts3000

Full results, per category and per candidate →

Paths that start with /

Small models write /config.json for a file in the workspace. Each "Access denied" cost them three or four calls, so these paths now resolve inside the workspace. /etc/hosts is still refused.

No blind overwrites

A 9B model "appended" to a script by writing only the new line. write_file now refuses to replace a file the agent hasn't read.

Edits that keep tabs

Fuzzy matching used to strip tabs, which broke Makefiles. Edits now keep them, and 4B robustness went to 12 of 12.

Tools

Ten tools, plus your own

  • shellRuns a command in the workspace
  • read_fileReads a file, or part of one
  • write_file, edit_fileCreates files and edits them in place
  • list_filesFinds files by glob
  • search_filesSearches file contents
  • web_search, web_fetchSearches DuckDuckGo and fetches pages
  • remember, recallSaves facts across sessions and searches them

To add a tool, drop a .py file that defines TOOL_DEF and handler into ~/.agent-mini/plugins/:

from datetime import datetime, timezone

TOOL_DEF = {
    "type": "function",
    "function": {
        "name": "get_timestamp",
        "description": "Get the current UTC timestamp.",
        "parameters": {"type": "object", "properties": {}, "required": []},
    },
}

async def handler(arguments: dict) -> str:
    return datetime.now(timezone.utc).isoformat()

Put an AGENTS.md in the workspace to give the agent project instructions, such as build commands or code style.

Safety

Guard rails, in layers

Sandbox

  • workspace (the default) keeps every path inside the workspace.
  • readonly also removes the shell and file-writing tools.
  • unrestricted allows any path.

Approval

  • Tools in tools.confirm ask before they run. agent-mini init adds the shell and file edits.
  • Press d at the prompt to see the diff first.
  • /undo reverts the last file change.

Guards

  • Commands like rm -rf and sudo are blocked.
  • The shell doesn't get environment variables that look like secrets.
  • web_fetch refuses private addresses.

The guards reduce risk, but they aren't a security boundary. Approval is the real control. Without tools.confirm, the agent runs commands and edits files without asking.

Models

Local first, any OpenAI-compatible API

ProviderUse it for
ollamaOllama, the default
openaiOpenAI, with a key from the config or the environment
localLM Studio, vLLM, llama.cpp or any OpenAI-compatible server

Tuned and measured on qwen3.5:4b and qwen3.5:9b. They are 3.4 GB and 6.6 GB downloads. Bigger and cloud models get a larger budget for rounds and context.

Settings live in ~/.agent-mini/config.json, and everything has a default. config.example.json lists every setting.

Learn

Read how it works