Skip to main content

Pipeline Orchestration

Overview

The Reasoning Engine orchestrates a 7-step analysis pipeline where each step builds upon the results of previous steps. This page explains the overall execution model, data flow patterns, and database architecture.


Pipeline Flow


Design Principles

1. Sequential Processing

Each step receives enriched state from prior steps, ensuring context builds progressively. Steps cannot run in parallel.

2. Minimal State

Only essential data passes between steps. Full outputs are stored in the database to prevent JSON payload bloat.

3. Database-Backed

All step outputs are persisted to data_WorkflowStepOutputs, enabling:

  • Auditability - Full trace of analysis decisions
  • Debugging - Inspect intermediate results
  • Replay - Re-run from any step

4. Fail-Safe

If a step fails, the workflow continues with degraded data. The validation step flags missing analysis.

5. Separation of Concerns

  • Reasoning Engine - Analytical logic (trends, patterns, correlations)
  • Outer Workflow - Business logic (normalization, formatting, tone)

Data Flow Pattern


Step Summary

StepPurposeAgentKey Output
0Validate input & plan executionStep OrchestratorCanonical data, step plan
1Analyze time-series trendsTemporalStatistics, trends
2Detect behavioral patternsPatternDetected patterns
3Compute metric relationshipsCorrelationCorrelation pairs
4Retrieve domain knowledgeDomain RetrievalPerplexity context or local fallback
5Generate narrativeExplanationHuman-readable analysis
6Verify claims & assemble resultValidationValidated final output
info

See the Steps section for detailed documentation on each step's inputs, outputs, and processing logic.


Database Architecture

log_ReasoningEngineTasks

Parent table tracking workflow executions.

ColumnTypeDescription
TaskIduniqueidentifierPrimary key
WorkflowRunIduniqueidentifierMastra workflow run ID
Objectivenvarchar(MAX)Analysis goal
Statusnvarchar(50)running, completed, failed
StartedAtUtcdatetime2(3)Workflow start time
CompletedAtUtcdatetime2(3)Workflow completion time

log_StepReasoningEngineTasks

Child table tracking individual step executions.

ColumnTypeDescription
StepTaskIduniqueidentifierPrimary key
TaskIduniqueidentifierForeign key to parent task
StepNamenvarchar(128)Step identifier
StepOrderintExecution order (0-6)
Statusnvarchar(50)pending, running, completed, skipped, failed
StartedAtUtcdatetime2(3)Step start time
CompletedAtUtcdatetime2(3)Step completion time

data_WorkflowStepOutputs

Stores JSON output from each step.

ColumnTypeDescription
OutputIduniqueidentifierPrimary key
WorkflowRunIduniqueidentifierWorkflow identifier
StepNamenvarchar(128)Step identifier
OutputDatanvarchar(MAX)JSON output
CreatedAtUtcdatetime2(3)Timestamp

Configuration Options

Enable Step Orchestration

Allow AI to select which analysis steps to run:

{
enableStepOrchestration: true
}

Provide Pre-computed Plan

Skip AI orchestration by providing explicit step list:

{
stepPlan: {
steps: ['temporal', 'correlation', 'explanation', 'validation'],
reasoning: 'Focus on temporal and correlations only'
}
}

Output Profile

Specify output formatter (handled by outer workflow):

{
outputProfile: 'recovered-summary'
}

Next Steps