scikit-agent

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.

Key Features

  • 🧱 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.

Installation

uv add scikit-agent

Or, outside a uv project, uv pip install scikit-agent (or plain pip install scikit-agent).

For a development installation (uv required):

git clone https://github.com/scikit-agent/scikit-agent.git
cd scikit-agent
uv sync --extra test --extra docs

See the documentation for the user guide, a gallery of runnable examples, and the full API reference.

Quick Example

import skagent as ska
from skagent.models.consumer import cons_problem, calibration

# A consumption-saving model: a consumption block chained with a
# tick block that carries end-of-period assets into next period's
# capital. The simulator constructs the shock distributions from
# the calibration internally.
model = cons_problem

# Define simple decision rule
decision_rules = {"c": lambda m: 0.9 * m}

# Run simulation
simulator = ska.MonteCarloSimulator(
    calibration=calibration,
    block=model,
    dr=decision_rules,
    initial={"k": 1.0},
    agent_count=1000,
    T_sim=50,
)

simulator.initialize_sim()
results = simulator.simulate()

Next Steps

New to scikit-agent? Start with the Quickstart Guide guide.

Want to dive deeper? Check out:

Community & Support