Overview
A flow is AXON’s equivalent of a function—a composable cognitive pipeline that takes typed inputs and produces typed outputs. Unlike traditional functions, flows contain cognitive primitives like reasoning, probing, and validation rather than loops and assignments.Syntax
Basic Structure
Simple Flow
Multi-Step Flow
Parameters
Flows can accept typed parameters:Return Types
Flows declare their return type after->:
Step
Steps are named cognitive operations within a flow.Basic Step
Step Fields
| Field | Purpose | Required |
|---|---|---|
given | Input data or expression | Optional |
ask | Instruction or question | Optional |
output | Output type | Optional |
confidence_floor | Minimum confidence | Optional |
Referencing Step Outputs
Reference previous step outputs using dot notation:Multiple Inputs
Probe
Probe performs targeted extraction of specific fields from data.Syntax
Examples
Use Cases
- Extract structured fields from documents
- Pull specific entities from text
- Parse formatted data into fields
Reason
Reason performs explicit chain-of-thought reasoning.Syntax
Examples
Fields
| Field | Type | Default | Purpose |
|---|---|---|---|
given | Expression | — | Input data |
about | String | — | Topic or focus |
ask | String | — | Question to answer |
depth | Integer | 1 | Reasoning depth (1-10) |
show_work | Boolean | false | Show reasoning steps |
chain_of_thought | Boolean | false | Explicit CoT reasoning |
output | Type | — | Output type |
Depth Guidelines
- 1-2: Simple, direct reasoning
- 3-4: Moderate complexity, multiple factors
- 5-7: Complex, multi-step reasoning
- 8-10: Deep, exhaustive analysis
Validate
Validate creates semantic validation checkpoints with conditional actions.Syntax
Examples
Validation Actions
| Action | Syntax | Purpose |
|---|---|---|
refine | refine(max_attempts: N) | Retry with refinement |
raise | raise ErrorName | Raise an error |
warn | warn "message" | Emit warning |
pass | pass | Accept result |
Conditions
Conditions can use comparison operators:Refine
Refine implements adaptive retry logic with failure context.Syntax
Examples
Fields
| Field | Values | Default | Purpose |
|---|---|---|---|
max_attempts | Integer ≥ 1 | 3 | Maximum retry attempts |
pass_failure_context | Boolean | true | Include failure info in retry |
backoff | none, linear, exponential | none | Backoff strategy |
on_exhaustion | raise X, escalate, fallback(...) | — | Action when exhausted |
Weave
Weave synthesizes multiple outputs into a coherent result.Syntax
Examples
Requirements
- Minimum 2 sources required
- Sources must be valid step outputs or identifiers
- Target is the output identifier
Use Tool
Use invokes external tool capabilities.Syntax
Examples
Memory Operations
Remember
Store data to semantic memory:Recall
Retrieve data from semantic memory:Conditionals
Conditional branching in flows:Syntax
Examples
Complete Example
Here’s a comprehensive flow using multiple features:Run Statements
Execute flows usingrun statements:
Basic Execution
With Modifiers
Run Modifiers
| Modifier | Purpose | Example |
|---|---|---|
as | Specify persona | as LegalExpert |
within | Specify context | within ProductionContext |
constrained_by | Apply anchors | constrained_by [NoHallucination] |
on_failure | Error handling | on_failure: retry(backoff: exponential) |
output_to | Output destination | output_to: "result.json" |
effort | Effort level | effort: high |
Effort Levels
low: Minimal resources, fast executionmedium: Balanced (default)high: More thorough, slowermax: Maximum resources, exhaustive
