socioverse.env_layers — information-axis helpers¶
Reusable building blocks for the information side of E: audience-scoped broadcasts and the neighbour feed.
Broadcast delivery¶
socioverse.env_layers.information ¶
InformationEnvironment — reusable machinery for the information axis of E.
Activates audience-scoped Broadcasts over time and renders them into the
macro_information / local_information quadrants. A study's EnvironmentProvider composes
one of these and supplies a matcher(selector, agent_ctx) -> bool for local audiences
(Chicago: a TractSelector-aware matcher; default: a generic attribute matcher).
Scenario 1 (policy A to all + policy B to a tract at step n) is two Broadcasts: Broadcast(content=A, audience="all", at_step=n) -> macro_information for everyone Broadcast(content=B, audience={...tract...}, at_step=n) -> local_information for matches
InformationEnvironment ¶
InformationEnvironment(
program: InformationProgram | None = None,
matcher: Callable[[dict, dict], bool] | None = None,
)
Source code in socioverse/env_layers/information.py
advance_to ¶
Activate broadcasts firing at t, expire those past their ttl. Returns the newly-activated broadcasts (for event logging).
Source code in socioverse/env_layers/information.py
rendered_lines ¶
Flat text lines visible to an agent (macro + matching local) for LLM prompts.
Source code in socioverse/env_layers/information.py
match_selector ¶
Generic audience matcher over an agent context dict. Supported selector keys:
- "
Source code in socioverse/env_layers/information.py
Neighbour feed¶
socioverse.env_layers.neighbor_feed ¶
NeighborFeed — local-information from agent-to-agent messages (scenario 2, HiSim).
Wraps a MessageBus + a neighbours() lookup to turn other agents' post/reply actions
into each agent's local_information quadrant. Mediated delivery (not O(N^2) direct calls):
posts land on the bus; observers read only their network neighbours' messages.
NeighborFeed ¶
Source code in socioverse/env_layers/neighbor_feed.py
ingest ¶
Route message-like actions (kind in {post, reply}) onto the bus. Returns the
message dicts (for persistence in the DuckDB messages table).
Source code in socioverse/env_layers/neighbor_feed.py
News broadcast helpers¶
socioverse.env_layers.news_broadcast ¶
Standard information-layer declarations + convenience constructors.
The two-axis system means a "macro news broadcast" and a "local ward notice" are the
SAME mechanism (an audience-scoped Broadcast) differing only in audience. These helpers
give studies ready-made EnvironmentLayer declarations and Broadcast builders so the
information axis is one import away.
default_information_layers ¶
A macro news channel + a local neighbour/ward channel.
Source code in socioverse/env_layers/news_broadcast.py
macro_news ¶
macro_news(
message_id: str,
content: str,
at_step: int,
ttl: int = 1,
channel: str = "news",
) -> Broadcast
A broadcast delivered to EVERY agent's macro_information.
Source code in socioverse/env_layers/news_broadcast.py
local_notice ¶
local_notice(
message_id: str,
content: str,
at_step: int,
audience: dict[str, Any],
ttl: int = 1,
channel: str = "neighbor_feed",
) -> Broadcast
A broadcast delivered only to agents matching audience (local_information).