API Reference
This section provides detailed documentation for all AMBER classes, functions, and modules.
Core Components
Utilities
Advanced (0.4 / 0.4.1 / 0.4.3 / 0.4.4)
Quick Reference
Core Classes:
ambr.Model- Base class for all agent-based modelsambr.Agent- Individual agent with behaviors and propertiesambr.BaseAgent- Abstract base class for custom agentsambr.BaseModel- Abstract base class for custom modelsambr.Population- SoA memory manager for high-performance state handlingambr.RunResults- Dict-likemodel.run()result with attribute access
Environments:
ambr.GridEnvironment- 2D grid-based spatial environmentambr.SpaceEnvironment- Continuous 2D space environmentambr.NetworkEnvironment- Graph/network-based environment
Data Structures:
ambr.AgentList- List-like container for agents with additional functionality
Optimization:
ambr.grid_search()- Exhaustive parameter space searchambr.random_search()- Random parameter samplingambr.bayesian_optimization()- Bayesian optimization of model parameters
Experiments:
ambr.Experiment- Framework for running multiple model configurationsambr.Sample- Parameter sampling for experimentsambr.IntRange- Integer range specification for parameters
Snapshot-view contract (0.4 / 0.4.4):
ambr.contract.ContractCertificate- Per-step operational monitor record frommodel.run(contract=...)(not a schedule proof)
Tensor lane (0.4):
ambr.tensor_lane.borrow_numeric()- Zero-copy borrow of a numeric columnambr.tensor_lane.commit_columns()- Atomic write-back of derived columns
Speed lanes (0.4.1):
ambr.print_status()/ambr.recommend()- machine/lane status and hintsambr.ArrayKernelModel- single-run CuPy/NumPy array modelOptional
pip install 'ambr[perf]'(Numba) for CPU scatter JIT
Device placement & lanes (0.4.3 / 0.4.4):
ambr.Model.cpu()/ambr.Model.gpu()- Keras-style placement;step_vectorized/step_oopdispatch (GPU is vectorized-only; see GPU backend, Going faster (lanes))ambr.Model.approve_fast_path()/ambr.Model.revoke_fast_path_approval()- opt-in private GPU loop with caller-supplied evidence labelambr.EXECUTION_DEVICES/EXECUTION_MODES/ExecutionConfig- placement constants (package exports)
GPU & calibration (0.4):
ambr.gpu.get_array_module()- Resolve the CuPy/NumPy array moduleambr.GPUEnsembleRunner- Batched (B × N) ensemble runner (NumPy fallback in CI)ambr.BatchedWellMixedSIR- Reference well-mixed SIR batched modelambr.smac_batch_calibrate()- SMAC calibration over a batched ensemble