babylon.engine.headless_runner.models
Pydantic entities for the headless simulation runner.
Spec: 064-headless-sim-runner (data-model.md §1)
All models are frozen Pydantic 2.x per project standard. The set:
ExitReason— discrete run-terminal statesSimulationRunConfig— full input description of one runPerformanceBreakdown— wallclock attributionAuditEntry— projection of one conservation_audit_log rowTraceRow— one row of trace.csvSimulationRunResult— return value ofrunner.run()
Classes
|
Projection of one row from spec-062 |
|
Run-terminal state discriminator. |
|
Wallclock attribution for SC-002 verification. |
|
Spec-102: exogenous, deterministic scheduled shock to a bloc's Φ inflow. |
|
Frozen, hashable description of a single headless run. |
|
Return value of |
|
One row of |
- class babylon.engine.headless_runner.models.ExitReason(*values)[source]
Bases:
StrEnumRun-terminal state discriminator.
Mapped to CLI exit codes per
contracts/cli_contract.yaml:COMPLETED→ exit 0EARLY_TERMINATED→ exit 0 (valid end-game)USER_INTERRUPTED→ exit 130ERRORED→ exit 1
- COMPLETED = 'completed'
- EARLY_TERMINATED = 'early_terminated'
- USER_INTERRUPTED = 'user_interrupted'
- ERRORED = 'errored'
- class babylon.engine.headless_runner.models.ScheduledBlocShock(**data)[source]
Bases:
BaseModelSpec-102: exogenous, deterministic scheduled shock to a bloc’s Φ inflow.
Declares a level-set multiplier applied to that bloc’s
external_nodes_phientry starting attick(inclusive) and persisting on all subsequent ticks until a later shock for the same bloc supersedes it (see_apply_due_shocksinrunner.py). Pure exogenous scenario-authoring data — blocs never decide to shock themselves (R-AMEND, blocs stay Layer-0 register machinery).tickmust be >= 1: the tick loop only visits ticks1..(config.ticks - 1)(tick 0 is a raw hex-state persist that never readsexternal_nodes_phi).- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class babylon.engine.headless_runner.models.SimulationRunConfig(**data)[source]
Bases:
BaseModelFrozen, hashable description of a single headless run.
Constructed from CLI flags + defaults; persisted into the manifest’s
deterministic_inputssection.- Parameters:
ticks (int)
start_year (int)
random_seed (int)
scope_name (str)
sqlite_reference_path (Path)
output_dir (Path)
defines_overlay_path (Path | None)
dry_run (bool)
verbose (Literal['DEBUG', 'INFO', 'WARNING', 'ERROR'])
strict (bool)
liveness_gate (bool)
endgame_detector (str | None)
write_baseline_to (Path | None)
shock_schedule (tuple[ScheduledBlocShock, ...])
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- shock_schedule: tuple[ScheduledBlocShock, ...]
- class babylon.engine.headless_runner.models.PerformanceBreakdown(**data)[source]
Bases:
BaseModelWallclock attribution for SC-002 verification.
- Parameters:
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class babylon.engine.headless_runner.models.AuditEntry(**data)[source]
Bases:
BaseModelProjection of one row from spec-062
conservation_audit_log.- Parameters:
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class babylon.engine.headless_runner.models.TraceRow(**data)[source]
Bases:
BaseModelOne row of
trace.csv.Column ordering matches
contracts/trace_csv_schema.yamland the SQL viewview_runtime_trace_emission. CSV serialization writes""forNoneper FR-008.- Parameters:
tick (int)
simulated_year (float)
entity_id (str)
entity_kind (Literal['county', 'external', 'national', 'hex_aggregate'])
v (float | None)
c (float | None)
s (float | None)
k (float | None)
p_acquiescence (float | None)
p_revolution (float | None)
ideology_r (float | None)
ideology_l (float | None)
ideology_f (float | None)
surveillance_coupling (float | None)
internet_access_pct (float | None)
biocapacity_stock (float | None)
energy_stock (float | None)
raw_material_stock (float | None)
profit_rate (float | None)
exploitation_rate (float | None)
population (int | None)
employment_proxy (float | None)
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class babylon.engine.headless_runner.models.SimulationRunResult(**data)[source]
Bases:
BaseModelReturn value of
babylon.engine.headless_runner.run().- Parameters:
session_id (UUID)
config (SimulationRunConfig)
ticks_completed (int)
exit_reason (ExitReason)
end_game_tick (int | None)
end_game_condition (str | None)
wallclock_start (datetime)
wallclock_end (datetime)
performance (PerformanceBreakdown)
conservation_audit (tuple[AuditEntry, ...])
artifact_dir (Path | None)
final_world_state (Any)
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- config: SimulationRunConfig
- exit_reason: ExitReason
- performance: PerformanceBreakdown
- conservation_audit: tuple[AuditEntry, ...]