Skip to content

Package Ecosystem

Strategos is distributed as multiple NuGet packages, allowing you to include only what you need.

PackagePurposeRequired
StrategosCore fluent DSL, abstractions, and type definitionsYes
Strategos.GeneratorsRoslyn source generators for compile-time code generationYes
Strategos.InfrastructureProduction implementations (Thompson Sampling, loop detection, budgets)Recommended
Strategos.AgentsMicrosoft.Extensions.AI integration for LLM-powered stepsFor AI workflows
Strategos.RagVector store adapters for RAG patternsFor RAG workflows

The core package containing the fluent DSL for defining workflows and all foundational abstractions.

TypePurpose
Workflow<TState>Entry point for fluent workflow definitions
IWorkflowStep<TState>Interface for implementing workflow steps
IWorkflowDefinition<TState>Interface for workflow definition classes
StepResult<TState>Result type returned from step execution
StepContextExecution context passed to steps (correlation ID, timestamp, metadata)
TypePurpose
AgentBeliefBeta(alpha, beta) distribution representing agent performance belief
TaskCategoryEnumeration of task categories (Analysis, Coding, Research, etc.)
TaskFeaturesExtracted features from task descriptions
IAgentSelectorInterface for agent selection strategies
IBeliefStoreInterface for persisting agent beliefs
AttributePurpose
[Append]Merge lists by appending new items to existing
[Merge]Merge dictionaries, new values overwrite existing keys
[WorkflowState]Marks a record as workflow state (enables source generation)
Terminal window
dotnet add package LevelUp.Strategos

Roslyn source generators that transform fluent DSL definitions into type-safe artifacts at compile time.

ArtifactDescription
Phase EnumType-safe enumeration of workflow phases
CommandsWolverine message types for step transitions
EventsMarten event types for audit trail
Saga ClassComplete Wolverine saga with handlers
State ReducersProperty merge logic based on [Append]/[Merge] attributes
DI ExtensionsService registration helpers

The generator reports errors and warnings at compile time. See Diagnostics Reference for the complete list.

CodeSeverityDescription
AGWF001ErrorWorkflow name cannot be empty
AGWF002WarningNo steps found in workflow
AGWF003ErrorDuplicate step name (use instance names)
AGWF009ErrorWorkflow must begin with StartWith<T>()
AGWF010WarningWorkflow should end with Finally<T>()
AGWF012ErrorEvery Fork must be followed by Join<T>()
Terminal window
dotnet add package LevelUp.Strategos.Generators

::: info Development Dependency This is a compile-time dependency. It runs during build and produces no runtime overhead. :::


Production-ready implementations of core abstractions including Thompson Sampling, loop detection, and budget enforcement.

TypePurpose
ContextualAgentSelectorSelects agents using Thompson Sampling with contextual bandits
InMemoryBeliefStoreIn-memory persistence for agent beliefs (dev/testing)
KeywordTaskFeatureExtractorExtracts task features for category classification

Detects stuck workflows using four strategies:

DetectorDescription
ExactRepetitionDetectorIdentical action sequences
SemanticRepetitionDetectorSimilar outputs (cosine similarity > threshold)
OscillationDetectorA-B-A-B patterns
NoProgressDetectorActivity without state change
TypePurpose
BudgetGuardEnforces resource limits (steps, tokens, wall time)
ScarcityLevelAbundant, Normal, Scarce, Critical
BudgetOptionsConfiguration for budget thresholds
Terminal window
dotnet add package LevelUp.Strategos.Infrastructure
services.AddStrategos()
.AddThompsonSampling(options => options
.WithPrior(alpha: 2, beta: 2))
.AddLoopDetection()
.AddBudgetGuard(options => options
.WithMaxSteps(100)
.WithMaxTokens(50_000));

Integration with Microsoft.Extensions.AI for LLM-powered workflow steps.

TypePurpose
IAgentStep<TState>Base interface for LLM-powered steps
AgentStepContextExtended context with conversation thread access
IConversationalStateInterface for state that includes conversation history
IStreamingCallbackCallback for real-time token streaming
  • Microsoft.Extensions.AI (10.0.1)
  • Microsoft.Extensions.AI.Abstractions (10.0.1)
Terminal window
dotnet add package LevelUp.Strategos.Agents
public class AnalyzeDocumentStep : IAgentStep<DocumentState>
{
private readonly IChatClient _chatClient;
public AnalyzeDocumentStep(IChatClient chatClient)
{
_chatClient = chatClient;
}
public async Task<StepResult<DocumentState>> ExecuteAsync(
DocumentState state,
AgentStepContext context,
CancellationToken ct)
{
var response = await _chatClient.GetResponseAsync(
$"Analyze this document: {state.Content}",
ct);
return state
.With(s => s.Analysis, response)
.AsResult();
}
}

Vector store adapters for Retrieval-Augmented Generation (RAG) patterns.

AdapterStatusUse Case
InMemoryVectorSearchAdapterAvailableDevelopment and testing
AdapterStatusUse Case
PgVectorAdapterPlannedPostgreSQL with pgvector extension
AzureAISearchAdapterPlannedAzure AI Search
TypePurpose
IVectorSearchAdapterInterface for vector similarity search
SearchResultResult containing content, score, and metadata
Terminal window
dotnet add package LevelUp.Strategos.Rag
public class RetrieveContextStep : IWorkflowStep<QueryState>
{
private readonly IVectorSearchAdapter _vectorSearch;
public async Task<StepResult<QueryState>> ExecuteAsync(
QueryState state,
StepContext context,
CancellationToken ct)
{
var results = await _vectorSearch.SearchAsync(
state.Query,
topK: 10,
minRelevance: 0.7);
return state
.With(s => s.RetrievedContext, results)
.AsResult();
}
}

For workflows that don’t involve LLM agents:

Terminal window
dotnet add package LevelUp.Strategos
dotnet add package LevelUp.Strategos.Generators

Most common setup for AI agent workflows:

Terminal window
dotnet add package LevelUp.Strategos
dotnet add package LevelUp.Strategos.Generators
dotnet add package LevelUp.Strategos.Agents
dotnet add package LevelUp.Strategos.Infrastructure

For workflows that include retrieval-augmented generation:

Terminal window
dotnet add package LevelUp.Strategos
dotnet add package LevelUp.Strategos.Generators
dotnet add package LevelUp.Strategos.Agents
dotnet add package LevelUp.Strategos.Infrastructure
dotnet add package LevelUp.Strategos.Rag

Strategos (core)
+-- No external dependencies
Strategos.Generators
+-- Microsoft.CodeAnalysis.CSharp
+-- [Compile-time only]
Strategos.Infrastructure
+-- Strategos
+-- Microsoft.Extensions.Caching.Memory
+-- Microsoft.Extensions.DependencyInjection.Abstractions
Strategos.Agents
+-- Strategos
+-- Microsoft.Extensions.AI
+-- Microsoft.Extensions.AI.Abstractions
+-- Microsoft.Extensions.DependencyInjection.Abstractions
Strategos.Rag
+-- Strategos.Agents