Skip to content

API Reference parrot.bots.flows.authoring.schemas

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

parrot.bots.flows.authoring.schemas

View source

JSON Schemas handed to the authoring model, and a schema-level check.

Two things a static model_json_schema() cannot express on its own:

  • which node kinds are legal — that depends on the live NODE_REGISTRY and the chosen engine, and the registry is populated by import side effects, so it can only be known at call time;
  • which tools exist — that is the catalog, which varies per install and per allowlist.

Injecting both as enum constraints turns "please do not invent names" from a prompt instruction into something the schema itself states. Providers with native structured output (OpenAI, Google, Groq) enforce the enum during decoding, so a hallucinated tool name frequently cannot be produced at all rather than being caught downstream.

:func:validate_against_schema is the explicit JSON-Schema pass, kept separate from the Pydantic parse so a document can be checked before it is coerced into a model — useful when reporting why a raw LLM response failed.

Function blueprint_json_schema

Schema for a whole blueprint.

Mostly useful for documentation and for validating a blueprint that arrived from outside the authoring loop; the loop itself constrains the smaller per-stage schemas.

blueprint_json_schema(catalog: ComponentCatalog, *, engine: Optional[str] = None) -> Dict[str, Any]

Parameter Type Default Description
catalog ComponentCatalog The live component catalog.
engine Optional[str] None When given, restricts node kinds to that engine.

Returns: Dict[str, Any] — A JSON Schema document.

Function node_config_json_schema

Return the JSON Schema of a node type's config block.

node_config_json_schema(node_type: str) -> Optional[Dict[str, Any]]

Parameter Type Default Description
node_type str A NODE_REGISTRY key.

Returns: Optional[Dict[str, Any]] — The schema, or None when the type declares no config model.

Function node_json_schema

Schema for one authored node, constrained to what actually exists.

node_json_schema(catalog: ComponentCatalog, *, engine: str = 'flow', kind: Optional[str] = None) -> Dict[str, Any]

Parameter Type Default Description
catalog ComponentCatalog The live component catalog.
engine str 'flow' Compile target, deciding the legal node kinds.
kind Optional[str] None When given, pins kind to this single value so the model cannot drift from the stub it was asked to author.

Returns: Dict[str, Any] — A JSON Schema document.

Function skeleton_json_schema

Schema for the stage-1 skeleton, with kind constrained.

skeleton_json_schema(catalog: ComponentCatalog, *, engine: Optional[str] = None) -> Dict[str, Any]

Parameter Type Default Description
catalog ComponentCatalog The live component catalog.
engine Optional[str] None When given, restricts kind to that engine's node types.

Returns: Dict[str, Any] — A JSON Schema document.

Function transitions_json_schema

Schema for the transition list, with endpoints pinned to real nodes.

transitions_json_schema(node_ids: Sequence[str]) -> Dict[str, Any]

Parameter Type Default Description
node_ids Sequence[str] The declared node ids.

Returns: Dict[str, Any] — A JSON Schema for an object holding a transitions array.

Function validate_against_schema

Validate document against schema, returning error strings.

validate_against_schema(document: Any, schema: Dict[str, Any]) -> List[str]

Parameter Type Default Description
document Any The parsed JSON document.
schema Dict[str, Any] The JSON Schema to check against.

Returns: List[str] — Human-readable error messages, empty when the document conforms. If jsonschema is not installed the check is skipped and an empty list returned — the Pydantic parse still enforces the same shape, so the optional dependency only costs the nicer error text.

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