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: LLM extraction (with file_variables: input.source_file) → 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: input via file_variables → 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
Recommended models come from the canonical Ask Sage model catalog (node_registry/model_catalog.yaml), which maps each pattern to a role (e.g. default, cheap_extractor, analyzer, classifier, deliverable_writer, evaluator, creative) and each role to a concrete model. Concrete models include gpt-5.4, google-claude-46-sonnet, google-claude-45-opus, gpt-4o, gpt-4o-mini, and auto.
These model recommendations appear as hints in the generated workflow's LLM node configs, not as the model running the pipeline.
Use python -m autoflow --list-models to print the current catalog, --lint-models to find templates using uncatalogued names, and --remap-model OLD=NEW to bulk-rename across templates.
Golden Workflows
AutoFlow includes 8 hand-crafted golden reference workflows in workflows/golden/ that demonstrate correct v1 (real Ask Sage) format. Each has fully wired handles, terminal nodes, resolvable variable references, and an agent_config block ready for Agent Builder import.
| 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 | LLM with file_variables + loop over CSV |
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 | LLM with file_variables attachment flow |
all_nodes_demo | multi_step | Demo wiring every node type together |
Golden workflows pass full validation (schema + semantic) and registry config checks. They serve as reference implementations for each pattern.