Skip to content

API Reference parrot.tools.infographic_recipes.freeze

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.tools.infographic_recipes.freeze

View source

Freeze path — normalize a live session envelope + provenance into a persisted :class:InfographicRecipe (Module 6, FEAT-324, spec G2).

The freeze path is the LLM half of dual authorship: an agent composes an infographic interactively, then "freezes" the EXACT construction (which registered datasets, which registered transformer calls, and the resulting layout) into a recipe that replays identically without the LLM.

Explicit provenance only (spec §7 documented boundary, not a bug): this function does NOT attempt to reverse-engineer a session's pandas/REPL history. It requires the caller (the toolkit tool method) to supply dataset_names and transform_steps explicitly — if a session's dataModel values were computed by ad-hoc REPL pandas rather than registered @infographic_transformer calls, that provenance genuinely cannot be expressed as recipe steps, and freezing must be rejected with a clear message rather than silently producing a recipe that cannot replay.

Class FreezeProvenanceError

Raised when a session's data provenance cannot be expressed as recipe steps.

This is the documented boundary of spec G2, not a bug: freeze requires explicit dataset + registered-transformer provenance; it never attempts to infer that provenance from ad-hoc REPL computation.

Class FreezeValidationError

Raised when the normalized recipe fails :meth:RecipeRunner.dry_run.

Parameter Type Default Description
errors list[RecipeRunError]

Attributes:

Attribute Type Description
errors ALL collected :class:RecipeRunError diagnostics (spec G4 — collect everything, not just the first problem).

Function freeze_session_envelope

Normalize a live envelope + explicit provenance into a dry-run-clean recipe.

freeze_session_envelope(envelope: CreateSurface, *, dataset_names: dict[str, str], transform_steps: list[dict[str, Any]] | list[TransformStep], name: str, title: str, runner: RecipeRunner, description: Optional[str] = None, owner: Optional[str] = None, params: Optional[list[RecipeParam]] = None, render_profile: str = 'interactive-html', theme: Optional[str] = None) -> InfographicRecipe

Parameter Type Default Description
envelope CreateSurface A single-component CreateSurface (e.g. from build_surface/build_infographic) representing the session's current infographic layout.
dataset_names dict[str, str] Data-source alias -> registered DatasetManager dataset name (e.g. {"snapshots": "budget_ledger"}).
transform_steps list[dict[str, Any]] | list[TransformStep] Ordered transform-step provenance — either TransformStep instances or dicts shaped like {"transformer": ..., "inputs": [...], "params": {...}, "output_key": ...}. Every entry MUST name a value that was actually produced by a registered @infographic_transformer call in this session.
name str Unique recipe name (storage key).
title str Human-readable recipe title.
runner RecipeRunner The :class:RecipeRunner used to dry_run the normalized recipe before returning it.
description Optional[str] None Optional longer description.
owner Optional[str] None Owner scope for the recipe (spec: toolkit's resolved user/agent scope).
params Optional[list[RecipeParam]] None Declared recipe params (defaults empty — freeze captures a snapshot; param-ization of a frozen recipe is a follow-up refinement, not required for a valid freeze).
render_profile str 'interactive-html' Renderer profile name for replay (default "interactive-html").
theme Optional[str] None Optional theme name.

Returns: InfographicRecipe — The normalized, dry-run-clean :class:InfographicRecipe (NOT YET persisted — the caller persists via AbstractRecipeStore.save).

Raises:

  • FreezeProvenanceError — If dataset_names/transform_steps is empty, or envelope does not carry exactly one component.
  • FreezeValidationError — If the normalized recipe fails dry_run (carries ALL collected diagnostics).

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally