Templates¶
Pre-built company templates, personality presets, and template builder.
Enums¶
enums
¶
Company-template domain enumerations.
SkillPattern
¶
Bases: StrEnum
Skill interaction patterns for company templates.
Based on the five-pattern taxonomy: Tool Wrapper, Generator, Reviewer, Inversion, and Pipeline.
Attributes:
| Name | Type | Description |
|---|---|---|
TOOL_WRAPPER |
On-demand domain expertise; agents self-direct using specialized context. |
|
GENERATOR |
Consistent structured output from reusable templates. |
|
REVIEWER |
Modular rubric-based evaluation; separates what to check from how to check it. |
|
INVERSION |
Agent interviews user before acting; structured requirements gathering. |
|
PIPELINE |
Strict sequential workflow with hard checkpoints between stages. |
PostureName
¶
Bases: StrEnum
Named operating postures a template can declare.
A posture expands to a coherent runtime feature-flag bundle (knowledge substrate, conversational chat modes, red-team gate, mid-flight steering, cost-dial) so a template configures behaviour, not just an org chart. The toolsmith is intentionally excluded: enabling it needs an explicit capability allowlist and stays an operator opt-in.
Attributes:
| Name | Type | Description |
|---|---|---|
AUTONOMOUS |
High-autonomy delivery; steering and knowledge on, human chat off. |
|
SUPERVISED_CLIENT_FACING |
Human-in-the-loop client work; group chat and agent invite on for stakeholder collaboration. |
|
KNOWLEDGE_HEAVY |
Knowledge-substrate-grounded work; entailment grounding and a shared knowledge base. |
|
COST_DISCIPLINED |
Budget-first operation; auto-downgrade on, optional features off to minimise spend. |
|
SECURITY_HARDENED |
Security-first operation; red-team completion gate on at a lowered stakes floor, self-extension off. |
|
RESEARCH_AUTONOMOUS |
Autonomous inquiry; knowledge substrate, steering, and clarify-or-park + routing proposals on. |
Schema¶
schema
¶
Template schema: Pydantic models for company templates.
TemplateVariable
pydantic-model
¶
Bases: BaseModel
A user-configurable variable within a template.
Variables declared here are extracted from the template YAML during
the first parsing pass (before Jinja2 rendering). The variables
section must use plain YAML -- no Jinja2 expressions.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
NotBlankStr
|
Variable name (used in |
description |
str
|
Human-readable description for prompts/docs. |
var_type |
Literal['str', 'int', 'float', 'bool']
|
Expected Python type name. |
default |
str | int | float | bool | None
|
Default value ( |
required |
bool
|
Whether the user must provide this value. |
Config:
frozen:Trueextra:forbidallow_inf_nan:False
Fields:
-
name(NotBlankStr) -
description(str) -
var_type(Literal['str', 'int', 'float', 'bool']) -
default(str | int | float | bool | None) -
required(bool) -
hidden(bool)
Validators:
-
_validate_required_has_no_default -
_validate_hidden_is_not_required -
_validate_default_matches_var_type
hidden
pydantic-field
¶
When True the setup wizard does not render an input for this variable; its default is applied. Reserved for advanced knobs the operator can change later in the dashboard, so the wizard stays focused on the few choices that matter up front.
TemplateAgentConfig
pydantic-model
¶
Bases: BaseModel
Agent definition within a template.
Uses string references and presets rather than full AgentConfig.
The renderer expands these into full agent configuration dicts.
Attributes:
| Name | Type | Description |
|---|---|---|
role |
NotBlankStr
|
Built-in role name (case-insensitive match to role catalog). |
name |
NotBlankStr | None
|
Agent name (may contain Jinja2 placeholders). |
level |
SeniorityLevel
|
Seniority level override. |
model |
NotBlankStr | dict[str, JsonValue]
|
A model reference: either an explicit configured model
id/alias string, or a structured |
personality_preset |
NotBlankStr | None
|
Named personality preset from the presets registry. |
personality |
dict[str, JsonValue] | None
|
Inline personality config dict (alternative to
|
department |
NotBlankStr | None
|
Department override ( |
strategic_output_mode |
StrategicOutputMode | None
|
Strategic output mode override for this
agent ( |
merge_id |
NotBlankStr | None
|
Stable identity for inheritance merge. When a
template has multiple agents with the same |
remove |
bool
|
Merge directive -- when |
Config:
frozen:Trueextra:forbidallow_inf_nan:False
Fields:
-
role(NotBlankStr) -
name(NotBlankStr | None) -
level(SeniorityLevel) -
model(NotBlankStr | dict[str, JsonValue]) -
personality_preset(NotBlankStr | None) -
personality(dict[str, JsonValue] | None) -
department(NotBlankStr | None) -
strategic_output_mode(StrategicOutputMode | None) -
merge_id(NotBlankStr | None) -
remove(bool)
Validators:
-
_validate_model→model -
_deep_copy_personality -
_validate_personality_mutual_exclusion
strategic_output_mode
pydantic-field
¶
Strategic output mode override for this agent
TemplateDepartmentConfig
pydantic-model
¶
Bases: BaseModel
Department definition within a template.
Provides structural information -- department names, budget allocations, the head role, reporting lines, and operational policies.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
NotBlankStr
|
Department name (standard or custom). |
budget_percent |
float
|
Percentage of company budget (0-100). |
head_role |
NotBlankStr | None
|
Role name of the department head. |
head_merge_id |
NotBlankStr | None
|
Optional |
reporting_lines |
tuple[dict[str, str], ...]
|
Reporting line definitions within this department. |
policies |
dict[str, JsonValue] | None
|
Department operational policies. |
ceremony_policy |
dict[str, JsonValue] | None
|
Per-department ceremony policy override
( |
remove |
bool
|
Merge directive -- when |
Config:
frozen:Trueextra:forbidallow_inf_nan:False
Fields:
-
name(NotBlankStr) -
budget_percent(float) -
head_role(NotBlankStr | None) -
head_merge_id(NotBlankStr | None) -
reporting_lines(tuple[dict[str, str], ...]) -
policies(dict[str, JsonValue] | None) -
ceremony_policy(dict[str, JsonValue] | None) -
remove(bool)
Validators:
-
_validate_head_merge_id_requires_head_role
TemplateMetadata
pydantic-model
¶
Bases: BaseModel
Metadata about a company template.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
NotBlankStr
|
Template display name. |
description |
str
|
What this template is for. |
version |
NotBlankStr
|
Semantic version string. |
company_type |
CompanyType
|
Which |
min_agents |
int
|
Minimum number of agents. |
max_agents |
int
|
Maximum number of agents. |
tags |
tuple[NotBlankStr, ...]
|
Categorization tags. |
skill_patterns |
tuple[SkillPattern, ...]
|
Skill interaction patterns this template exhibits. |
Config:
frozen:Trueextra:forbidallow_inf_nan:False
Fields:
-
name(NotBlankStr) -
description(str) -
version(NotBlankStr) -
company_type(CompanyType) -
min_agents(int) -
max_agents(int) -
tags(tuple[NotBlankStr, ...]) -
skill_patterns(tuple[SkillPattern, ...])
Validators:
-
_validate_agent_range -
_validate_unique_skill_patterns
TemplateMemoryConfig
pydantic-model
¶
Bases: BaseModel
Template-level memory configuration overrides.
Attributes:
| Name | Type | Description |
|---|---|---|
embedder |
EmbedderOverrideConfig | None
|
Optional embedder override for the template. |
Config:
frozen:Trueextra:forbidallow_inf_nan:False
Fields:
-
embedder(EmbedderOverrideConfig | None)
CompanyTemplate
pydantic-model
¶
Bases: BaseModel
A complete company template definition.
This is the top-level model parsed from a template YAML file during the first pass (before Jinja2 rendering). It holds metadata, variable declarations, and the structural definitions for agents and departments.
The raw YAML text is stored separately by the loader for the second pass (Jinja2 rendering).
Attributes:
| Name | Type | Description |
|---|---|---|
metadata |
TemplateMetadata
|
Template metadata. |
variables |
tuple[TemplateVariable, ...]
|
Declared template variables (plain YAML, no Jinja2). |
agents |
tuple[TemplateAgentConfig, ...]
|
Template agent definitions. |
departments |
tuple[TemplateDepartmentConfig, ...]
|
Template department definitions. |
workflow |
WorkflowType
|
Workflow name. |
workflow_config |
dict[str, JsonValue]
|
Optional Kanban/Sprint sub-configurations,
validated as |
communication |
NotBlankStr
|
Communication pattern name. |
budget_monthly |
float
|
Default monthly budget in the configured currency. |
autonomy |
dict[str, JsonValue]
|
Autonomy configuration dict (e.g. |
workflow_handoffs |
tuple[dict[str, JsonValue], ...]
|
Cross-department workflow handoff definitions. |
escalation_paths |
tuple[dict[str, JsonValue], ...]
|
Cross-department escalation path definitions. |
extends |
NotBlankStr | None
|
Parent template name for inheritance ( |
memory |
TemplateMemoryConfig
|
Memory configuration overrides (e.g. embedder settings). |
Config:
frozen:Trueextra:forbidallow_inf_nan:False
Fields:
-
metadata(TemplateMetadata) -
variables(tuple[TemplateVariable, ...]) -
agents(tuple[TemplateAgentConfig, ...]) -
departments(tuple[TemplateDepartmentConfig, ...]) -
workflow(WorkflowType) -
workflow_config(dict[str, JsonValue]) -
communication(NotBlankStr) -
budget_monthly(float) -
autonomy(dict[str, JsonValue]) -
workflow_handoffs(tuple[dict[str, JsonValue], ...]) -
escalation_paths(tuple[dict[str, JsonValue], ...]) -
extends(NotBlankStr | None) -
uses_packs(tuple[NotBlankStr, ...]) -
posture(PostureName | None) -
memory(TemplateMemoryConfig)
Validators:
-
_normalize_extends→extends -
_validate_agent_count_in_range -
_validate_unique_variable_names -
_validate_unique_department_names -
_validate_unique_pack_names
workflow_config
pydantic-field
¶
Optional Kanban/Sprint sub-configurations. Validated as WorkflowConfig on the rendered RootConfig.
budget_monthly
pydantic-field
¶
Default monthly budget in the configured currency
posture
pydantic-field
¶
Named operating posture that expands to a feature-flag bundle
Loader¶
loader
¶
Template loading from built-in, user directory, and file-system sources.
Implements a two-pass loading strategy:
- Pass 1: YAML-parse the template to extract metadata and the
variablessection (which uses plain YAML, no Jinja2). - Pass 2: Performed later by the renderer -- Jinja2-renders the raw YAML text, then YAML-parses the result.
Both are returned bundled as a :class:LoadedTemplate dataclass.
TemplateInfo
dataclass
¶
TemplateInfo(
name,
display_name,
description,
source,
tags=(),
skill_patterns=(),
variables=(),
agent_count=0,
department_count=0,
autonomy_level=SEMI,
workflow="agile_kanban",
posture=None,
)
Summary information about an available template.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Template identifier (e.g. |
display_name |
str
|
Human-readable display name. |
description |
str
|
Short description. |
source |
Literal['builtin', 'user']
|
Where the template was found ( |
tags |
tuple[str, ...]
|
Free-form categorization tags for filtering and discovery. |
skill_patterns |
tuple[SkillPattern, ...]
|
Skill design pattern identifiers describing how the template's agents interact. |
variables |
tuple[TemplateVariable, ...]
|
User-configurable |
agent_count |
int
|
Number of agents defined in the template. |
department_count |
int
|
Number of departments defined in the template. |
autonomy_level |
AutonomyLevel
|
Autonomy level governing approval routing. |
workflow |
str
|
Workflow type (e.g. |
LoadedTemplate
dataclass
¶
Result of loading a template: structured data + raw text.
Attributes:
| Name | Type | Description |
|---|---|---|
template |
CompanyTemplate
|
Validated |
raw_yaml |
str
|
Raw YAML text for Pass 2 (Jinja2 rendering). |
source_name |
str
|
Label for error messages. |
list_templates
¶
Return all available templates (user directory + built-in).
User templates override built-in ones. Sorted by name.
Returns:
| Type | Description |
|---|---|
tuple[TemplateInfo, ...]
|
Sorted tuple of :class: |
Source code in src/synthorg/templates/loader.py
list_builtin_templates
¶
Return names of all built-in templates.
Returns:
| Type | Description |
|---|---|
tuple[str, ...]
|
Sorted tuple of built-in template names. |
load_template
¶
Load a template by name: user directory first, then builtins.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Template name (e.g. |
required |
Returns:
| Type | Description |
|---|---|
LoadedTemplate
|
class: |
Raises:
| Type | Description |
|---|---|
TemplateNotFoundError
|
If no template with name exists. |
Source code in src/synthorg/templates/loader.py
load_template_file
¶
Load a template from an explicit file path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path | str
|
Path to the template YAML file. |
required |
Returns:
| Type | Description |
|---|---|
LoadedTemplate
|
class: |
Raises:
| Type | Description |
|---|---|
TemplateNotFoundError
|
If the file does not exist. |
TemplateValidationError
|
If validation fails. |
Source code in src/synthorg/templates/loader.py
Renderer¶
renderer
¶
Template rendering: Jinja2 substitution + validation to RootConfig.
Implements the second pass of the two-pass rendering pipeline:
- Collect user variables + defaults from the
CompanyTemplate. - Render the raw YAML text through a Jinja2
SandboxedEnvironment. - YAML-parse the rendered text.
- Build a
RootConfig-compatible dict and validate.
Template inheritance (extends) is resolved at the renderer level:
each template's Jinja2 is rendered independently, then configs are
merged via :func:~synthorg.templates.merge.merge_template_configs.
Config-dict assembly lives in
:mod:synthorg.templates._config_assembly; agent expansion lives in
:mod:synthorg.templates._agent_expansion.
render_template
¶
Render a loaded template into a validated RootConfig.
Resolves template inheritance (extends) before validation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loaded
|
LoadedTemplate
|
:class: |
required |
variables
|
dict[str, object] | None
|
User-supplied variable values (overrides defaults). |
None
|
locales
|
list[str] | None
|
Faker locale codes for auto-name generation.
Defaults to all Latin-script locales when |
None
|
custom_presets
|
Mapping[str, dict[str, JsonValue]] | None
|
Optional mapping of custom preset names to personality config dicts for resolving user-defined presets. |
None
|
Returns:
| Type | Description |
|---|---|
RootConfig
|
Validated, frozen :class: |
Raises:
| Type | Description |
|---|---|
TemplateRenderError
|
If rendering fails. |
TemplateValidationError
|
If validation fails. |
TemplateInheritanceError
|
If inheritance resolution fails. |
Source code in src/synthorg/templates/renderer.py
Merge¶
merge
¶
Template config merging for inheritance.
Provides merge_template_configs which combines a parent config dict
with a child config dict, implementing the merge semantics described in
the template inheritance design.
merge_template_configs
¶
Merge a parent config dict with a child config dict.
Merge strategies by field:
company_name,company_type: child wins if present.config,security,budget(dict): deep-merged; child keys override parent.agents(list): merged by(role, department, merge_id)key.departments(list): merged byname(case-insensitive).workflow,workflow_handoffs,escalation_paths,posture: child replaces entirely if present; otherwise inherited from parent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent
|
dict[str, object]
|
Rendered parent config dict (post-Jinja2, pre-defaults). |
required |
child
|
dict[str, object]
|
Rendered child config dict (post-Jinja2, pre-defaults). |
required |
Returns:
| Type | Description |
|---|---|
dict[str, object]
|
New merged config dict. |
Source code in src/synthorg/templates/merge.py
Presets¶
presets
¶
Personality presets and auto-name generation for templates.
Provides comprehensive personality presets with Big Five dimensions and behavioral enums, plus internationally diverse auto-name generation backed by the Faker library.
get_personality_preset
¶
Look up a personality preset by name.
Custom presets take precedence over builtins; the result is a fresh one-level copy with any tuple-valued field normalised to a JSON list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Preset name (case-insensitive, whitespace-stripped). |
required |
custom_presets
|
Mapping[str, dict[str, JsonValue]] | None
|
Optional mapping of custom preset names to personality config dicts. Keys must be lowercased. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, JsonValue]
|
A fresh JSON-shaped copy of the personality configuration dict. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If the preset name is not found in either source. |
Source code in src/synthorg/templates/presets.py
get_strategic_output_default
¶
Return the default strategic output mode for a seniority level.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
SeniorityLevel
|
Agent seniority level. |
required |
Returns:
| Type | Description |
|---|---|
StrategicOutputMode | None
|
Default strategic output mode, or |
StrategicOutputMode | None
|
no strategic default (i.e. strategic output is not applicable). |
Source code in src/synthorg/templates/presets.py
validate_preset_references
¶
Check all agent personality_preset references against known presets.
Returns a tuple of warning messages for unknown presets. Does not raise -- purely advisory for pre-flight validation and template import/export scenarios.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template
|
CompanyTemplate
|
Parsed template to validate. |
required |
custom_presets
|
Mapping[str, dict[str, JsonValue]] | None
|
Optional custom preset mapping. Keys must be lowercased. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[str, ...]
|
Tuple of warning strings (empty when all presets are known). |
Source code in src/synthorg/templates/presets.py
generate_auto_name
¶
Generate an internationally diverse agent name using Faker.
With seed, a fresh single-locale Faker instance is used so the shared cached instance is never mutated. role is accepted for positional-caller compatibility but does not influence the name; locales defaults to all Latin-script locales when None or empty.
Returns:
| Type | Description |
|---|---|
str
|
A generated full name string. |
Source code in src/synthorg/templates/presets.py
Model Requirements¶
model_requirements
¶
Structured model requirements and personality-based model affinity.
Provides :class:ModelRequirement for expressing what kind of LLM an
agent needs (priority, context window, capability flags, family/pattern,
or an explicit example id) and a preset-keyed affinity mapping that
supplies capability defaults when the template does not state full
requirements.
A template agent references a model by one of three forms, all expressed
through :class:ModelRequirement:
- explicit example id (
model_id): pin a concrete configured model. - family / pattern (
family/model_pattern): resolve to the newest configured model matching the family or glob. - capability (
requires_tools/requires_vision/requires_reasoningpluspriority/min_context): let the matcher pick the best-fitting configured model.
There is no tier-string selection axis: the matcher classifies models by
real metadata, and ModelMatch.tier is report-only.
ModelTier
module-attribute
¶
Model capability tier: large (most capable), medium, small (cheapest).
ModelRequirement
pydantic-model
¶
Bases: BaseModel
Structured model requirement for a template agent.
Describes what an agent needs from an LLM. Resolution order at match
time is explicit model_id first, then family / model_pattern,
then capability scoring over the survivors of the hard filters.
Attributes:
| Name | Type | Description |
|---|---|---|
model_id |
NotBlankStr | None
|
Explicit configured model id (or alias) to pin. When set, the matcher selects this exact model and skips family/capability scoring. |
priority |
ModelPriority
|
Optimisation axis when several models clear the filters. |
min_context |
int
|
Minimum context window in tokens (0 = no minimum). |
requires_tools |
bool
|
Hard-require function/tool-calling support. |
requires_vision |
bool
|
Hard-require image-input support. |
requires_reasoning |
bool
|
Hard-require extended-reasoning support. |
family |
NotBlankStr | None
|
Resolve to the newest configured model in this family
(e.g. |
model_pattern |
NotBlankStr | None
|
Resolve to the newest configured model whose id
matches this glob (e.g. |
Config:
frozen:Trueextra:forbidallow_inf_nan:False
Fields:
-
model_id(NotBlankStr | None) -
priority(ModelPriority) -
min_context(int) -
requires_tools(bool) -
requires_vision(bool) -
requires_reasoning(bool) -
family(NotBlankStr | None) -
model_pattern(NotBlankStr | None)
Validators:
-
_validate_resolution_axes
parse_model_requirement
¶
Parse a model requirement from an explicit id string or a dict.
A bare string is an explicit example-id pin (model_id); a dict maps
directly onto the :class:ModelRequirement capability/family fields.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raw
|
str | dict[str, JsonValue]
|
Either a non-blank model id/alias string, or a dict with
|
required |
Returns:
| Type | Description |
|---|---|
ModelRequirement
|
Parsed |
Raises:
| Type | Description |
|---|---|
ValueError
|
If raw is a blank string. |
ValidationError
|
If raw is a dict with invalid fields. |
Source code in src/synthorg/templates/model_requirements.py
resolve_model_requirement
¶
Merge a personality-preset affinity profile with explicit overrides.
The affinity profile supplies capability defaults (priority, context floor, hard requirement flags, optional family hint); any field the template states explicitly via overrides always wins.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
preset_name
|
str | None
|
Optional personality preset name for affinity lookup. |
None
|
overrides
|
dict[str, JsonValue] | None
|
Explicit |
None
|
Returns:
| Type | Description |
|---|---|
ModelRequirement
|
Resolved |
Source code in src/synthorg/templates/model_requirements.py
Model Matcher¶
model_matcher
¶
Capability-aware model-matching engine.
Given a :class:~synthorg.templates.model_requirements.ModelRequirement
and a set of available provider models, selects the best-fit model by
(a) hard-filtering on declared capability requirements against each
model's persisted metadata, (b) resolving any family/pattern reference
to the newest matching configured model and pinning a concrete id, and
(c) scoring the survivors on an absolute capability / context / priority
composite. Selection is pluggable via :class:ModelSelectionStrategy.
ModelMatch
pydantic-model
¶
Bases: BaseModel
Result of matching a single agent to a provider model.
Attributes:
| Name | Type | Description |
|---|---|---|
agent_index |
int
|
Index of the agent in the template agent list. |
provider_name |
NotBlankStr
|
Name of the matched provider. |
model_id |
NotBlankStr
|
Matched (pinned) model identifier. |
tier |
ModelTier
|
Report-only tier derived from the selected model's metadata. |
score |
float
|
Match quality score (higher is better, 0-1 range). |
Config:
frozen:Trueextra:forbidallow_inf_nan:False
Fields:
-
agent_index(int) -
provider_name(NotBlankStr) -
model_id(NotBlankStr) -
tier(ModelTier) -
score(float)
ModelSelectionStrategy
¶
Bases: Protocol
Selects the best model for a requirement from candidates.
select
¶
Return the best model and its 0-1 score (or None, 0.0).
Source code in src/synthorg/templates/model_matcher.py
CapabilityFitStrategy
¶
Default capability-aware selection strategy.
Phase A hard-filters on declared capability requirements (optimistic for
un-probed metadata -- a required capability fails only when the model is
known to lack it; see :func:passes_hard_filters); phase B pins the
newest model matching a family/pattern reference; phase C scores survivors
on an absolute capability / context / priority composite.
select
¶
Select the best model for requirement from candidates.
Resolution order: an explicit model_id pin wins outright (the
user chose it, so the capability hard-filters do not apply); then a
family / model_pattern reference pins the newest match; then
capability scoring over the hard-filter survivors.
Returns:
| Type | Description |
|---|---|
ProviderModelConfig | None
|
|
float
|
when nothing matches the pin / clears the hard filters. |
Source code in src/synthorg/templates/model_matcher.py
passes_hard_filters
¶
Return True when model clears every hard requirement.
Optimistic: a required capability is a hard fail only when the model is
known to lack it (litellm / probe metadata with the flag False).
A model with unknown metadata is allowed through -- most modern models
support tools/reasoning, and excluding every un-probed cloud model would
leave agents unassigned.
Runtime tool-call feedback overrides optimism: a model whose
tool_calls_verified is False has proven at runtime that it cannot
call tools, so it is excluded for requires_tools agents regardless of
metadata source (the runtime signal is authoritative over the
discovery-time claim).
Returns:
| Type | Description |
|---|---|
bool
|
True when the model meets the context floor and every required |
bool
|
capability it is known to possess (or has unknown metadata for). |
Source code in src/synthorg/templates/model_matcher.py
get_model_selection_strategy
¶
Return the default model-selection strategy singleton.
Returns:
| Type | Description |
|---|---|
ModelSelectionStrategy
|
The shared :class: |
ModelSelectionStrategy
|
|
Source code in src/synthorg/templates/model_matcher.py
match_model
¶
Select the best model for a requirement from available models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
requirement
|
ModelRequirement
|
Structured model requirement. |
required |
available
|
tuple[ProviderModelConfig, ...]
|
Tuple of available models from a single provider. |
required |
matcher_config
|
ModelMatcherConfig | None
|
Operator-tunable score weights. |
None
|
strategy
|
ModelSelectionStrategy | None
|
Selection strategy. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[ProviderModelConfig | None, float]
|
Tuple of (best matching model or None, score 0-1). |
Source code in src/synthorg/templates/model_matcher.py
match_all_agents
¶
match_all_agents(
agents, providers, matcher_config=None, strategy=None, *, tier_profile="balanced"
)
Batch-match template agents to provider models.
For each agent, resolves its model requirement and finds the best
model across all configured providers. The reported tier is
derived from the selected model's metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agents
|
Sequence[Mapping[str, object]]
|
List of expanded agent config dicts. Requirement
resolution checks |
required |
providers
|
Mapping[str, _ProviderWithModels]
|
Provider name -> provider config mapping; each must
expose a |
required |
matcher_config
|
ModelMatcherConfig | None
|
Operator-tunable score weights. |
None
|
strategy
|
ModelSelectionStrategy | None
|
Selection strategy. |
None
|
tier_profile
|
str
|
Company model-tier profile ('economy' | 'balanced' | 'premium') that nudges each agent's resolved priority one rung along the cost<->quality ladder before matching; 'balanced' is a no-op, so an unset profile leaves matching unchanged. |
'balanced'
|
Returns:
| Type | Description |
|---|---|
list[ModelMatch]
|
List of |
list[ModelMatch]
|
clears its hard capability requirements (a model the agent's required |
list[ModelMatch]
|
capability is known to lack), when no models exist anywhere, or when |
list[ModelMatch]
|
requirement resolution fails. Callers handle an omitted agent (left |
list[ModelMatch]
|
unassigned at setup). |
Source code in src/synthorg/templates/model_matcher.py
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | |
Errors¶
errors
¶
Custom exception hierarchy for template errors.
TemplateError
¶
TemplateNotFoundError
¶
TemplateRenderError
¶
Bases: TemplateError
Raised when template rendering fails.
Covers Jinja2 evaluation errors, missing required variables, YAML parse errors during template processing, and invalid numeric values in rendered output.
Source code in src/synthorg/config/errors.py
TemplateInheritanceError
¶
Bases: TemplateRenderError
Raised when template inheritance fails.
Covers circular inheritance chains, excessive depth, and merge conflicts.
Source code in src/synthorg/config/errors.py
TemplatePostureError
¶
Bases: TemplateError
Raised when posture resolution fails.
Covers a posture name with no registered feature bundle, an unknown expansion-strategy discriminator, and an inheritance/pack graph that exceeds the maximum resolution depth (a likely cycle).
Source code in src/synthorg/config/errors.py
TemplateValidationError
¶
Bases: TemplateError
Raised when a rendered template fails validation.
Attributes:
| Name | Type | Description |
|---|---|---|
field_errors |
Per-field error messages as
|
Source code in src/synthorg/templates/errors.py
__str__
¶
Format validation error with per-field details.
Returns:
| Type | Description |
|---|---|
str
|
The base message when there are no field errors, otherwise a |
str
|
header line plus one indented line per field error. |