Assembly Patterns¶
The workflow and execution-pattern architectures referenced throughout Assembly › Patterns draw on the 2024-2026 agentic workflow research lineage. This page catalogs the canonical patterns, their measured outcomes, and the selection criteria the platform uses when configuring a Unitt's workflow graph for a given objective.
Anthropic Taxonomy¶
Anthropic Building Effective Agents (December 2024) distinguishes workflows ("systems where LLMs and tools are orchestrated through predefined code paths") from agents ("systems where LLMs dynamically direct their own processes") and names six canonical patterns:
- Prompt chaining decomposes a task into a fixed sequence where each call processes the prior output.
- Routing classifies input and dispatches to specialized handlers.
- Parallelization runs subtasks concurrently via either sectioning (independent slices) or voting (N runs of same task aggregated for confidence).
- Orchestrator-workers has a central LLM dynamically decompose and delegate.
- Evaluator-optimizer loops a generator against a critic.
- Autonomous agents plan and act open-endedly with tools.
Workflow Graph Generation¶
Recent work (AutoFlow, RobustFlow, ComfyUI-R1, 2025) converts natural-language workflow specs into executable DSL graphs and scores them for executability and semantic robustness. The four dominant runtime graph frameworks:
- LangGraph uses a typed
StateGraphwithadd_node/add_edge/add_conditional_edgesandSend/Commandprimitives. - AutoGen v0.4 / AG2 uses an event-driven
GroupChatwhere a selector (round-robin or LLM-based) routesGroupChatMessage/RequestToSpeakto subscribed agents. - CrewAI offers
Process.sequentialandProcess.hierarchical(a manager agent dispatches dynamically). - LlamaIndex Workflows is event-driven with
@step-decorated methods consuming / emittingEventPydantic objects.
Pattern Selection¶
Use prompt chaining when the task decomposes into fixed validatable steps (lowest variance, predictable cost). Use routing when input has clear categorical structure and per-class specialization recoups classifier overhead. Use parallelization for independent subtasks or confidence-critical decisions. Use orchestrator-workers when subtask count / shape is unknown at plan time (e.g., multi-file code edits). Use evaluator-optimizer when clear evaluation criteria exist and iteration measurably improves quality. Reserve autonomous agents for open-ended problems with strong sandboxing; Anthropic explicitly warns about higher costs and compounding errors.
Conditional Branching¶
LangGraph implements branching via add_conditional_edges(source, router_fn, [destinations]) where router_fn(state) returns the next node name or a Literal[...]; Command(update=..., goto=...) couples state-update and branch in one node return. LlamaIndex Workflows branches naturally by having a step emit one of several Event subclasses. AutoGen GroupChat uses a SelectorGroupChat strategy (LLM speaker selection) as a soft conditional gate.
Parallel Execution¶
LangGraph's Send API enables dynamic fan-out: a conditional-edge function returns [Send("worker", {"item": x}) for x in items] to schedule N parallel worker invocations with per-item state and reducers (e.g., Annotated[list, operator.add]) merging results; this is the canonical map-reduce primitive (LangGraph map-reduce / Send). LlamaIndex's ctx.send_event plus ctx.collect_events(ev, [Event]*N) implements gather-style joins. Voting runs identical prompts N times and aggregates (majority, threshold, or LLM-judge).
Iterative Refinement¶
Self-Refine (Madaan et al., NeurIPS 2023) uses a single LLM as generator → feedback → refiner in a loop, gaining roughly 20% on diverse tasks without training. The Anthropic evaluator-optimizer formalizes this as two distinct LLM roles; AWS Prescriptive Guidance documents an evaluator reflect-refine loop with explicit retry-limit termination. Replanner variants (LangGraph plan-execute-replan) regenerate the remaining plan after each execution batch rather than refining a single output.
Human-In-The-Loop¶
LangGraph uses interrupt_before=[node] / interrupt_after=[node] at compile time plus runtime interrupt() inside a node that surfaces a value to the client and pauses against a checkpointer; resume by re-invoking with Command(resume=value). OpenAI Agents SDK marks tools with needs_approval=True; pauses surface in RunResult.interruptions as ToolApprovalItem, resumed via state.approve(...) / state.reject(...). Approval policies propagate across handoffs; the receiving agent's policy governs subsequent calls.
Workflow Validation¶
Structured-output schemas at step boundaries are the primary defense; durable engines (Temporal, LangGraph checkpointers) enable replay regression from the last checkpoint. Production patterns (DoorDash agentic platform, 2025) layer automated linting, EXPLAIN-style query verification, and statistical metadata checks. Braintrust / Langfuse / Phoenix integrate eval suites into CI / CD as dry-run simulations over recorded traces.
Workflow Visualization¶
LangGraph compiled graphs expose graph.get_graph().draw_mermaid() and .draw_mermaid_png() for static Mermaid output. LangSmith auto-instruments LangChain / LangGraph runs. Arize Phoenix supports 10 span kinds (CHAIN, LLM, TOOL, RETRIEVER, AGENT, GUARDRAIL, EVALUATOR, ...) via OpenInference. Generating Mermaid from a Unitt's workflow spec is the same operation as LangGraph's draw_mermaid.
Pattern Composition¶
Real systems compose patterns: an outer orchestrator-workers loop whose orchestrator uses a router to pick worker pools, with each worker being a prompt chain terminating in an evaluator-optimizer loop. Anthropic explicitly endorses this: "you can combine and customize them as needed." LangGraph subgraphs (add_node("subgraph", compiled_subgraph)) and LlamaIndex nested Workflows make composition first-class.
Selection Criteria¶
| Problem Class | Recommended Pattern | Cost | Latency | Debuggability | Reliability Floor |
|---|---|---|---|---|---|
| Fixed multi-step transform | Prompt chaining | Low | Med (serial) | High (linear trace) | High |
| Categorical input dispatch | Routing | Low | Low | High | High (if classifier accurate) |
| Independent subtasks | Parallelization (sectioning) | Med | Low | Med | High |
| Confidence-critical decision | Parallelization (voting) | High | Low | Med | Very High |
| Unknown decomposition | Orchestrator-workers | High | Med | Low (dynamic plan) | Medium |
| Iterative quality target | Evaluator-optimizer | High | High | Med | High |
| Open-ended exploration | Autonomous agent | Very High | High | Low | Low (needs sandbox) |
| Sensitive action | Any + HITL gate | + Human cost | + Wait time | High | Very High |
Cross-References¶
- Assembly › Patterns; developer-facing platform layer.
- Reference › Research › Runtime Systems; runtime patterns each pattern step delegates to.
- Reference › Research › Fabric Flow; multi-stage flow built on these patterns.