loader
loader
¶
Recipe loader — load and resolve TOML recipe files.
Recipes are the universal composition format for Diapason. Each recipe
specifies all five primitives (Intelligence, Engine, Agent, Tools, Learning)
and carries a kind that determines its lifecycle:
"discrete"— one-shot or benchmark-oriented agents"operator"— persistent, scheduled agents
Classes¶
Recipe
dataclass
¶
Recipe(
name: str,
description: str = "",
version: str = "0.1.0",
kind: str = "discrete",
model: Optional[str] = None,
quantization: Optional[str] = None,
provider: Optional[str] = None,
engine_key: Optional[str] = None,
agent_type: Optional[str] = None,
max_turns: Optional[int] = None,
temperature: Optional[float] = None,
max_tokens: Optional[int] = None,
tools: List[str] = list(),
system_prompt: Optional[str] = None,
system_prompt_path: Optional[str] = None,
routing_policy: Optional[str] = None,
agent_policy: Optional[str] = None,
eval_suites: List[str] = list(),
eval_benchmarks: List[str] = list(),
eval_backend: Optional[str] = None,
eval_max_samples: Optional[int] = None,
eval_judge_model: Optional[str] = None,
schedule_type: Optional[str] = None,
schedule_value: Optional[str] = None,
channels: List[str] = list(),
required_capabilities: List[str] = list(),
raw: Dict[str, Any] = dict(),
)
A composable primitive configuration loaded from TOML.
Covers both discrete agents (benchmarking / one-shot) and operator
agents (persistent / scheduled) through the kind field.
Methods:¶
to_builder_kwargs
¶
Convert recipe fields to kwargs for SystemBuilder/Diapason.
Returns a dict with only the non-None fields, keyed to match the SystemBuilder fluent API or Diapason constructor parameters.
Source code in src/diapason/recipes/loader.py
to_eval_suite
¶
to_eval_suite(
benchmarks: Optional[List[str]] = None,
max_samples: Optional[int] = None,
judge_model: Optional[str] = None,
) -> Any
Convert this recipe into an EvalSuiteConfig.
Uses the recipe's model/engine as the single [[models]] entry
and the recipe's benchmarks (or benchmarks override) as
[[benchmarks]], inheriting agent type and tools.
Source code in src/diapason/recipes/loader.py
to_operator_manifest
¶
Functions:¶
load_recipe
¶
load_recipe(path: str | Path) -> Recipe
Load a recipe from a TOML file.
Supports the unified format with [recipe], [intelligence],
[engine], [agent], [learning], [eval], [schedule],
and [channels] sections. Also auto-detects legacy operator manifests
that use [operator] as the top-level key.
Raises: FileNotFoundError: If path does not exist.
Source code in src/diapason/recipes/loader.py
discover_recipes
¶
discover_recipes(
extra_dirs: Optional[List[str | Path]] = None,
*,
kind: Optional[str] = None,
) -> List[Recipe]
Discover all TOML recipes from known directories.
Search order (later entries override earlier ones by name):
1. Project recipes/data/ directory (discrete recipes)
2. Project recipes/data/operators/ directory (operator recipes)
3. User ~/.diapason/recipes/ directory
4. User ~/.diapason/operators/ directory
5. Any additional directories in extra_dirs
Args: extra_dirs: Additional directories to scan. kind: If set, filter to only "discrete" or "operator" recipes.