Skip to content

Examples & Learning Paths

Learn to build agentic workflows through structured tutorials that teach you to think about workflow design, not just copy code.


How to Use This Documentation

Each example in this section teaches concepts before showing code:

SectionWhat You'll Find
Problem NarrativeReal-world scenario motivating the pattern
Learning ObjectivesWhat you'll understand after reading
Conceptual FoundationDesign decisions, trade-offs, anti-patterns
Progressive Code RevealShape first, then implementation details
"Aha Moment"Core insight crystallized
Extension ExercisesGuided practice to deepen understanding

Learning Paths

Choose a path based on your goals and available time.

Path 1: First Workflow (30 minutes)

Goal: Understand the foundational patterns that all workflows build on.

StepReadLearn
1Basic WorkflowSequential steps, immutable state, saga pattern
2Run the ContentPipeline sampleSee a workflow in action
3Exercise: Add a ReserveInventory step to the order workflow

After this path: You can build simple sequential workflows with proper state management.


Path 2: AI Agent Patterns (2 hours)

Goal: Learn patterns for building intelligent, adaptive AI systems.

StepReadLearn
1Thompson SamplingMulti-armed bandit, exploration vs exploitation
2Run the MultiModelRouter sampleSee adaptive model selection
3Iterative RefinementQuality loops, [Append] attribute, maxIterations
4Run the AgenticCoder sampleSee test-driven refinement
5Exercise: Add a custom task category to MultiModelRouter

After this path: You can build AI systems that learn and improve over time.


Path 3: Production Patterns (3 hours)

Goal: Master patterns for production-ready workflows with human oversight.

StepReadLearn
1Approval FlowHuman checkpoints, timeout handling, escalation
2BranchingConditional routing, transition tables
3Fork/JoinParallel execution, state merging
4Run the ContentPipeline sampleSee approval gates and compensation
5Exercise: Add multi-approver workflow to ContentPipeline

After this path: You can build workflows with human-AI collaboration, parallel processing, and complex routing.


Path 4: Complete Mastery (Full Day)

Goal: Understand all patterns and how they compose together.

  1. Complete Path 1 (Foundation)
  2. Complete Path 2 (AI Patterns)
  3. Complete Path 3 (Production Patterns)
  4. Capstone Project: Design a workflow that combines:
    • Thompson Sampling for agent selection
    • Iterative refinement for quality
    • Human approval before final action
    • Fork/Join for parallel analysis

Pattern Quick Reference

PatternWhen to UseKey Concept
Basic WorkflowSequential operations with dependenciesSaga pattern, immutable state
BranchingDifferent logic for different inputsDeclarative routing, transition tables
Fork/JoinIndependent operations that can parallelizeState merging, fail-fast vs continue
Iterative RefinementQuality improvement through feedback[Append], maxIterations circuit breaker
Approval FlowHuman decisions in automated workflowsTimeout handling, escalation, audit
Thompson SamplingAdaptive selection from multiple optionsBeta distributions, exploration/exploitation

Sample Applications

Runnable projects demonstrating complete implementations.

SampleRun CommandWhat It Demonstrates
ContentPipelinedotnet run --project samples/ContentPipelineHuman approval gates, compensation, audit trails
MultiModelRouterdotnet run --project samples/MultiModelRouterThompson Sampling, intelligent model selection
AgenticCoderdotnet run --project samples/AgenticCoderIterative refinement loops, human checkpoints

Each sample README includes:

  • Problem narrative and solution approach
  • Conceptual explanation of the patterns used
  • Step-by-step walkthrough of the implementation
  • Extension exercises for practice

Prerequisites

Before running examples, ensure you have:

  1. .NET 9.0 or later installed
  2. PostgreSQL running (for Marten event store)
  3. Strategos packages installed:
bash
dotnet add package LevelUp.Strategos
dotnet add package LevelUp.Strategos.Generators

Quick Start Template

csharp
// Program.cs
var builder = WebApplication.CreateBuilder(args);

// Add Wolverine for message handling
builder.Host.UseWolverine(opts =>
{
    opts.Durability.Mode = DurabilityMode.Solo;
});

// Add Marten for persistence
builder.Services.AddMarten(opts =>
{
    opts.Connection(builder.Configuration.GetConnectionString("Marten")!);
})
.IntegrateWithWolverine();

// Add workflow services
builder.Services.AddStrategos()
    .AddWorkflow<YourWorkflow>();

// Register step dependencies
builder.Services.AddScoped<IYourService, YourServiceImpl>();

var app = builder.Build();
app.MapControllers();
app.Run();

Key Principles Across All Patterns

PrincipleWhy It Matters
State is immutableEnables replay, debugging, concurrency safety
Steps are resolved via DITestability, loose coupling
Failures are explicitStepResult.Fail() not exceptions
Workflows survive restartsDurability via Wolverine saga persistence
Everything is auditedEvents capture all state transitions

What's Next?

After completing these examples:

  1. Read the Learn section for deeper conceptual understanding
  2. Explore the API Reference for complete interface documentation
  3. Check the samples directory for production-quality implementations
  4. Join the community to share your workflows and learn from others

Released under the MIT License.