Skip to content

API Reference parrot.bots.flows.plan.compile

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

parrot.bots.flows.plan.compile

View source

Compile an ExecutionPlan into a runnable FlowDefinition.

An :class:~models.ExecutionPlan is the planner-facing surface: flat, small, and easy for a model to emit correctly. FlowDefinition is the executor's surface: nodes plus explicit edges, with start/end sentinels and the checkpointing metadata block. This module is the (deterministic) bridge.

Every plan node becomes a NodeDefinition of type "tool" whose config carries the plan node verbatim. The live ToolManager and WorkingMemoryToolkit are not serialised into config — they reach the node through the node_factories closure that AgentsFlow.from_definition invokes per run.

Attribute DELEGATE_NODE_TYPE

Attribute END_NODE_ID

Attribute PLAN_NODE_TYPE

Attribute START_NODE_ID

Function ensure_delegate_node_registered

Register node_cls under "delegate" in NODE_REGISTRY, once.

Mirror of :func:ensure_tool_node_registered: idempotent, raises when a different class already owns the name.

ensure_delegate_node_registered(node_cls: Any) -> None

Parameter Type Default Description
node_cls Any

Function ensure_tool_node_registered

Register node_cls under "tool" in NODE_REGISTRY, once.

ToolNode ships as an AgentCrew concept and is absent from AgentsFlow's NODE_REGISTRY; from_definition rejects unknown node types, so registration must happen before the first compile. Idempotent, because register_node raises on a duplicate name.

ensure_tool_node_registered(node_cls: Any) -> None

Parameter Type Default Description
node_cls Any The Node subclass to register (a ToolNode subclass that stores payloads to working memory).

Function to_flow_definition

Build a FlowDefinition from plan.

Edges are derived from depends_on with condition="always" rather than the default on_success: a guarded node that skips must not block its dependents, and per-node failure policy is expressed by PlanNode.retry / ForEach.on_item_error, not by edge conditions.

to_flow_definition(plan: ExecutionPlan) -> Any

Parameter Type Default Description
plan ExecutionPlan A validated execution plan.

Returns: Any — A FlowDefinition ready for AgentsFlow.from_definition.

Raises:

  • ImportError — If the flow package is unavailable.

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