BPTK API
BPTK API Documentation
Keywords
agent-based modeling, system dynamics, bptk, bptk-py, python, business prototyping
BPTK API
Reference documentation for the classes a modeller works with. These pages deliberately do not list every method of every object — only what you actually use when building and running models.
The API you start with
| bptk | The high-level API: register models and scenarios, run them, plot them, export them. Almost everything goes through here |
| Model | The container for a simulation. Creates the elements of an SD model and holds the agents of an ABM |
| Module | Groups elements so a large SD model can be built from named parts |
System Dynamics elements
All of them share the API documented on Element, including plot() and the arrayed-element methods.
| Element | The base of every SD element — equations, plotting, arrays |
| Stock | What the system remembers: an accumulation with an initial value |
| Flow | The rate at which a stock changes in a timestep |
| Biflow | A flow that may run in either direction |
| Converter | A value derived from other parts of the system, or set at its boundary |
| Constant | A converter that never changes — and what a scenario overrides |
Agent-based modeling
| Agent | The base class for your agents |
| Event | How agents talk to each other |
| DelayedEvent | An event delivered a number of timesteps later |
| Scheduler | Runs the agents, one after another |
| Simultaneous Scheduler | Runs them as if they acted at the same instant |
| DataCollector | Collects aggregate statistics per agent type and state |
| AgentDataCollector | Collects every individual agent’s properties |
| CSVDataCollector | Writes the results to CSV files instead of memory |
Scenarios and the server
| SimulationScenario | One configured run of a model |
| BptkServer | The REST API — endpoints, requests and responses |
| ExternalStateAdapter | The interface for keeping server state outside the process |
| State Adapters | The three that ship: file, Postgres and Redis |