Skip to content

API Reference parrot.flows.thales.definition

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

parrot.flows.thales.definition

View source

Flow assembly for the "Thales" research flow (FEAT-425 Module 5).

Deviation from the original spec §7 wiring plan — verified during TASK-2231 implementation, two rounds of user-approved corrections:

  1. The spec originally called for a pure build_thales_definition(angles, config) -> FlowDefinition handed to AgentsFlow.from_definition(..., node_factories=...). Verified against dev: from_definition() requires every node type (including node_factories-injected ones) to already be registered in the global NODE_REGISTRY — node_factories only overrides construction of an already-registered type, never registration itself. Per the first user decision ("Option B"), this module instead builds the flow programmatically — AgentsFlow(name=..., checkpoint=True) + add_node()/add_edge() (this is also exactly "explicit-edge mode", which natively provides the OR-join + skip-propagation semantics DeckBuilderNode needs).

  2. Running the assembled flow end-to-end then surfaced a SECOND, deeper requirement: checkpoint=True itself calls AgentsFlow. to_definition() as a fail-fast export check (FEAT-399, _ensure_checkpointer) — regardless of assembly mode — and that export requires every node's class to resolve via NODE_REGISTRY too. So "programmatic mode" alone does not avoid registration when checkpointing is wanted; per the second user decision ("Option C"), every Thales node type IS registered, via the same idempotent @register_node pattern parrot.flows.dev_loop already uses (nodes/registry.py) — see the updated spec §7.

    to_definition() export also rejects live Python callables as edge predicates ("only CEL expression strings round-trip") — so the deck -> slide_spec "don't render a dropped deck" gate is a CEL string (_DECK_NOT_DROPPED_CEL), not a Python function, mirroring parrot.flows.dev_loop.definition's own CEL-string predicates.

