A scientific Python toolkit for agent-based economic modeling: build models from modular blocks, solve them with deep learning or classical numerical methods, and simulate.
📖 Documentation · Quickstart · Examples · API Reference
import skagent as ska
from skagent.models.consumer import cons_problem, calibration
# `cons_problem` is a prebuilt consumption-saving model. Supply a decision
# rule for the control `c` and simulate a population of agents forward.
simulator = ska.MonteCarloSimulator(
calibration=calibration,
block=cons_problem,
dr={"c": lambda m: 0.9 * m},
initial={"k": 1.0},
agent_count=1000,
T_sim=50,
seed=42,
)
simulator.initialize_sim()
history = simulator.simulate()The Quickstart goes further, solving the model for an optimal policy instead of hand-coding a rule.
scikit-agent is a scientific Python toolkit for agent-based economic modeling and multi-agent systems design. It provides a unified interface for creating, solving, and simulating economic models using modern computational methods — including deep learning — alongside more traditional numerical techniques.
Our goal is for scikit-agent to be for computational social science what
scikit-learn is for machine learning.
- 🧱 Modular modeling system. Construct multi-agent environments from composable blocks of structural equations.
- ⚡ Solution algorithms. Solve models with deep-learning methods (following Maliar, Maliar, and Winant, 2021), value backwards induction, and reinforcement learning via Stable-Baselines3.
- 📊 Simulation tools. Generate synthetic data and run policy experiments with a Monte Carlo engine.
- 🐍 Built on Scientific Python and PyTorch for easy integration with the wider Python ecosystem.
pip install scikit-agentFor a development installation:
git clone https://github.com/scikit-agent/scikit-agent.git
cd scikit-agent
pip install -e ".[dev,docs]"See the documentation for the user guide, a gallery of runnable examples, and the full API reference.