AutoFlow
Workflows

Workflow Patterns

The 8 workflow patterns AutoFlow uses for pattern-based generation.

AutoFlow's pattern matcher (src/autoflow/patterns/matcher.py) analyzes normalized task contracts and recommends the best workflow pattern. The GeneratorAgent includes this recommendation as a RECOMMENDED PATTERN: hint in the generation prompt.

Pattern Reference

Overview

The following patterns are used by AutoFlow to select an appropriate workflow structure based on task intent, keywords, and normalized task contracts.

simple_qa

Use case: Quick question-and-answer tasks with a single LLM call.

Typical structure: 1–2 nodes (intake LLM → optional formatter)

Keywords: question, answer, explain, what is, how to

extract_format

Use case: Reading files or documents and extracting structured data.

Typical structure: read_file → LLM extraction → variable_transform

Keywords: extract, parse, read, document, file, PDF, CSV

multi_step

Use case: Sequential processing pipelines where each step builds on the previous.

Typical structure: LLM₁ → LLM₂ → LLM₃ → response (chain of 3+ nodes)

Keywords: step, pipeline, sequence, then, first, next, finally

batch_processing

Use case: Processing multiple items from a list using iteration.

Typical structure: read input → loop → process item → collect results

Keywords: batch, list, each, every, multiple, iterate, bulk, all

conditional

Use case: Binary decision routing based on a condition.

Typical structure: classify → if_else → branch A / branch B

Keywords: if, condition, check, verify, when, based on, depends

classification

Use case: Multi-way routing based on category classification.

Typical structure: intake → decision_tree → category-specific handlers

Keywords: classify, categorize, sort, route, triage, priority, type

transform_chain

Use case: Data transformation and reformatting pipelines.

Typical structure: input → variable_transform → LLM format → output

Keywords: transform, convert, format, reformat, map, change, reshape

self_improving

Use case: Evaluation and iterative improvement workflows.

Typical structure: generate → evaluate → if_else (pass/fail) → critique → regenerate

Keywords: evaluate, review, improve, iterate, quality, score, assess, refine

How Pattern Matching Works

Overview

Pattern matching is applied after task normalization and before workflow generation.

  1. The NormalizerAgent produces a structured task contract
  2. The pattern matcher evaluates keyword rules in priority order against the task contract and user input
  3. The best-matching pattern (with confidence score) is selected
  4. The GeneratorAgent receives a RECOMMENDED PATTERN: hint and a MODEL RECOMMENDATION: hint based on the pattern-to-task-type mapping

Pattern → Task Type Mapping

PatternTask TypeRecommended Model
simple_qasummarizationgpt-4o-mini
extract_formatextractiongpt-4o-mini
multi_stepanalysisgpt-4o
batch_processingextractiongpt-4o-mini
conditionalclassificationgpt-4o-mini
classificationclassificationgpt-4o-mini
transform_chainformattinggpt-4o-mini
self_improvingevaluationgpt-4o

These model recommendations appear as hints in the generated workflow's LLM node configs, not as the model running the pipeline.

Golden Workflows

AutoFlow includes 7 hand-crafted golden reference workflows in workflows/golden/ that demonstrate correct v2 format. Each uses UUID IDs, slugs, labels, key fields, terminal nodes, fully wired handles, and resolvable variable references.

WorkflowPatternDescription
simple_qasimple_qaMinimal 2-node: LLM + flat_response
classification_3wayclassificationDecision tree with 3 categories, all wired
batch_csvbatch_processingread_file + loop over CSV + LLM processing
conditional_branchconditionalif_else with both branches fully wired
multi_step_chaintransform_chain3-step extraction chain with variable_transform
self_improvingself_improvingGenerate, evaluate, critique loop pattern
file_analysisextract_formatread_file + LLM analysis (attachment flow)

Golden workflows pass full v2 validation (schema + semantic) and registry config checks. They serve as reference implementations for each pattern.

On this page