Skip to content

About

autoresearch (agent harness) for ABM simulation parameter sweeps

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

36 Commits

Folders and files

Repository files navigation

autoresearch-abm

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.

How it works

The repo has three files that matter:

  • prepare.py — fixed harness. Imports train.py, builds a parameter grid from SWEEP_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 the run_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.

Quick start

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.py

Running the agent

Hi, 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.

File structure

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

Key design choices

  • 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.py builds a grid from SWEEP_AXES defined in train.py and 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_metric is 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.tsv and run_results.json stay untracked. The git history is a clean record of model changes.

Original project

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.

About

autoresearch (agent harness) for ABM simulation parameter sweeps

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages