Overview
This example demonstrates advanced multi-step reasoning using AXON’sreason primitive, chain-of-thought reasoning, and self-healing validation. It shows how to break down complex problems into reasoning steps with confidence tracking and adaptive refinement.
Use Case
Solve complex problems requiring:- Multi-step logical reasoning
- Chain-of-thought explanation
- Recursive problem decomposition
- Validation at each step
- Self-correction when reasoning fails
- Mathematical or logical proofs
Complete Code
multi_step_reasoning.axon
Key Components
Persona: LogicalReasoner
- Domains: Logic, mathematics, problem solving
- Methodical tone: Step-by-step, careful
- High threshold: 0.85 for sound reasoning
- Chain-of-thought: Always show reasoning steps
Context: ReasoningMode
- Session memory: Remember previous reasoning
- Exhaustive depth: Thorough analysis
- Large token budget: 8192 for complex reasoning
- Moderate temperature: 0.4 balances consistency and creativity
Anchor: LogicalConsistency
- Requires: Logical validity (no invalid inferences)
- High floor: 0.80 minimum confidence
- Explicit uncertainty: Admit when conclusion uncertain
Custom Types
- Step number: Position in chain
- Premise: Starting point (fact)
- Conclusion: Derived result (fact)
- Justification: Why conclusion follows (fact)
- Confidence: How certain we are
- All reasoning steps
- Final conclusion
- Any contradictions found
- Overall confidence
- Full reasoning trace
Flow: SolveComplexProblem
Six-step reasoning pipeline with validation: Step 1: DecomposeProblem- Depth 3: Moderate reasoning depth
- Show work: Display reasoning steps
- Chain-of-thought: Explicit reasoning trace
Usage
Run Reasoning Flow
Example Input
Example Output
Advanced Patterns
Mathematical Proof
Recursive Problem Solving
Debate-Style Reasoning
Causal Reasoning
Best Practices
1. Use Appropriate Reasoning Depth
2. Always Show Work for Complex Reasoning
3. Validate Logical Consistency
4. Use Session Memory for Multi-Turn Reasoning
5. Apply High Confidence Thresholds
6. Use Moderate Temperature
Related Examples
Contract Analyzer
Legal contract analysis with risk reasoning
Sentiment Analysis
Emotional reasoning and classification
Data Extraction
Extract structured data with validation
