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.
$ 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.
Ask, check the diff, undo
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.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 task | 4b · v0.4.0 | 4b · v0.5 | 9b · v0.4.0 | 9b · v0.5 |
|---|---|---|---|---|
| Pass rate | 88.0% (95/108) | 97.2% (105/108) | 97.2% (105/108) | 96.3% (104/108) |
| Tasks passed in all 3 runs | 27/36 | 34/36 | 34/36 | 34/36 |
| Tool calls | 3.0 | 2.3 | 2.7 | 2.2 |
| Seconds | 10.3 | 5.8 | 11.4 | 9.5 |
| Prompt tokens | 6,608 | 5,121 | 6,275 | 4,831 |
| Timeouts | 3 | 0 | 0 | 0 |
/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.
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.
Fuzzy matching used to strip tabs, which broke Makefiles. Edits now keep them, and 4B robustness went to 12 of 12.
Ten tools, plus your own
shellRuns a command in the workspaceread_fileReads a file, or part of onewrite_file,edit_fileCreates files and edits them in placelist_filesFinds files by globsearch_filesSearches file contentsweb_search,web_fetchSearches DuckDuckGo and fetches pagesremember,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.
Guard rails, in layers
Sandbox
workspace(the default) keeps every path inside the workspace.readonlyalso removes the shell and file-writing tools.unrestrictedallows any path.
Approval
- Tools in
tools.confirmask before they run.agent-mini initadds the shell and file edits. - Press d at the prompt to see the diff first.
/undoreverts the last file change.
Guards
- Commands like
rm -rfandsudoare blocked. - The shell doesn't get environment variables that look like secrets.
web_fetchrefuses 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.
Local first, any OpenAI-compatible API
| Provider | Use it for |
|---|---|
ollama | Ollama, the default |
openai | OpenAI, with a key from the config or the environment |
local | LM 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.