Skip to content

Feature request: inline composite loops for multi-node iteration #1238

@iskandersierra

Description

@iskandersierra

Problem

  • Workflow authors cannot repeat a multi-node DAG fragment inside one loop iteration; loop: only repeats a single prompt today.
  • This affects Archon workflow authors using DAG YAML, especially build/test/fix, plan/implement/validate, and adversarial multi-role loops.
  • It comes up whenever one iteration needs multiple nodes with explicit dependencies; current workarounds are a giant loop prompt [!] or extracting a child workflow.

Proposed Solution

Allow inline composite loops: a loop body that can contain a small sub-graph (nodes) executed once per iteration until the loop exit condition passes.

Related: #972 currently prefers workflow composition over nesting. This request is specifically for inline composite loops when extraction is too heavy or hurts readability.

User Flow

Before (current)

Author wants: plan -> implement -> validate -> repeat until done

workflow nodes
  -> single loop node
     -> [!] must collapse all three phases into one prompt
        OR
     -> [!] extract a separate child workflow just to get iteration over multiple steps

After (proposed)

workflow nodes
  -> composite loop
     -> [+] iteration body runs plan -> implement -> validate sub-graph
     -> [+] loop exits when until/until_bash condition passes
     -> [+] parent workflow sees one loop node output

Alternatives Considered

Alternative Pros Cons Why not chosen
Single prompt loop Already supported Blurs phases, weaker observability, harder validation Too much logic in one prompt
Child workflow + workflow-level loop Reuses existing workflow boundary Heavier authoring, extra indirection for small local loops Good fallback, but not ergonomic inline
Manual unrolling Simple runtime model Repetitive, fixed retry count, hard to maintain Not scalable

Scope

  • Package(s) likely affected: workflows, possibly server and web for validation/editor support
  • Breaking change? (No)
  • Database changes needed? (No)
  • New external dependencies? (No)

Security Considerations

  • New permissions/capabilities? (No)
  • New external network calls? (No)
  • Secrets/tokens handling? (No)
  • If any Yes, describe:

Definition of Done

  • Workflow schema can express a composite loop body with nested nodes
  • Executor can run the loop body per iteration with scoped outputs and stop conditions
  • Tests covering the feature
  • Documentation updated (if user-facing)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low priority - Nice to have, consider closing if stalearea: workflowsWorkflow engineeffort/highCross-cutting changes, multiple domains, requires design decisionsfeature-requestNew functionality (external suggestion, needs review)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions