ABCE: Agent-Based Computational Economics for Macroeconomic Simulation
Agent-Based Computational Economics (ABCE) is a Python library purpose-built for constructing and running agent-based macroeconomic models. Developed at the European Central Bank and maintained as an open-source project, ABCE provides a structured framework for modeling economies as collections of interacting, heterogeneous agents—firms, households, banks, and governments—each following explicit behavioral rules rather than optimizing a representative-agent utility function. This article examines ABCE's core architecture, its production and trade primitives, and how practitioners use it to study emergent macroeconomic phenomena that equilibrium models cannot easily capture.
Why Agent-Based Macroeconomics?
Standard Dynamic Stochastic General Equilibrium (DSGE) models assume a representative agent and rational expectations, which makes them analytically tractable but poorly suited to studying distributional effects, financial contagion, or the consequences of bounded rationality. ABCE takes the opposite approach: each agent is an autonomous object with its own balance sheet, decision rules, and interaction history. Aggregate outcomes—GDP, unemployment, credit cycles—emerge from millions of micro-level transactions rather than being imposed by a market-clearing condition.
ABCE is particularly well-suited to:
- Macroprudential stress testing — simulating how bank capital requirements propagate through credit networks
- Labor market dynamics — modeling search-and-matching with heterogeneous skill levels and wage bargaining
- Supply-chain disruptions — tracing how a shock to one sector cascades through input-output linkages
- Monetary policy transmission — studying how interest rate changes affect firms with different leverage ratios
Core Architecture
ABCE models are organized around three concepts: agents, goods, and messages.
Agents
Every economic actor is a Python class that inherits from abce.Agent. The framework manages each agent's inventory of goods and its log of transactions. Agents run in discrete time steps; within each step, they execute a sequence of actions defined by the modeler.
import abce
class Firm(abce.Agent, abce.Firm):
def init(self, simulation_parameters, agent_parameters):
self.create('labor', 10) # endow with 10 units of labor
self.price = agent_parameters['initial_price']
def produce(self):
self.production_function(
output='good',
inputs={'labor': 5, 'capital': 2},
quantity=100
)
def sell(self):
self.sell('good', quantity=self.possession('good'), price=self.price)
The abce.Firm mixin provides production functions (Cobb-Douglas, Leontief, or custom), while abce.Household provides utility-maximizing consumption routines. Agents never share memory directly; all interaction passes through ABCE's message-passing layer.
Goods and Balance Sheets
ABCE tracks every agent's holdings of every good in a centralized ledger. Calling self.possession('good') returns the current stock; self.create() and self.destroy() adjust it. This design prevents double-counting and makes it straightforward to audit aggregate supply at any time step.
Markets and Trade
ABCE ships with a built-in matching market mechanism. Sellers post offers; buyers post bids; the market clears according to a configurable matching rule (random, price-priority, or quantity-priority). After clearing, ABCE automatically transfers goods and money between agents and logs every transaction.
class Market(abce.Agent):
def __init__(self):
self.market = abce.Market('good', matcher='price_priority')
def clear(self):
self.market.clear()
For bilateral trade outside a centralized market, agents use self.send() and self.receive() to exchange offers and acceptances, giving modelers full control over negotiation protocols.
Running a Simulation
ABCE simulations are orchestrated by a Simulation object that instantiates agent populations, wires up the action sequence, and advances the clock:
sim = abce.Simulation(name='macro_model')
firms = sim.build_agents(Firm, 'firm', 10, parameters=firm_params)
households = sim.build_agents(Household, 'household', 100, parameters=hh_params)
for round in sim.next_round():
firms.produce()
firms.sell()
households.buy()
households.consume()
sim.advance_round(round)
sim.finalize()
ABCE logs every action to a SQLite database by default, enabling post-hoc analysis with pandas or any SQL client. The abce.gui module provides a lightweight web dashboard for monitoring aggregate variables in real time.

Parallelism and Scale
ABCE uses Python's multiprocessing module to distribute agents across CPU cores. Each agent group runs in its own process; inter-group communication is serialized through shared queues. For models with tens of thousands of agents, this architecture delivers near-linear speedup on multi-core workstations. For HPC deployments, ABCE supports MPI via mpi4py, allowing agent populations to span multiple nodes.

Calibration and Validation
ABCE integrates with standard Python scientific libraries. Practitioners typically:
- Calibrate behavioral parameters (e.g., markup rules, savings rates) against micro-level survey data using
scipy.optimizeor Bayesian inference withpymc. - Validate aggregate outputs (GDP growth, Gini coefficient, unemployment rate) against national accounts using
pandasandstatsmodels. - Perform sensitivity analysis by running parameter sweeps with
joblibor connecting ABCE to OpenMole for distributed exploration.
The EURACE model—one of the largest agent-based macroeconomic models ever built—was originally implemented in a framework similar to ABCE and has been used to advise European fiscal policy. ABCE provides a more accessible entry point to the same modeling paradigm.
Practical Considerations
- Stochastic reproducibility: Set
abce.Simulation(seed=42)to fix the random seed for reproducible runs. - Performance profiling: Use
cProfileto identify bottleneck actions before scaling up agent counts. - Data management: For long runs, configure ABCE to write logs in batches (
log_every=10) to reduce I/O overhead. - Visualization: Combine ABCE's SQLite output with
plotlyormatplotlibto produce time-series dashboards of macro aggregates.

Further Resources
- ABCE Documentation — full API reference and tutorials
- ABCE GitHub Repository — source code and example models
- EURACE Model — large-scale macroeconomic ABM built on similar principles
- Agent-Based Models in Economics (Cambridge University Press) — theoretical foundations
- Journal of Artificial Societies and Social Simulation — peer-reviewed ABM research
ABCE occupies a productive niche between toy models and full-scale HPC frameworks. Its explicit balance-sheet accounting, built-in market mechanisms, and seamless integration with the Python scientific stack make it a practical choice for economists and policy analysts who want to move beyond representative-agent assumptions without writing a simulation engine from scratch.