Skip to content

loader

diapason.recipes.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

Recipe dataclass

A composable primitive configuration loaded from TOML.

Covers both discrete agents (benchmarking / one-shot) and operator agents (persistent / scheduled) through the kind field.

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.

to_eval_suite(benchmarks=None, max_samples=None, judge_model=None)

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.

to_operator_manifest()

Convert this recipe into an OperatorManifest.

discover_recipes(extra_dirs=None, *, kind=None)

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

Parameters:

Name Type Description Default
extra_dirs Optional[List[str | Path]]

Additional directories to scan.

None
kind Optional[str]

If set, filter to only "discrete" or "operator" recipes.

None

load_recipe(path)

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:

Type Description
FileNotFoundError

If path does not exist.

resolve_recipe(name)

Find a recipe by name from all known directories.

Returns None if no recipe with the given name is found.