Agentpy - Agent-based modeling in Python¶
Agentpy is an open-source library for the development and analysis of agent-based models in Python. The framework integrates the tasks of model design, numerical experiments, and data analysis within a single environment, and is optimized for interactive computing with IPython and Jupyter. If you have questions or ideas for improvements, please visit the discussion forum or subscribe to the agentpy mailing list.
Quick orientation
- To get started, please take a look at Installation and Overview.
- For a simple demonstration, check out the Wealth transfer tutorial in the Model Library.
- For a detailled description of all classes and functions, refer to API Reference.
- To learn how agentpy compares with other frameworks, take a look at Comparison.
Example
A screenshot of Jupyter Lab with two interactive tutorials from the model library:

Main features
Aim 1: Intelligent syntax for complex models
- Custom agent, environment, and network types
- Easy selection and manipulation of agent groups
- Support of multiple environments for interaction
Aim 2: Advanced tools for scientific applications
- Experiments with repeated iterations and parallel processing
- Parameter sampling and scenario comparison
- Output data that can be saved, loaded, and re-arranged
- Sensitivity analysis and (animated) visualizations
Aim 3: Compatibility with established Python libraries
- Interactive computing with Jupyter/IPython
- Data analysis with pandas and SALib
- Network analysis with networkx
- Visualization with seaborn
Table of contents
Indices and tables