socioverse.abc — the interfaces¶
A study is complete when it implements the first four; Core implements the rest.
EnvironmentProvider¶
socioverse.abc.environment ¶
EnvironmentProvider ABC — the dynamic environment E.
Implementations own the world state and expose the two time channels
- advance_to(t): SCHEDULED/exogenous change (numeric events + information broadcasts)
- apply(actions): ENDOGENOUS feedback E_{t+1} = f(E_t, B_t)
and the per-agent view assembly observe_batch() that materializes the 4 quadrants.
EnvironmentProvider ¶
Bases: ABC
reset
abstractmethod
¶
advance_to
abstractmethod
¶
Apply scheduled numeric events + activate information broadcasts whose at_step <= t and that haven't fired. Returns the events that fired (for logging).
apply
abstractmethod
¶
observe_batch
abstractmethod
¶
Assemble the 4-quadrant Observation per agent. Macro layers are shared verbatim; local layers are filtered by each agent's position/network.
Source code in socioverse/abc/environment.py
agent_state
abstractmethod
¶
PopulationProvider¶
socioverse.abc.population ¶
DecisionModel¶
socioverse.abc.decision ¶
DecisionModel ABC — computes behavior B_t.
decide_batch is the primary method: the engine hands it the WHOLE step (every agent's Observation) at once and expects one Action per agent back. "Batch" describes that interface, not how the LLM is called; the implementation decides the call pattern:
- From-scratch studies (sv-build-model) call the LLM once per agent, sending the step's
per-agent calls concurrently on a bounded thread pool, and parse / fall back per agent
(see
studies/opinion_diffusion/model.py). Do not ask for one JSON reply covering the whole population: long structured replies get truncated and one bad reply fails the step. - Legacy adapters keep the wrapped engine's own call pattern (e.g. the Chicago model's archetype-grouped calls in its two LLM phases) so its validated dynamics are unchanged.
DecisionModel ¶
Bases: ABC
decide_batch
abstractmethod
¶
Compute B_t for every agent of the step; return one Action per agent. memories
maps agent_id -> AgentMemory (per-agent rolling history) for genuinely longitudinal
behavior. How the LLM is called inside is up to the model (see the module docstring).
Source code in socioverse/abc/decision.py
MetricCollector & TrajectoryStore¶
socioverse.abc.trajectory ¶
TrajectoryStore + MetricCollector ABCs (the longitudinal panel + metrics).
TrajectoryStore ¶
Simulator¶
socioverse.abc.simulator ¶
MessageBus¶
socioverse.abc.messaging ¶
MessageBus ABC — the inter-agent communication medium (scenario 2, HiSim).
Agent communication is mediated, NOT O(N^2) direct calls: a post/reply action
lands on the bus (a local-information channel); the next observation delivers it to
the author's network neighbours. A simple in-memory implementation lives in
engine/messaging.py; large-scale backends (DuckDB/Redis) can subclass this.