Config¶
YAML company configuration loading and validation.
Schema¶
schema
¶
Root configuration schema and config-level Pydantic models.
ModelMetadata
pydantic-model
¶
Bases: BaseModel
Capability and family/generation metadata for a single model.
Enriched from litellm at discovery and persisted on
:class:~synthorg.config.provider_schema.ProviderModelConfig so the
matcher can select on real capability data offline.
Attributes:
| Name | Type | Description |
|---|---|---|
supports_tools |
bool
|
Model supports function/tool calling. The
discovery-time claim (litellm / preset / probe / unknown); the
matcher reads it optimistically for |
tool_calls_verified |
bool | None
|
Runtime-observed tool-calling truth, layered on
top of |
supports_vision |
bool
|
Model accepts image inputs. |
supports_reasoning |
bool
|
Model exposes extended reasoning. |
supports_embeddings |
bool
|
Model is an embedding model (vector output). |
max_output_tokens |
int | None
|
Maximum output tokens, when known. |
family |
NotBlankStr | None
|
Parsed model family (e.g. |
generation |
float | None
|
Parsed generation/recency as a sortable number
(e.g. |
parameter_count |
int | None
|
Total model parameters, when known. A coarse size/strength signal the matcher uses to rank quality. |
cost_tier |
int | None
|
Resource/pricing tier 1-4 (light -> extra heavy). For ollama this is the real per-model usage level scraped from the web page (the API does not expose it); for other providers it is derived from cost/size. Drives cost-aware tiering in the matcher. |
release_date |
date | None
|
Parsed release date, when derivable from the id. |
metadata_source |
MetadataSource
|
Provenance of this metadata record. |
Config:
frozen:Trueextra:forbidallow_inf_nan:False
Fields:
-
supports_tools(bool) -
tool_calls_verified(bool | None) -
supports_vision(bool) -
supports_reasoning(bool) -
supports_embeddings(bool) -
max_output_tokens(int | None) -
parameter_count(int | None) -
cost_tier(int | None) -
family(NotBlankStr | None) -
generation(float | None) -
release_date(date | None) -
metadata_source(MetadataSource)
LocalModelParams
pydantic-model
¶
Bases: BaseModel
Per-model launch parameters for local providers.
Config:
frozen:Trueallow_inf_nan:Falseextra:forbid
Fields:
-
num_ctx(int | None) -
num_gpu_layers(int | None) -
num_threads(int | None) -
num_batch(int | None) -
repeat_penalty(float | None)
ProviderConfig
pydantic-model
¶
Bases: BaseModel
Configuration for an LLM provider.
Config:
frozen:Trueallow_inf_nan:Falseextra:forbid
Fields:
-
driver(NotBlankStr) -
litellm_provider(NotBlankStr | None) -
family(NotBlankStr | None) -
auth_type(AuthType) -
connection_name(NotBlankStr | None) -
subscription_token(NotBlankStr | None) -
tos_accepted_at(AwareDatetime | None) -
base_url(NotBlankStr | None) -
keep_alive(NotBlankStr | None) -
vram_guard(OllamaVramGuardConfig) -
oauth_token_url(NotBlankStr | None) -
oauth_client_id(NotBlankStr | None) -
oauth_client_secret(NotBlankStr | None) -
oauth_scope(NotBlankStr | None) -
custom_header_name(NotBlankStr | None) -
custom_header_value(NotBlankStr | None) -
models(tuple[ProviderModelConfig, ...]) -
retry(RetryConfig) -
rate_limiter(RateLimiterConfig) -
subscription(SubscriptionConfig) -
degradation(DegradationConfig) -
defaults(ProviderModelDefaults) -
preset_name(NotBlankStr | None)
Validators:
-
_validate_auth_fields -
_validate_unique_model_identifiers
litellm_provider
pydantic-field
¶
LiteLLM provider identifier for routing (e.g. 'example-provider'). Falls back to the provider name when None.
family
pydantic-field
¶
Provider family for cross-validation grouping (e.g. 'provider-family-a', 'provider-family-b'). When None, the provider name is used as the family.
connection_name
pydantic-field
¶
Reference to a ConnectionCatalog entry. Credentials are resolved from the catalog at runtime; required for API-key auth, which has no embedded credential field.
subscription_token
pydantic-field
¶
Bearer token for subscription-based auth
keep_alive
pydantic-field
¶
Ollama keep_alive: how long the server keeps a model loaded after a request (e.g. '5m', '0' to unload immediately, '-1' to keep forever). Sent only to ollama providers; unset falls back to the driver's bounded default (5m) rather than the ollama server's OLLAMA_KEEP_ALIVE.
vram_guard
pydantic-field
¶
VRAM-aware model load/eviction guard for ollama providers (ignored by other providers).
defaults
pydantic-field
¶
Last-resort defaults applied when a driver cannot discover per-model metadata (currently used by the LiteLLM driver's fallback max_output_tokens).
ProviderModelConfig
pydantic-model
¶
Bases: BaseModel
Configuration for a single LLM model within a provider.
Config:
frozen:Trueallow_inf_nan:Falseextra:forbid
Fields:
-
id(NotBlankStr) -
alias(NotBlankStr | None) -
cost_per_1k_input(float) -
cost_per_1k_output(float) -
max_context(int) -
estimated_latency_ms(int | None) -
local_params(LocalModelParams | None) -
metadata(ModelMetadata) -
stale(ModelStaleness | None)
RootConfig
pydantic-model
¶
Bases: BaseModel
Root company configuration -- the top-level validation target.
Aggregates all sub-configurations into a single frozen model that represents a fully validated company setup.
Attributes:
| Name | Type | Description |
|---|---|---|
company_name |
NotBlankStr
|
Company name (required). |
company_type |
CompanyType
|
Company template type. |
departments |
tuple[Department, ...]
|
Organizational departments. |
agents |
tuple[AgentConfig, ...]
|
Agent configurations. |
custom_roles |
tuple[CustomRole, ...]
|
User-defined custom roles. |
config |
CompanyConfig
|
Company-wide settings. |
budget |
BudgetConfig
|
Budget configuration. |
communication |
CommunicationConfig
|
Communication configuration. |
providers |
dict[str, ProviderConfig]
|
LLM provider configurations keyed by provider name. |
routing |
RoutingConfig
|
Model routing configuration. |
stakes_routing |
StakesRoutingConfig
|
Stakes-aware model routing configuration (strategy discriminator, per-stakes quality floors, coordination nudge). |
logging |
LogConfig | None
|
Logging configuration ( |
audit_chain |
AuditChainConfig
|
Quantum-safe audit-chain sink configuration (opt-in, disabled by default). |
graceful_shutdown |
GracefulShutdownConfig
|
Graceful shutdown configuration. |
workflow_handoffs |
tuple[WorkflowHandoff, ...]
|
Cross-department workflow handoffs. |
escalation_paths |
tuple[EscalationPath, ...]
|
Cross-department escalation paths. |
coordination_metrics |
CoordinationMetricsConfig
|
Coordination metrics configuration. |
task_assignment |
TaskAssignmentConfig
|
Task assignment configuration. |
memory |
CompanyMemoryConfig
|
Memory backend configuration. |
persistence |
PersistenceConfig
|
Persistence backend configuration. |
cost_tiers |
CostTiersConfig
|
Cost tier definitions. |
org_memory |
OrgMemoryConfig
|
Organizational memory configuration. |
api |
ApiConfig
|
API server configuration. |
sandboxing |
SandboxingConfig
|
Sandboxing backend configuration. |
mcp |
MCPConfig
|
MCP bridge configuration. |
security |
SecurityConfig
|
Security subsystem configuration. |
trust |
TrustConfig
|
Progressive trust configuration. |
promotion |
PromotionConfig
|
Promotion/demotion configuration. |
performance |
PerformanceConfig
|
Performance tracking configuration (quality judge, CI/LLM weights, trend thresholds). |
training |
TrainingConfig
|
Training pipeline configuration. |
task_engine |
TaskEngineConfig
|
Task engine configuration. |
recovery |
EngineRecoveryConfig
|
Crash recovery strategy selection (fail-reassign by default; checkpoint requires a wired CheckpointRepository from the persistence backend, with tuning from recovery.checkpoint). |
queue |
QueueConfig
|
Distributed task queue configuration (opt-in, requires a distributed bus backend such as NATS). |
coordination |
CoordinationSectionConfig
|
Multi-agent coordination configuration. |
stagnation |
StagnationDetectionConfig
|
Intra-loop stagnation detection selector and sub-configs. |
strategy |
StrategyConfig
|
Strategy and trendslop mitigation configuration. |
knowledge |
KnowledgeConfig
|
Knowledge-substrate configuration (on by default; disabled at
runtime via the settings-service |
git_clone |
GitCloneNetworkPolicy
|
Git clone SSRF prevention network policy. |
backup |
BackupConfig
|
Backup and restore configuration. |
workflow |
WorkflowConfig
|
Workflow type configuration. |
notifications |
NotificationConfig
|
Notification subsystem configuration. |
integrations |
IntegrationsConfig
|
External service integrations configuration. |
a2a |
A2AConfig
|
A2A external gateway configuration (disabled by default). |
ontology |
OntologyConfig
|
Semantic ontology configuration. |
telemetry |
TelemetryConfig
|
Anonymous product telemetry configuration (opt-in, disabled by default). |
web |
WebToolsConfig | None
|
Web tool configuration ( |
database |
DatabaseConfig | None
|
Database tool configuration ( |
terminal |
TerminalConfig | None
|
Terminal tool configuration ( |
design_tools |
DesignToolsConfig | None
|
Design tool configuration ( |
communication_tools |
CommunicationToolsConfig | None
|
Communication tool configuration ( |
analytics_tools |
AnalyticsToolsConfig | None
|
Analytics tool configuration ( |
tool_disclosure |
ToolDisclosureConfig
|
Progressive tool disclosure configuration. |
posture |
PostureConfig
|
Resolved operating-posture feature flags. |
Config:
frozen:Trueallow_inf_nan:Falseextra:forbid
Fields:
-
company_name(NotBlankStr) -
company_type(CompanyType) -
departments(tuple[Department, ...]) -
agents(tuple[AgentConfig, ...]) -
custom_roles(tuple[CustomRole, ...]) -
config(CompanyConfig) -
budget(BudgetConfig) -
communication(CommunicationConfig) -
providers(dict[str, ProviderConfig]) -
routing(RoutingConfig) -
stakes_routing(StakesRoutingConfig) -
logging(LogConfig | None) -
audit_chain(AuditChainConfig) -
graceful_shutdown(GracefulShutdownConfig) -
workflow_handoffs(tuple[WorkflowHandoff, ...]) -
escalation_paths(tuple[EscalationPath, ...]) -
coordination_metrics(CoordinationMetricsConfig) -
task_assignment(TaskAssignmentConfig) -
memory(CompanyMemoryConfig) -
persistence(PersistenceConfig) -
cost_tiers(CostTiersConfig) -
org_memory(OrgMemoryConfig) -
api(ApiConfig) -
sandboxing(SandboxingConfig) -
mcp(MCPConfig) -
security(SecurityConfig) -
trust(TrustConfig) -
promotion(PromotionConfig) -
performance(PerformanceConfig) -
training(TrainingConfig) -
task_engine(TaskEngineConfig) -
recovery(EngineRecoveryConfig) -
queue(QueueConfig) -
coordination(CoordinationSectionConfig) -
evolution(EvolutionConfig) -
compaction(CompactionConfig) -
stagnation(StagnationDetectionConfig) -
strategy(StrategyConfig) -
knowledge(KnowledgeConfig) -
git_clone(GitCloneNetworkPolicy) -
backup(BackupConfig) -
workflow(WorkflowConfig) -
notifications(NotificationConfig) -
integrations(IntegrationsConfig) -
a2a(A2AConfig) -
ontology(OntologyConfig) -
telemetry(TelemetryConfig) -
web(WebToolsConfig | None) -
database(DatabaseConfig | None) -
terminal(TerminalConfig | None) -
design_tools(DesignToolsConfig | None) -
communication_tools(CommunicationToolsConfig | None) -
analytics_tools(AnalyticsToolsConfig | None) -
tool_disclosure(ToolDisclosureConfig) -
posture(PostureConfig)
Validators:
-
_validate_unique_agent_names -
_validate_unique_department_names -
_validate_milestone_clean_history_windows -
_validate_queue_requires_distributed_bus -
_validate_routing_references -
_validate_degradation_fallback_providers
knowledge
pydantic-field
¶
Knowledge-substrate configuration (on by default; disabled at runtime via the settings-service knowledge.enabled flag)
terminal
pydantic-field
¶
Terminal tool configuration (None = default terminal config)
communication_tools
pydantic-field
¶
Communication tool configuration (None = disabled)
analytics_tools
pydantic-field
¶
Analytics tool configuration (None = disabled)
Loader¶
loader
¶
YAML configuration loader with layered merging and validation.
discover_config
¶
Auto-discover a configuration file from well-known locations.
Search order:
./synthorg.yaml./config/synthorg.yaml~/.synthorg/config.yaml
Returns:
| Type | Description |
|---|---|
Path
|
Resolved absolute :class: |
Raises:
| Type | Description |
|---|---|
ConfigFileNotFoundError
|
If no configuration file is found at any searched location. |
Source code in src/synthorg/config/loader.py
load_config
¶
Load and validate company configuration from YAML file(s).
Each layer deep-merges onto the previous: built-in defaults, primary config, overrides, then env-var substitution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_path
|
Path | str | None
|
Path to the primary config file, or |
None
|
override_paths
|
tuple[Path | str, ...]
|
Additional config files layered on top. |
()
|
Returns:
| Type | Description |
|---|---|
RootConfig
|
Validated, frozen :class: |
Raises:
| Type | Description |
|---|---|
ConfigFileNotFoundError
|
If any config file does not exist or discovery finds nothing. |
ConfigParseError
|
If any file contains invalid YAML. |
ConfigValidationError
|
If the merged config fails validation. |
Source code in src/synthorg/config/loader.py
bootstrap_logging
¶
Activate the observability pipeline after config is loaded.
Calls :func:~synthorg.observability.configure_logging with
config.logging, or sensible defaults if config is None.
Should be called once at startup after :func:load_config
returns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
RootConfig | None
|
Validated root configuration. When |
None
|
Source code in src/synthorg/config/loader.py
load_config_from_string
¶
Load and validate config from a YAML string.
Merges with built-in defaults before validation. Useful for API endpoints and testing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
yaml_string
|
str
|
Raw YAML content. |
required |
source_name
|
str
|
Label used in error messages. |
'<string>'
|
Returns:
| Type | Description |
|---|---|
RootConfig
|
Validated, frozen :class: |
Raises:
| Type | Description |
|---|---|
ConfigParseError
|
If the YAML is invalid. |
ConfigValidationError
|
If the merged config fails validation. |
Source code in src/synthorg/config/loader.py
Defaults¶
defaults
¶
Built-in default values for company configuration.
default_config_dict
¶
Return base-layer configuration defaults as a raw dict.
These defaults serve as the base layer; user-provided YAML values override them during merging. They ensure that every field has a sensible starting value even if omitted from the config file.
Returns:
| Type | Description |
|---|---|
dict[str, object]
|
Base-layer configuration dictionary. |
Source code in src/synthorg/config/defaults.py
Errors¶
errors
¶
Custom exception hierarchy for configuration errors.
ConfigLocation
dataclass
¶
Source location for a configuration error.
Attributes:
| Name | Type | Description |
|---|---|---|
file_path |
str | None
|
Path to the configuration file. |
key_path |
str | None
|
Dot-separated path to the key
(e.g. |
line |
int | None
|
Line number in the file (1-based). |
column |
int | None
|
Column number in the file (1-based). |
ConfigError
¶
Bases: DomainError
Base exception for configuration errors.
Attributes:
| Name | Type | Description |
|---|---|---|
message |
str
|
Human-readable error description. |
locations |
tuple[ConfigLocation, ...]
|
Source locations associated with this error. |
Source code in src/synthorg/config/errors.py
__str__
¶
Format error message with source locations.
Returns:
| Type | Description |
|---|---|
str
|
The message alone when there are no locations, otherwise the |
str
|
message followed by one indented line per source location. |
Source code in src/synthorg/config/errors.py
ConfigFileNotFoundError
¶
Bases: ConfigError
Raised when a configuration file does not exist.
Source code in src/synthorg/config/errors.py
ConfigParseError
¶
ConfigValidationError
¶
Bases: ConfigError
Raised when Pydantic validation fails.
Attributes:
| Name | Type | Description |
|---|---|---|
field_errors |
tuple[tuple[str, str], ...]
|
Per-field error messages as
|
Source code in src/synthorg/config/errors.py
__str__
¶
Format validation error with per-field details.
Returns:
| Type | Description |
|---|---|
str
|
The base location-formatted message when there are no field |
str
|
errors, otherwise a header line plus one indented line per |
str
|
|