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.
- The NormalizerAgent produces a structured task contract
- The pattern matcher evaluates keyword rules in priority order against the task contract and user input
- The best-matching pattern (with confidence score) is selected
- The GeneratorAgent receives a
RECOMMENDED PATTERN:hint and aMODEL RECOMMENDATION:hint based on the pattern-to-task-type mapping
Pattern → Task Type Mapping
| Pattern | Task Type | Recommended Model |
|---|---|---|
| simple_qa | summarization | gpt-4o-mini |
| extract_format | extraction | gpt-4o-mini |
| multi_step | analysis | gpt-4o |
| batch_processing | extraction | gpt-4o-mini |
| conditional | classification | gpt-4o-mini |
| classification | classification | gpt-4o-mini |
| transform_chain | formatting | gpt-4o-mini |
| self_improving | evaluation | gpt-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.
| Workflow | Pattern | Description |
|---|---|---|
simple_qa | simple_qa | Minimal 2-node: LLM + flat_response |
classification_3way | classification | Decision tree with 3 categories, all wired |
batch_csv | batch_processing | read_file + loop over CSV + LLM processing |
conditional_branch | conditional | if_else with both branches fully wired |
multi_step_chain | transform_chain | 3-step extraction chain with variable_transform |
self_improving | self_improving | Generate, evaluate, critique loop pattern |
file_analysis | extract_format | read_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.