Skip to content

API Reference parrot_tools.scraping.flow_models

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

parrot_tools.scraping.flow_models

View source

ScrapingFlow DAG models — FlowNode, ScrapingFlow, FlowResult.

A :class:ScrapingFlow is a directed acyclic graph of :class:FlowNodes where edges are data dependencies declared via each node's inputs map ({param: "node_id.field"}) and each node carries a session label for BrowserContext affinity (FEAT-222, Module 2).

The model validates the graph on construction (no duplicate ids, no dangling references, no cycles) and exposes :meth:ScrapingFlow.topological_order for the executor.

Class FlowNode

A single stage in a :class:ScrapingFlow DAG.

Fields:

Field Type Default Description
id str Unique node identifier within the flow.
plan_ref str TemplatePlan name or plan fingerprint to execute.
inputs Dict[str, str] Map of param -> "node_id.field" data-dependency edges.
session str 'default' Session label; nodes sharing a label share a BrowserContext.
on_error Literal['abort', 'skip', 'retry'] 'abort' Failure policy — abort, skip, or retry.
max_retries int 3 Retry budget used only when on_error == "retry".

Class FlowResult

Aggregated result of a :class:ScrapingFlow execution.

Fields:

Field Type Default Description
flow_name str Name of the executed flow.
node_results Dict[str, Any] Map of node_id -> result (typically a ScrapingResult dump).
success bool True Whether the flow completed successfully.
error_message Optional[str] None Failure detail when success is False.
elapsed_seconds float 0.0 Total wall-clock execution time.
nodes_completed int 0 Number of nodes that completed.
nodes_total int 0 Total number of nodes in the flow.
checkpoint_path Optional[str] None Path to the persisted checkpoint, if any.
resumed_from Optional[str] None Node id the run resumed from, if applicable.

Class ScrapingFlow

DAG of :class:FlowNodes with data-dependency edges and session affinity.

Fields:

Field Type Default Description
name str Flow name.
description str '' Human-readable description.
nodes List[FlowNode] The flow's nodes (declaration order is preserved as a stable tiebreaker for topological ordering).
global_params Dict[str, Any] Parameters available to every node at execution time.

Method ScrapingFlow.validate_dag

Validate the DAG (unique ids, no dangling refs, no cycles) and cache the resulting execution order.

validate_dag() -> 'ScrapingFlow'

Returns: 'ScrapingFlow'

Method ScrapingFlow.topological_order

Return the flow's nodes in dependency (execution) order.

Dependencies always precede their dependents. Declaration order is the stable tiebreaker among independent nodes. The order is computed once during validation and cached; a fresh list is returned each call so callers cannot mutate the cache.

topological_order() -> List[FlowNode]

Returns: List[FlowNode]

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