AgentFarm — a research workbench for agent-based simulation.
Python-first tools for agent-based modeling, reinforcement learning, and emergent-behavior research. Build environments, run experiments, and persist structured data for reproducible analysis.
What's in the box
Composable primitives for simulation, learning, and analysis — wired together with structured logging and reproducible run artifacts.
Agent-based modeling
Compose adaptive agents, environments, and rules. Track interactions, resources, and emergent dynamics over time.
ArchitectureReinforcement learning
PyTorch + Tianshou-backed decision modules with prioritized experience replay and evolvable hyperparameters.
Deep Q-learningHyperparameter evolution
Genetics-inspired chromosomes for learning hyperparameters with mutation, crossover, and adaptive rates.
ChromosomesSpatial indexing
KD-tree, Quadtree, and Spatial Hash Grid backends with dirty-region tracking — thousands of agents, fast.
Spatial indexingData & analysis
Repository-backed databases, behavioral clustering, causal analysis, and experiment-level comparisons.
Data API GeneticsStructured logging
structlog-powered, context-rich, machine-readable logs
with sampling and sensitive-data censoring.
Quick start
Clone the repository, create a virtualenv, install AgentFarm, and run your first simulation.
-
Clone & create a virtualenv
AgentFarm targets Python 3.10+. A virtualenv keeps experiment dependencies isolated.
-
Install in editable mode
Editable installs make it easy to extend agents, environments, or analysis pipelines.
-
Run a simulation
The CLI emits a SQLite
.dbundersimulations/for downstream analysis. -
Open the docs
Browse getting started and the documentation hub.
# 1. Clone git clone https://github.com/Dooders/AgentFarm.git cd AgentFarm # 2. Virtualenv + install python -m venv venv source venv/bin/activate pip install -r requirements.txt pip install -e . # 3. Run a small simulation python run_simulation.py \ --environment development \ --steps 500 # 4. Run the test suite pytest -q
From the devlog
Build notes, design decisions, and experiment outcomes from the AgentFarm team.
-
2026-04-23
Evolving hyperparameter genomes in foraging and learning agents
Each agent carries its own hyperparameter chromosome, offspring inherit it (with mutation and crossover), and selection is whatever the resource environment happens to apply.
-
2026-04-17
DNA-style hyperparameter evolution results
Design and initial outcomes of the genetics-inspired hyperparameter evolution work in AgentFarm.