An autonomous AI agent conducts Agent-Based Modelling (ABM) research. It modifies the model, sweeps the parameter space, hunts for emergent properties, forms and tests hypotheses, and writes reports — all without human intervention. You point it at program.md and go to sleep. —adapted from @karpathy/autoresearch, March 2026.
The repo has three files that matter:
prepare.py— fixed harness. Importstrain.py, builds a parameter grid fromSWEEP_AXES, runs the sweep within the 5-minute time budget, prints a structured summary. Do not modify.train.py— the single file the agent edits. Contains the Mesa model, agent rules, sweep axes, and therun_and_measure()function. Everything is fair game: topology, agent behaviour, metrics, parameter ranges.program.md— instructions for the agent. Point your agent here and let it go.
The agent's loop: read run_results.json → form a hypothesis → edit train.py → git commit → uv run prepare.py > run.log 2>&1 → read summary → keep or discard → repeat.
Requirements: Python 3.10+, uv.
# 1. Install uv (if needed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# 2. Install dependencies
uv sync
# 3. Run a single sweep manually (~5 min)
uv run prepare.pyHi, have a look at program.md and let's kick off a new experiment! Let's do the setup first.
The agent will propose a branch, run the baseline, and then loop autonomously.
prepare.py — fixed sweep harness (do not modify)
train.py — Mesa model + sweep definition (agent modifies this)
program.md — agent instructions
pyproject.toml — dependencies
analysis.ipynb — notebook to visualise results after a run
results.tsv — experiment log (untracked by git)
run_results.json— full sweep data from latest run (untracked by git)
report_*.md — periodic scientific reports written by the agent
- Fixed time budget. Every run gets exactly 5 minutes of wall-clock simulation time. This makes experiments directly comparable regardless of model complexity.
- Full-factorial sweep.
prepare.pybuilds a grid fromSWEEP_AXESdefined intrain.pyand shuffles it, so partial runs still sample evenly. - Open-ended metric. Unlike the LLM pretraining version, there is no single number to minimise. The agent is a scientist: it looks for structure, forms hypotheses, and tests them.
primary_metricis a convenience handle for correlation analysis, not a loss function. - Single file to modify. The agent only touches
train.py, keeping diffs small and reviewable. - Git-tracked model, not results.
results.tsvandrun_results.jsonstay untracked. The git history is a clean record of model changes.
This is adapted from karpathy/autoresearch, which applies the same autonomous loop to LLM pretraining hyperparameter search. The core insight — fix the time budget, let the agent iterate freely, keep or discard — transfers directly to ABM research.