Contributing a recipe (and recipe step kinds)
A recipe is an ordered list of steps that takes an instance from "nothing installed" to "this preset generates". The first-run wizard runs one, and so does Admin → Recipes.
Shipping a recipe#
An enabled plugin can ship its own recipe, the same way it can ship its own preset (see
presets: below and Presets). Declare a recipes: root in manifest.yml;
no Python import or handler is required:
recipes:
- path: "recipes" # a dir in the plugin, relative to the plugin rootThe dir is scanned for *.yml recipe files exactly like the core content/recipes/
tree, and only while the plugin is enabled. A recipe id colliding with a core recipe id
is reported as a load error and the core recipe wins — same precedence a local recipe
colliding with a marketplace one gets. content/plugins/marketplace/comfyui-backend/
ships comfyui-detect this way: the recipe is useless without the plugin installed, so
it lives with it, alongside the comfyui presets it installs.
A step that only makes sense during the first-run wizard is marked onboarding_only: true and is skipped by a run started from Admin → Recipes. Core's workspace.activate
(which closes onboarding out) is the one built-in step that carries the flag.
An artifacts[] entry can mark itself gated: true with a license_url: when the
source requires an accepted licence or access token before it will serve the file (a
gated Hugging Face repo, say). artifacts.plan then adds a non-fatal warning to the
run's consent request when that artifact's resolved provider has no credential
configured yet, pointing the owner at the licence and Admin → Plugins.
An artifacts[] entry can instead declare variants:, the same model slot in several
precisions. The file fields (filename, size_bytes, checksum, provider_hint,
gated, license_url) then move onto each variant, next to id, label (plain words
such as "Balanced"), precision (bf16, fp16, fp8, int8 or nvfp4), uploader,
source_url and optional recommended_for rules (min_vram_gb and/or generations
from ampere, ada, hopper, blackwell, other). Exactly one variant is marked
default: true; it is used when no GPU is detected. artifacts.plan picks the first
variant (in file order, so list the best quality first) whose rules match the detected
GPU and whose precision that GPU can run, and falls back to the smallest one the recipe
recommends for that GPU generation at any VRAM (the smallest one it can run when none
targets the generation). A variant already on disk always wins. The owner can override the pick per
slot when approving the download. python scripts/hf_variants.py <repo> <glob>... --default <id> prints ready-to-paste variants: YAML for a Hugging Face repo.
Contributing a step kind#
Every step names a kind:, and a plugin can add kinds of its own. Declare them under
recipe_steps::
recipe_steps:
- kind: collections.ensure
backend: steps:EnsureCollections # "module.path:ClassName" - a src/plugin_api/recipes.py StepExecutorbackend is loaded the same way a field_types[].schema_class is, and instantiated once
when the plugin enables. A kind that collides with a core kind, or with one another
enabled plugin already owns, fails the enable. Implement it against
src.plugin_api.recipes:
from src.plugin_api.recipes import StepContext, StepExecutor, StepResult
class EnsureCollections(StepExecutor):
def execute(self, context: StepContext) -> StepResult:
wanted = context.step.params.get("collections", [])
if not wanted:
return StepResult.fail(
"NO_COLLECTIONS",
"This step needs at least one collection to create.",
suggested_repair="Add a `collections:` list to the step's params.",
)
return StepResult.ok({"created": len(wanted)})StepContext carries the run, the parsed recipe, the step being run, and a
report_progress(current, total, unit) callback a long-running step should call from its
own poll loop so the UI can render progress before the step finishes. Besides ok and
fail, a step can return StepResult.awaiting(consent_request) to park the run until an
admin explicitly approves — that is how a multi-GB download gets a go-ahead. Failure
messages are read by a non-technical owner mid-setup, so write them as a plain sentence
and put any admin-shaped fix in suggested_repair. Keep exception text out of that sentence: pass
it as StepResult.fail(..., technical_detail="..."), which the wizard and Admin → Recipes show
only behind a "Details" disclosure.
A step kind can set a class attribute advisory = True to make its failure advisory: the attempt
is recorded as action_required ("Needs attention") with the same sentence, repair hint and
technical text, and the run carries on with the next step instead of failing. Use it for a check
whose failure should not strand an install, such as core's generation.smoke test picture. A
step that is not advisory still fails the run.
Registration makes the kind both runnable and lintable: scripts/recipe_lint.py and the
running catalog accept recipes using it, while an unregistered kind stays an unknown-kind
error. Disabling the plugin takes the kind away again.
A step kind may implement three optional methods next to execute:
validate_params(params, recipe, lint: LintContext) -> list[str]— param checks. The running catalog rejects a recipe whose steps fail them, andscripts/recipe_lint.pyreports them (rule R7).lint.preset_indexmaps preset ids to loaded presets.preview(context) -> dict— a side-effect-free summary for the dry run (POST /api/recipes/{id}/plan). Return{"summary": "...", "consent_request": {...}?}.grant(context, consent_request, grant: GrantRequest) -> dict— called when an admin approves a step parked onawaiting(...).grantcarriesselections,modes,extrasandtargetfrom the approval body; raiseValueErrorwith a plain sentence to reject it. The returned dict is stored on the approving attempt, where later steps read it throughcontext.step_outputs[step_key](orcontext.plans(...)for aplankey).
context.is_cancelled() turns true when an admin cancels the run while the step is still running;
a long poll loop should check it, stop its own work and return. report_progress(...) also takes a
safe_output= dict to show richer interim state (the download step uses it for per-file rows).
A consent_request passed to StepResult.awaiting(...) is rendered by the same consent sheet as
core's own steps. These keys are understood, all optional: artifacts (files with id,
display_name, size_bytes, kind, gated, license_url), total_bytes, slots (per-slot
variant pickers), modes (a mode checklist), manifest, disk, estimate, providers (missing
credential prompts), warnings, checking and target. See
src/features/recipes/mode_plans.py for the full modes.plan payload.
Installing preset modes#
Core's modes.plan step takes its files from a preset's own model-field recommendations:
instead of a hand-written artifacts: list. It offers every mode (modes: "all"), pre-ticks
selected, keeps locked modes ticked (the smoke mode), offers optional files as extras
(extras: offer, pre-ticked by preselect_extras), and parks for consent with the mode
checklist above. Follow it with artifacts.fetch {plan: <step key>} (downloads in parallel,
re-checks free disk, writes to a remote worker when that is the target), preset.defaults {plan} (fills empty or broken form-override defaults with the downloaded files) and
pipeline.render {plan} (renders every chosen mode). Every native preset with downloadable
recommendations also gets a derived modes-<preset> recipe with exactly these steps, and
python scripts/recipe_new.py <preset> scaffolds a starter that uses them;
python scripts/recipe_lint.py --explain <recipe> prints what each mode would download.