Skip to content

API Reference parrot.flows.dev_loop.flow

github-actions[bot] edited this page Nov 5, 2026 · 4 revisions

parrot.flows.dev_loop.flow

View source

build_dev_loop_flow — wire the eight dev-loop nodes into an AgentsFlow.

Implements Module 10. Topology (FEAT-132):

.. code-block:: text

IntentClassifier ──(kind=="bug")──► BugIntake → Research → Development → QA → DeploymentHandoff → Close
                 └─(kind!="bug")──────────────► Research      │
                                                               └─(passed=False)→ FailureHandler
                                                               ↑(any node hard-error)

Built on the FEAT-163 AgentsFlow executor using explicit conditional edges (add_edge): the engine's OR-join + skip-propagation semantics make the branch merge at research and the on_error fan-in at failure_handler first-class — no adapters, no legacy API.

When a redis_url is provided, the flow publishes node lifecycle events (flow.node_started / node_completed / node_failed / node_skipped) to the per-run stream flow:{run_id}:flow via the engine's on_node_event hook (spec G4 — the multiplexer's "flow" view).

The factory is a pure function — no globals, no env reads.

Class FlowEventPublisher

Publishes AgentsFlow node-lifecycle events to flow:{run_id}:flow.

Bound to AgentsFlow(on_node_event=...). The run_id is read from the event's info["context"].shared_data["run_id"] (the engine passes the run's FlowContext on every event, so concurrent runs on the same flow instance publish to their own streams); a mutable holder dict serves as fallback for callers that drive run_flow directly with an unseeded context.

The Redis connection is lazy and every failure is swallowed — event publishing must never break a run.

Parameter Type Default Description
redis_url str Redis URL for the XADD calls.
run_id_holder Dict[str, str] Mutable mapping carrying the fallback "run_id".

Method FlowEventPublisher.close

Release the Redis connection pool.

close() -> None

Function build_dev_loop_flow

Build the eight-node dev-loop AgentsFlow (FEAT-132).

Topology:

  • IntentClassifierNode routes:
    • kind == "bug" → BugIntakeNode → ResearchNode
    • kind != "bug" → ResearchNode directly
  • ResearchNode → DevelopmentNode → QANode
  • QANode → DeploymentHandoffNode (passed) or FailureHandlerNode
  • DeploymentHandoffNode → DevLoopCloseNode
  • Any hard error from any middle node → FailureHandlerNode (on_error edges; untaken paths are skip-propagated by the engine)

build_dev_loop_flow(*, dispatcher: ClaudeCodeDispatcher, jira_toolkit: Any, log_toolkits: Dict[str, Any], redis_url: str, log_fetch_mode: Optional[str] = None, name: str = 'dev-loop', publish_flow_events: bool = True, lifecycle_events: bool = True, development_dispatcher: Optional[Any] = None, development_profile: Optional[Any] = None, development_pool_config: Optional[Any] = None, development_dispatcher_builder: Optional[Any] = None, development_pool_max: int = 4, git_toolkit: Optional[Any] = None, repos: Optional[list[RepoSpec]] = None, codereview_dispatcher: Optional[Any] = None, require_deployment_approval: bool = False, wiki_search: Optional[Any] = None, graph_memory: Optional[Any] = None, require_plan_approval: bool = False, skip_qa: bool = False, research_coordinator: Optional[Any] = None, research_mcp_servers: Optional[Dict[str, Any]] = None, research_mcp_tools: Optional[list[str]] = None, checkpoint: bool = False, checkpoint_required: bool = False, checkpoint_store: Optional[Union[str, CheckpointStore]] = None, flow_id: Optional[str] = None, model_plan: Optional[DevFlowModelPlan] = None) -> AgentsFlow

