babylon.models.components

Component system for the Babylon Entity-Component architecture.

This package contains the foundational component types that define the material ontology of the simulation:

  • Component: Protocol defining the interface for all components

  • MaterialComponent: Wealth, resources, means of production

  • VitalityComponent: Population, subsistence needs

  • SpatialComponent: Location, mobility

  • MaterialConditionsBuffer: Value-tensor-derived consciousness inputs

  • OrganizationComponent: Cohesion, cadre level

All components are immutable (frozen) Pydantic models that use constrained types from babylon.models.types.

class babylon.models.components.Component(*args, **kwargs)[source]

Bases: Protocol

Protocol defining the interface for all component types.

All components in the Babylon simulation must implement this protocol. The protocol requires a component_type property that returns a string identifier for the component type.

This protocol is runtime-checkable, meaning you can use isinstance() to verify that an object implements the Component interface.

Example

>>> class MyComponent(BaseModel):
...     model_config = ConfigDict(frozen=True)
...     @property
...     def component_type(self) -> str:
...         return "my_component"
...
>>> instance = MyComponent()
>>> isinstance(instance, Component)
True
__init__(*args, **kwargs)
property component_type: str

Return the component type identifier.

Returns:

A string identifying the type of this component. For example: “material”, “vitality”, “spatial”, etc.

class babylon.models.components.MaterialComponent(**data)[source]

Bases: BaseModel

Material conditions of an entity.

Tracks the economic and material state of an entity including: - Accumulated wealth (Currency) - Available resources (Currency) - Control over means of production (Probability)

All values use constrained types for automatic validation: - wealth, resources: Currency [0, inf) - means_of_production: Probability [0, 1]

This component is immutable (frozen) to ensure state integrity.

Parameters:
wealth

Accumulated economic resources (default: 10.0)

resources

Available material resources (default: 0.0)

means_of_production

Control over productive apparatus [0, 1] (default: 0.0)

property component_type: str

Return the component type identifier.

Returns:

The string ‘material’ identifying this component type.

model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

wealth: Annotated[float]
resources: Annotated[float]
means_of_production: Annotated[float]
class babylon.models.components.VitalityComponent(**data)[source]

Bases: BaseModel

Population and survival needs of an entity.

Tracks the demographic and subsistence state of an entity: - Population size (Currency) - Minimum resources required for survival (Currency)

All values use constrained types for automatic validation: - population, subsistence_needs: Currency [0, inf)

This component is immutable (frozen) to ensure state integrity.

Parameters:
population

Size of the population (default: 1.0)

subsistence_needs

Resources needed for survival (default: 5.0)

property component_type: str

Return the component type identifier.

Returns:

The string ‘vitality’ identifying this component type.

model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

population: Annotated[float]
subsistence_needs: Annotated[float]
class babylon.models.components.SpatialComponent(**data)[source]

Bases: BaseModel

Location and mobility of an entity.

Tracks the spatial state of an entity: - Geographic/topological location identifier (string) - Ability to relocate (Probability)

All numeric values use constrained types for automatic validation: - mobility: Probability [0, 1]

This component is immutable (frozen) to ensure state integrity.

Parameters:
location_id

Geographic or topological location identifier (default: “”)

mobility

Ability to relocate [0=immobile, 1=fully mobile] (default: 0.5)

property component_type: str

Return the component type identifier.

Returns:

The string ‘spatial’ identifying this component type.

model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

location_id: str
mobility: Annotated[float]
class babylon.models.components.MaterialConditionsBuffer(**data)[source]

Bases: BaseModel

Material preconditions for consciousness change on a population node.

This model stores the intermediate quantities derived from the value tensor (c/v/s) that feed into the community-level consciousness routing formula. It is NOT consciousness itself — consciousness lives on the community hyperedge as TernaryConsciousness.

Parameters:
  • agitation (float) – Raw political energy from crisis conditions.

  • exploitation_visibility (float) – How clearly exploitation is visible.

  • reification_buffer (float) – How much commodity fetishism obscures relations.

model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

agitation: float
exploitation_visibility: float
reification_buffer: float
class babylon.models.components.OrganizationComponent(**data)[source]

Bases: BaseModel

Organizational capacity of an entity.

Tracks the organizational state of an entity: - Internal unity and coordination (Probability) - Quality of organizational leadership (Probability)

All values use constrained types for automatic validation: - cohesion: Probability [0, 1] - cadre_level: Probability [0, 1]

This component is immutable (frozen) to ensure state integrity.

Parameters:
cohesion

Internal unity and coordination [0=atomized, 1=unified] (default: 0.1)

cadre_level

Quality of organizational leadership [0=none, 1=elite] (default: 0.0)

property component_type: str

Return the component type identifier.

Returns:

The string ‘organization’ identifying this component type.

model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

cohesion: Annotated[float]
cadre_level: Annotated[float]

Modules

base

Component protocol definition.

material

MaterialComponent - Material conditions of an entity.

material_conditions

MaterialConditionsBuffer - Material preconditions for consciousness change.

organization

OrganizationComponent - Organizational capacity of an entity.

spatial

SpatialComponent - Location and mobility of an entity.

vitality

VitalityComponent - Population and survival needs of an entity.