build_thales_nodes_and_edges stays as side-effect-free as this allows: given a bag of already-constructed live dependencies (ThalesNodeDeps), it returns the full node/edge lists with no I/O of its own (agent/client construction is cheap object instantiation, not a network call — the network calls happen later, inside each node's execute()). assemble_thales_flow is the thin wrapper that actually calls add_node/add_edge on a fresh AgentsFlow instance.

Two research-execution node types this module introduces (_ResearchNode for the three v1 sources per angle, _SlideRenderNode for TASK-2228's deterministic renderer) were never assigned their own task file — the spec's Component Diagram names them (research[i][web/deep/arxiv] and slide_render[i]) but no file in TASK-2227/2229/2230's Files-to-Create lists covers building them as Node subclasses. Both are private, underscore-prefixed, and live here (this task's own file) rather than touching any already-committed task's files (beyond the registration correction in point 2 above).

Alias AgentTaskMachine

Re-exported from parrot.bots.flows.core.fsm.AgentTaskMachine.

Alias AgentsFlow

Re-exported from parrot.bots.flows.flow.flow.AgentsFlow.

Alias BibliographyNode

Re-exported from parrot.flows.thales.nodes.BibliographyNode.

Alias DROPPED_DECK_SENTINEL

Re-exported from parrot.flows.thales.nodes.deck_builder.DROPPED_DECK_SENTINEL.

Alias DeckBuilderNode

Re-exported from parrot.flows.thales.nodes.DeckBuilderNode.

Class EdgeSpec

One (from, to, condition, predicate) edge, mirroring AgentsFlow.add_edge.

predicate is a CEL expression string, never a Python callable — AgentsFlow.to_definition() (required by checkpoint=True's fail-fast export check) only round-trips CEL strings, mirroring parrot.flows.dev_loop.definition's own CEL-string predicates.

Attributes:

Attribute Type Description
from_ str
to str
condition str
predicate Optional[str]

Alias EndNode

Re-exported from parrot.bots.flows.core.node.EndNode.

Alias ExecSummaryNode

Re-exported from parrot.flows.thales.nodes.ExecSummaryNode.

Alias FinalDocumentNode

Re-exported from parrot.flows.thales.nodes.FinalDocumentNode.

Alias InfographicNode

Re-exported from parrot.flows.thales.nodes.InfographicNode.

Alias Node

Re-exported from parrot.bots.flows.core.node.Node.

Alias ResearchAngle

Re-exported from parrot.flows.thales.models.ResearchAngle.

Alias SlideSpec

Re-exported from parrot.flows.thales.models.SlideSpec.

Alias SlideSpecNode

Re-exported from parrot.flows.thales.nodes.SlideSpecNode.

Alias StartNode

Re-exported from parrot.bots.flows.core.node.StartNode.

Alias ThalesConfig

Re-exported from parrot.flows.thales.models.ThalesConfig.

Class ThalesNodeDeps

Live dependencies closed over by the assembled flow's nodes.

Parameter Type Default Description
client Any
store Any
toolkit Any
user_id str
agent_id str
session_id str
accessed_date str
title str 'Thales Research Report'
output_dir Optional[Any] None

Fields:

Field Type Default Description
client Any Shared AbstractClient-like object (exposes async ask(prompt, *, structured_output=...)) used by SlideSpecNode and the deep-research research nodes.
store Any An ArtifactStore instance for FinalDocumentNode.
toolkit Any An InfographicToolkit instance for InfographicNode.
user_id str Owning user identifier for persistence.
agent_id str Agent identifier for persistence.
session_id str Session identifier for persistence.
accessed_date str ISO date this run's sources were retrieved (injected once per run — never derived deep inside a node, for testability).
title str 'Thales Research Report' Final document title.
output_dir Optional[Any] None Optional filesystem directory FinalDocumentNode ALSO mirrors the final document (+ PDF) into, independent of store (code-review fix: the final document was previously only reachable via ArtifactStore).

Alias arxiv_to_findings

Re-exported from parrot.flows.thales.factories.arxiv_to_findings.

Function assemble_thales_flow

Build a ready-to-run AgentsFlow for one Thales run (phase 2).

Programmatic assembly (explicit-edge mode) — see this module's docstring for why FlowDefinition/from_definition is not used.

assemble_thales_flow(angles: list[ResearchAngle], config: ThalesConfig, deps: ThalesNodeDeps, *, flow_id: Optional[str] = None, on_node_event: Optional[Callable[[str, str, dict], Any]] = None) -> AgentsFlow

Parameter Type Default Description
angles list[ResearchAngle] All research angles for this run (from phase 1's planner).
config ThalesConfig The run's ThalesConfig.
deps ThalesNodeDeps Live dependencies closed over by the constructed nodes.
flow_id Optional[str] None Stable flow id so checkpoint=True resume works (FEAT-399).
on_node_event Optional[Callable[[str, str, dict], Any]] None Optional node-event listener forwarded to AgentsFlow's constructor.

Returns: AgentsFlow — A configured AgentsFlow instance ready for run_flow(ctx).

Alias build_arxiv_agent

Re-exported from parrot.flows.thales.factories.build_arxiv_agent.

Alias build_deep_research_caller

Re-exported from parrot.flows.thales.factories.build_deep_research_caller.

Function build_thales_nodes_and_edges

Build every Node instance + edge spec for one Thales run.

Side-effect-free beyond object construction (no network I/O — every network call happens later, inside a node's execute()). Exhaustively testable with varying angle counts / enabled sources.

build_thales_nodes_and_edges(angles: list[ResearchAngle], config: ThalesConfig, deps: ThalesNodeDeps) -> tuple[list[Node], list[EdgeSpec]]

Parameter Type Default Description
angles list[ResearchAngle] All research angles for this run (len >= config.num_decks is the caller's/PlannerNode's responsibility, not enforced here).
config ThalesConfig The run's ThalesConfig.
deps ThalesNodeDeps Live dependencies closed over by the constructed nodes.

Returns: tuple[list[Node], list[EdgeSpec]] — (nodes, edges) — every Node instance and every EdgeSpec needed to wire them via AgentsFlow.add_node/add_edge.

Alias build_web_agent

Re-exported from parrot.flows.thales.factories.build_web_agent.

Alias deep_research_to_findings

Re-exported from parrot.flows.thales.factories.deep_research_to_findings.

Alias extract_groundedness_report

Re-exported from parrot.flows.thales.factories.extract_groundedness_report.

Alias register_thales_node

Re-exported from parrot.flows.thales.nodes.registry.register_thales_node.

Alias render_slide

Re-exported from parrot.flows.thales.rendering.render_slide.

Alias websearch_to_findings

Re-exported from parrot.flows.thales.factories.websearch_to_findings.

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