Interface Contracts
Interface contracts define the inputs and outputs of a model, allowing it to participate in federated simulations. If you only need a standalone model, you can skip this — it's for connecting multiple models together.
Why Interfaces?
When you build a simulation project (multiple models working together), each model is a black box. The interface contract declares:
- Input ports — Values the model receives from outside (bound to scenario parameters)
- Output ports — Values the model exposes to other models (bound to data collectors or properties)
Adding Ports
In the left panel, the Interface Contract section appears when no archetype is selected. Click + to add input or output ports.
Each port has:
- Name — Identifier used in the simulation graph
- Type — int, float, bool, or str
- Binding — What internal value the port connects to
Input Bindings
Input ports bind to scenario parameters. When another model sends a value to your input port, it sets the corresponding scenario parameter before each step.
Output Bindings
Output ports can bind to:
- Data collectors — Aggregated metrics (e.g., average energy)
- Scenario parameters — Current model settings
- Archetype properties — Per-agent values (e.g., Predator.energy)
Version Tracking
The contract has a version number that increments when ports change. Simulation projects that reference your model will detect when the contract is stale and prompt to refresh.