Configuration System
The configuration system provides centralized management of application settings through environment variables, configuration files, and runtime configuration.
Overview
Configuration in Babylon is managed through several modules:
babylon.config.base- Base configuration classbabylon.config.defines- Game parameter definitions (GameDefines)babylon.config.chromadb_config- ChromaDB vector database settingsbabylon.config.llm_config- LLM/AI integration settingsbabylon.config.logging_config- Logging configuration
Base Configuration
The BaseConfig class serves as the foundation for all configuration
management.
Database Settings
Setting |
Description |
|---|---|
|
SQLite connection string (default: |
ChromaDB Settings
Setting |
Description |
|---|---|
|
Vector database persistence directory |
|
Default collection name |
|
Model name for embeddings |
Metrics Collection
Setting |
Description |
|---|---|
|
Enable/disable metrics collection |
|
Collection interval in seconds |
|
Data retention period |
Logging Configuration
Setting |
Description |
|---|---|
|
Minimum logging level |
|
Log message format |
|
Log file directory |
Performance Thresholds
Setting |
Description |
|---|---|
|
Maximum acceptable query latency |
|
Minimum acceptable cache hit rate |
|
Maximum memory usage threshold |
Usage Examples
Accessing configuration:
from babylon.config.base import BaseConfig
# Access configuration
db_url = BaseConfig.DATABASE_URL
log_level = BaseConfig.LOG_LEVEL
# Override settings
BaseConfig.METRICS_ENABLED = False
Environment Variables
The following environment variables can be used to override default settings:
# Database (SQLite)
DATABASE_URL=sqlite:///babylon.db
# ChromaDB
BABYLON_CHROMA_PERSIST_DIR=/path/to/persist
BABYLON_EMBEDDING_MODEL=all-MiniLM-L6-v2
# Metrics
BABYLON_METRICS_ENABLED=true
BABYLON_METRICS_INTERVAL=60
# Logging
BABYLON_LOG_LEVEL=INFO
BABYLON_LOG_DIR=/path/to/logs
GameDefines
All tunable game coefficients are centralized in the GameDefines Pydantic
model:
from babylon.config.defines import GameDefines
defines = GameDefines() # Load defaults from pyproject.toml
defines.economy.extraction_efficiency # 0.8 default
defines.consciousness.drift_sensitivity_k # Consciousness drift rate
Economy Parameters
Control imperial rent extraction and wealth flows:
Parameter |
Default |
Description |
|---|---|---|
|
0.8 |
Fraction of surplus captured as imperial rent |
|
0.1 |
Base rate of tribute extraction per tick |
|
0.05 |
Minimum wage (prevents zero-wealth) |
|
0.15 |
Rate of wealth movement along edges |
Consciousness Parameters
Control ideology drift and bifurcation:
Parameter |
Default |
Description |
|---|---|---|
|
0.1 |
How fast ideology changes per tick |
|
0.3 |
Minimum agitation to trigger drift |
|
1.0 |
Maximum consciousness value |
|
True |
Enable George Jackson model |
Solidarity Parameters
Control SOLIDARITY edge dynamics:
Parameter |
Default |
Description |
|---|---|---|
|
0.95 |
Solidarity decay per tick (0.95 = 5% decay) |
|
0.1 |
Consciousness spread along edges |
|
0.3 |
Consciousness needed to form new edges |
|
0.05 |
Edges below this are pruned |
Survival Parameters
Control survival calculus:
Parameter |
Default |
Description |
|---|---|---|
|
0.2 |
Wealth level for basic survival |
|
10.0 |
Steepness of P(S|A) sigmoid curve |
|
2.0 |
Kahneman-Tversky loss aversion factor |
|
0.5 |
Reduces P(S|R) (revolution is risky) |
Territory Parameters
Control carceral geography:
Parameter |
Default |
Description |
|---|---|---|
|
0.8 |
Heat level triggering eviction |
|
0.1 |
Heat reduction per tick |
|
0.2 |
Heat transferred on displacement |
|
5 |
Ticks in detention before incarceration |
|
BALANCED |
Default mode (LABOR_SCARCE/BALANCED/ELIMINATION) |
See Tune Simulation Parameters for usage examples and tuning workflows.
Best Practices
Use environment variables for sensitive information
Keep defaults reasonable for development environments
Document all configuration changes in commit messages
Validate configuration at startup using Pydantic validation
Use type hints for all settings
See Also
Tune Simulation Parameters - Parameter tuning workflow guide
babylon.config- Configuration module APIError Codes - Error code reference