Config¶
YAML company configuration loading and validation.
Schema¶
schema
¶
Root configuration schema and config-level Pydantic models.
LocalModelParams
pydantic-model
¶
Bases: BaseModel
Per-model launch parameters for local providers.
Attributes:
| Name | Type | Description |
|---|---|---|
num_ctx |
int | None
|
Context window size override in tokens. |
num_gpu_layers |
int | None
|
Number of layers to offload to GPU (0 = CPU only). |
num_threads |
int | None
|
CPU thread count for inference. |
num_batch |
int | None
|
Batch size for prompt processing. |
repeat_penalty |
float | None
|
Repetition penalty multiplier (1.0 = disabled). |
Config:
frozen:Trueallow_inf_nan:False
Fields:
-
num_ctx(int | None) -
num_gpu_layers(int | None) -
num_threads(int | None) -
num_batch(int | None) -
repeat_penalty(float | None)
ProviderModelConfig
pydantic-model
¶
Bases: BaseModel
Configuration for a single LLM model within a provider.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
NotBlankStr
|
Model identifier (e.g. |
alias |
NotBlankStr | None
|
Short alias for referencing this model in routing rules. |
cost_per_1k_input |
float
|
Cost per 1,000 input tokens (base currency). |
cost_per_1k_output |
float
|
Cost per 1,000 output tokens (base currency). |
max_context |
int
|
Maximum context window size in tokens. |
estimated_latency_ms |
int | None
|
Estimated median latency in milliseconds. |
local_params |
LocalModelParams | None
|
Per-model launch parameters for local providers. |
Config:
frozen:Trueallow_inf_nan:False
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)
ProviderConfig
pydantic-model
¶
Bases: BaseModel
Configuration for an LLM provider.
Attributes:
| Name | Type | Description |
|---|---|---|
driver |
NotBlankStr
|
Driver backend name (e.g. |
litellm_provider |
NotBlankStr | None
|
LiteLLM routing identifier (e.g.
|
auth_type |
AuthType
|
Authentication type for this provider. |
api_key |
NotBlankStr | None
|
API key (typically injected by secret management). |
subscription_token |
NotBlankStr | None
|
Bearer token for subscription-based auth (e.g. provider subscription plans). Encrypted at rest. |
tos_accepted_at |
AwareDatetime | None
|
Timestamp when the user accepted the subscription
Terms of Service warning. Required when |
base_url |
NotBlankStr | None
|
Base URL for the provider API. |
oauth_token_url |
NotBlankStr | None
|
OAuth token endpoint URL. |
oauth_client_id |
NotBlankStr | None
|
OAuth client identifier. |
oauth_client_secret |
NotBlankStr | None
|
OAuth client secret. |
oauth_scope |
NotBlankStr | None
|
OAuth scope string. |
custom_header_name |
NotBlankStr | None
|
Name of custom auth header. |
custom_header_value |
NotBlankStr | None
|
Value of custom auth header. |
models |
tuple[ProviderModelConfig, ...]
|
Available models for this provider. |
retry |
RetryConfig
|
Retry configuration for transient errors. |
rate_limiter |
RateLimiterConfig
|
Client-side rate limiting configuration. |
subscription |
SubscriptionConfig
|
Subscription and quota configuration. |
degradation |
DegradationConfig
|
Degradation strategy when quota exhausted. |
family |
NotBlankStr | None
|
Provider family for cross-validation grouping. |
preset_name |
NotBlankStr | None
|
Name of the preset used to create this provider (if any). Used to resolve local model management capabilities. |
Config:
frozen:Trueallow_inf_nan:False
Fields:
-
driver(NotBlankStr) -
litellm_provider(NotBlankStr | None) -
family(NotBlankStr | None) -
auth_type(AuthType) -
api_key(NotBlankStr | None) -
subscription_token(NotBlankStr | None) -
tos_accepted_at(AwareDatetime | None) -
base_url(NotBlankStr | None) -
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) -
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.
subscription_token
pydantic-field
¶
OAuth bearer token for subscription-based auth
RoutingRuleConfig
pydantic-model
¶
Bases: BaseModel
A single model routing rule.
At least one of role_level or task_type must be set so the
rule can match incoming requests.
Attributes:
| Name | Type | Description |
|---|---|---|
role_level |
SeniorityLevel | None
|
Seniority level this rule applies to. |
task_type |
NotBlankStr | None
|
Task type this rule applies to. |
preferred_model |
NotBlankStr
|
Preferred model alias or ID. |
fallback |
NotBlankStr | None
|
Fallback model alias or ID. |
Config:
frozen:Trueallow_inf_nan:False
Fields:
-
role_level(SeniorityLevel | None) -
task_type(NotBlankStr | None) -
preferred_model(NotBlankStr) -
fallback(NotBlankStr | None)
Validators:
-
_at_least_one_matcher
RoutingConfig
pydantic-model
¶
Bases: BaseModel
Model routing configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
strategy |
NotBlankStr
|
Routing strategy name (e.g. |
rules |
tuple[RoutingRuleConfig, ...]
|
Ordered routing rules. |
fallback_chain |
tuple[NotBlankStr, ...]
|
Ordered fallback model aliases or IDs. |
Config:
frozen:Trueallow_inf_nan:False
Fields:
-
strategy(NotBlankStr) -
rules(tuple[RoutingRuleConfig, ...]) -
fallback_chain(tuple[NotBlankStr, ...])
AgentConfig
pydantic-model
¶
Bases: BaseModel
Agent configuration from YAML.
Uses raw dicts for personality, model, memory, tools, and authority
because :class:~synthorg.core.agent.AgentIdentity has runtime
fields (id, hiring_date, status) that are not present in
config. The engine constructs full AgentIdentity objects at
startup.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
NotBlankStr
|
Agent display name. |
role |
NotBlankStr
|
Role name. |
department |
NotBlankStr
|
Department name. |
level |
SeniorityLevel
|
Seniority level. |
personality |
dict[str, Any]
|
Raw personality config dict. |
model |
dict[str, Any]
|
Raw model config dict. |
memory |
dict[str, Any]
|
Raw memory config dict. |
tools |
dict[str, Any]
|
Raw tools config dict. |
authority |
dict[str, Any]
|
Raw authority config dict. |
Config:
frozen:Trueallow_inf_nan:False
Fields:
-
name(NotBlankStr) -
role(NotBlankStr) -
department(NotBlankStr) -
level(SeniorityLevel) -
personality(dict[str, Any]) -
model(dict[str, Any]) -
memory(dict[str, Any]) -
tools(dict[str, Any]) -
authority(dict[str, Any]) -
autonomy_level(AutonomyLevel | None)
GracefulShutdownConfig
pydantic-model
¶
Bases: BaseModel
Configuration for graceful shutdown behaviour.
Attributes:
| Name | Type | Description |
|---|---|---|
strategy |
NotBlankStr
|
Shutdown strategy name (e.g. |
grace_seconds |
float
|
Seconds to wait for cooperative agent exit before force-cancelling. |
cleanup_seconds |
float
|
Seconds allowed for cleanup callbacks (persist costs, close connections, flush logs). |
Config:
frozen:Trueallow_inf_nan:False
Fields:
-
strategy(NotBlankStr) -
grace_seconds(float) -
cleanup_seconds(float)
TaskAssignmentConfig
pydantic-model
¶
Bases: BaseModel
Configuration for task assignment behaviour.
Attributes:
| Name | Type | Description |
|---|---|---|
strategy |
NotBlankStr
|
Assignment strategy name (e.g. |
min_score |
float
|
Minimum capability score for agent eligibility. |
max_concurrent_tasks_per_agent |
int
|
Maximum tasks an agent can handle concurrently. Enforced by scoring-based strategies that filter out agents at capacity. |
Config:
frozen:Trueallow_inf_nan:False
Fields:
-
strategy(NotBlankStr) -
min_score(float) -
max_concurrent_tasks_per_agent(int)
Validators:
-
_validate_strategy_name
max_concurrent_tasks_per_agent
pydantic-field
¶
Maximum concurrent tasks an agent is intended to handle. Enforced by scoring-based strategies that filter out agents at capacity.
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. |
logging |
LogConfig | None
|
Logging configuration ( |
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. |
task_engine |
TaskEngineConfig
|
Task engine configuration. |
coordination |
CoordinationSectionConfig
|
Multi-agent coordination configuration. |
git_clone |
GitCloneNetworkPolicy
|
Git clone SSRF prevention network policy. |
backup |
BackupConfig
|
Backup and restore configuration. |
workflow |
WorkflowConfig
|
Workflow type configuration. |
Config:
frozen:Trueallow_inf_nan:False
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) -
logging(LogConfig | None) -
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) -
task_engine(TaskEngineConfig) -
coordination(CoordinationSectionConfig) -
git_clone(GitCloneNetworkPolicy) -
backup(BackupConfig) -
workflow(WorkflowConfig)
Validators:
-
_validate_unique_agent_names -
_validate_unique_department_names -
_validate_routing_references -
_validate_degradation_fallback_providers
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: Exception
Base exception for configuration errors.
Attributes:
| Name | Type | Description |
|---|---|---|
message |
Human-readable error description. |
|
locations |
Source locations associated with this error. |
Source code in src/synthorg/config/errors.py
__str__
¶
Format error message with source locations.
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 |
Per-field error messages as
|
Source code in src/synthorg/config/errors.py
__str__
¶
Format validation error with per-field details.