Parameter Type Default Description
dispatcher ClaudeCodeDispatcher A pre-built :class:ClaudeCodeDispatcher (shared by Research, Development, and QA nodes).
jira_toolkit Any Service-account JiraToolkit instance.
log_toolkits Dict[str, Any] Mapping of source kind → toolkit. Recognised keys: "cloudwatch", "elasticsearch".
redis_url str Redis URL for IntentClassifierNode / BugIntakeNode intake events and the flow-level node-lifecycle events.
log_fetch_mode Optional[str] None Remote-log-fetch policy for ResearchNode — "auto" (default, from DEV_LOOP_LOG_FETCH_MODE) queries CloudWatch/Elasticsearch only for kind == "bug" runs; "always" restores the pre-flag fetch-for-every-kind behavior; "never" disables remote log fetching outright. Local inline / attached_file sources are never gated.
name str 'dev-loop' Flow name (default "dev-loop").
publish_flow_events bool True When True (default), attach a :class:FlowEventPublisher to the engine's on_node_event hook. The publisher reads the run_id from flow._run_id_holder (seeded by DevLoopRunner).
lifecycle_events bool True When True (default), also attach a :class:parrot.bots.flows.flow.telemetry.FlowLifecycleAdapter so typed FEAT-176 events (FlowStarted/NodeCompleted/…) reach the global lifecycle registry — and through it the OTel / logging / usage subscribers.
development_dispatcher Optional[Any] None Optional dispatcher used only by DevelopmentNode. Defaults to dispatcher.
development_profile Optional[Any] None Optional dispatch profile passed only to DevelopmentNode.
development_pool_config Optional[Any] None Optional :class:DevAgentPoolConfig (FEAT-323) propagated to DevelopmentNode via build_dev_loop_node_factories. None (default) preserves the single-agent behaviour exactly.
development_dispatcher_builder Optional[Any] None Optional (DevAgentSpec) -> (dispatcher, profile) callable (FEAT-323) propagated to DevelopmentNode for pool-worker/conflict-resolver materialization.
development_pool_max int 4 Hard cap on total pool workers (FEAT-323). Defaults to 4.
git_toolkit Optional[Any] None
repos Optional[list[RepoSpec]] None
codereview_dispatcher Optional[Any] None Optional AbstractCodeReviewDispatcher (FEAT-270) used by QANode for the code-review gate. Defaults to None, in which case QANode auto-wraps dispatcher in a ClaudeCodeReviewDispatcher (backward compat).
require_deployment_approval bool False FEAT-322 — forwarded to DeploymentHandoffNode via build_dev_loop_node_factories. Defaults to False (today's behavior, unchanged); set True to require a deployment_approval HITL gate before the Jira "Ready to Deploy" transition (resolved via the REST command layer, TASK-1855). Only takes effect when the run also has a SessionHost (seeded by DevLoopRunner.run()) — see DeploymentHandoffNode's docstring.
wiki_search Optional[Any] None
graph_memory Optional[Any] None FEAT-377 TASK-1915 — an optional DevLoopGraphMemory (from DevLoopGraphMemory. from_config()) forwarded to Research/QA/Close/FailureHandler via build_dev_loop_node_factories. None (default) makes every graph-memory seam a strict no-op.
require_plan_approval bool False FEAT-377 TASK-1916 — forwarded to DevelopmentNode via build_dev_loop_node_factories. False (default) preserves current behavior exactly.
skip_qa bool False When True, QANode returns a synthetic passing QAReport without running deterministic checks or code review. False (default) preserves the full QA gate.
research_coordinator Optional[Any] None Optional ComplementaryResearchCoordinator (FEAT-482/486) forwarded to ResearchNode via build_dev_loop_node_factories. None (default) lets the factories build a fresh conf-driven one (inert until DEV_FLOW_RESEARCH_PARTNER is configured). Pass an explicitly configured coordinator (backend=/model=) to select the collaborative-research partner's LLM programmatically.
research_mcp_servers Optional[Dict[str, Any]] None Optional explicit MCP server configs forwarded to ResearchNode's dispatch profile (wikitoolkit graph search, FEAT-485 parrot mcp-local toolkit servers). None (default) keeps the research dispatch byte-identical.
research_mcp_tools Optional[list[str]] None Optional explicit mcp__... allow rules for those servers; None derives server-level mcp__<name> rules. See :class:ResearchNode.
checkpoint bool False FEAT-480 — enable AgentsFlow state checkpointing for the built flow. False (default) is byte-identical to the pre-FEAT-480 behavior — no checkpoint config is attached at all. This is the "per-run factory" opt-in: a caller building a checkpoint-aware run passes checkpoint=True (usually alongside checkpoint_required=True) and calls this function fresh for every run (never reusing one shared instance across runs — spec §7 known risk).
checkpoint_required bool False FEAT-480 — when True (and checkpoint is also True), the scheduler awaits a required checkpoint write after every successful node before routing downstream (TASK-2624). False (default) keeps generic best-effort checkpointing if checkpoint=True alone is set.
checkpoint_store Optional[Union[str, CheckpointStore]] None FEAT-480 — ephemeral CheckpointStore name/ instance/None (env fallback), forwarded to AgentsFlow. Ignored when checkpoint is False.
flow_id Optional[str] None FEAT-480 — stable per-run checkpoint identity (typically "dev-loop/<run_id>", minted by DevCheckpointCoordinator). Ignored when checkpoint is False; auto-generated (UUID4) otherwise when omitted — but omitting it defeats the purpose of a per-run checkpoint identity, so recovery-aware callers always supply it explicitly.
model_plan Optional[DevFlowModelPlan] None FEAT-490 Module 7 — optional :class:DevFlowModelPlan selecting the seats THIS topology actually has: the development pool (mirrors development_pool_config's shape) and QANode's adversarial review pair. There is no IdeationNode here, so the plan's research_primary/ research_partner fields have nothing to map onto — pass an explicit research_coordinator for that seat instead, same as before this parameter existed. Precedence matches the dev-flow sibling exactly: an explicit development_pool_config or codereview_dispatcher always wins over the plan. None (the default) leaves every existing call byte-identical — this is a pure seam, not a behaviour change; the ops console is not wired to send a plan (spec §1 Non-Goals).

Returns: AgentsFlow — A wired :class:AgentsFlow instance ready to run_flow().

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