Spectra.Kernel 0.1.2

dotnet add package Spectra.Kernel --version 0.1.2
                    
NuGet\Install-Package Spectra.Kernel -Version 0.1.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Spectra.Kernel" Version="0.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Spectra.Kernel" Version="0.1.2" />
                    
Directory.Packages.props
<PackageReference Include="Spectra.Kernel" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Spectra.Kernel --version 0.1.2
                    
#r "nuget: Spectra.Kernel, 0.1.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Spectra.Kernel@0.1.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Spectra.Kernel&version=0.1.2
                    
Install as a Cake Addin
#tool nuget:?package=Spectra.Kernel&version=0.1.2
                    
Install as a Cake Tool

Spectra

Spectra

AI workflow orchestration for .NET. Build workflows as graphs, mix code and agent steps, swap providers without changing the flow.

License: MIT .NET 10 NuGet NuGet Downloads

Documentation · Getting Started · Samples · NuGet


Quickstart

dotnet new console -n MyWorkflow && cd MyWorkflow
dotnet add package Spectra
dotnet add package Spectra.Extensions
var host = Host.CreateDefaultBuilder(args)
    .ConfigureServices(services =>
    {
        services.AddSpectra(spectra =>
        {
            spectra.AddOpenRouter(c =>
            {
                c.ApiKey = Environment.GetEnvironmentVariable("OPENROUTER_API_KEY")!;
                c.Model = "openai/gpt-4o-mini";
            });
            spectra.AddConsoleEvents();
        });
    })
    .Build();

var workflow = WorkflowBuilder.Create("greet-and-translate")
    .AddAgent("assistant", "openrouter", "openai/gpt-4o-mini", a => a
        .WithSystemPrompt("You are a helpful assistant."))
    .AddAgentNode("greet", "assistant", n => n
        .WithUserPrompt("Say hello to {{inputs.name}}.")
        .WithMaxIterations(1))
    .AddAgentNode("translate", "assistant", n => n
        .WithUserPrompt("Translate to French: {{nodes.greet.output}}")
        .WithMaxIterations(1))
    .AddEdge("greet", "translate")
    .Build();

var runner = host.Services.GetRequiredService<IWorkflowRunner>();
var state = new WorkflowState { ["inputs.name"] = "World" };
var result = await runner.RunAsync(workflow, state);
Console.WriteLine(result["nodes.translate.output"]);
dotnet run

Nodes do work. Edges define flow. State moves through the graph.

Using a different provider? Replace AddOpenRouter(...) with AddOpenAI(...), AddAnthropic(...), AddGemini(...), or AddOllama(...). The workflow definition stays the same.

Read the full getting-started guide →


Why Spectra

Workflows are visible graphs. Define workflows as directed graphs in C# or JSON. Every step, edge, and condition is explicit — not buried in application code.

Mix any kind of step. Code functions, LLM prompts, autonomous agents, human approval gates, subgraphs — all first-class nodes in the same workflow.

Swap providers freely. Route each step to OpenAI, Claude, Gemini, Ollama, or OpenRouter. Define fallback chains. The workflow definition doesn't change.

Define in C# or JSON. Use the fluent builder for code-first control, or JSON for portable, editable definitions that don't require recompilation. Both describe the same model.


Features

  • Graph-based orchestration — directed graphs with conditional edges, parallel fan-out, and cyclic loops with guard rails
  • Multi-provider — OpenAI, Anthropic, Gemini, Ollama, OpenRouter, and any OpenAI-compatible API
  • Agent step — autonomous tool-using agents with iteration limits and cost tracking (coming soon)
  • Multi-agent — supervisor, handoff, and delegation patterns
  • MCP integration — connect agents to MCP tool servers over stdio or SSE
  • Checkpointing — pause and resume workflows from any node
  • Time travel — fork execution from any checkpoint and explore different paths
  • Interrupts — pause any step for human approval, inject feedback, resume
  • Streaming — token-level streaming through the workflow pipeline
  • Prompt management — prompts as markdown files with YAML front matter and {{variable}} templating
  • Resilience — provider fallback chains, tool circuit breakers, retry with backoff, response caching
  • Sessions — multi-turn conversational state with history windowing
  • Memory — cross-session persistent memory for agents
  • Observability — OpenTelemetry tracing, structured events, compliance audit trail
  • Typed state — compile-time merge policies for parallel execution
  • Standard DIAddSpectra(...) plugs into IServiceCollection like any .NET service

Packages

Package Description
Spectra Entry point — DI registration, fluent builders, hosted service
Spectra.Extensions LLM providers: OpenAI, Anthropic, Gemini, Ollama, OpenRouter
Spectra.Kernel Execution engine, scheduler, built-in steps, resilience decorators
Spectra.Contracts Interfaces and data models only — for building extensions
Spectra.AspNetCore HTTP endpoints for exposing workflows via ASP.NET Core

Most projects need Spectra + Spectra.Extensions. The rest are for advanced scenarios.


Samples

Sample What it shows
HelloWorld Minimal single-node workflow
JsonVsCode Same workflow defined in C# and JSON
BranchingWorkflow Conditional edges and dynamic routing
ParallelFanOut Parallel branch execution with fan-in
CyclicLoop Retry loops with guard rails
CheckpointResume Pause and resume from checkpoint
InterruptApproval Human-in-the-loop approval gate
SingleAgent Autonomous agent with tools
AgentWithMcp Agent connected to MCP tool servers
AgentWithFallback Provider fallback chains
MultiAgent Agent-to-agent handoff
MultiAgentSupervisor Supervisor delegates to worker agents
SubgraphComposition Nested workflows with isolated state
StreamingOutput Token-level streaming through the pipeline
StructuredOutput JSON-constrained LLM output
MemoryStoreRecall Cross-session persistent memory
ResearchPipeline Multi-step research with validation

Documentation

Full documentation at alicank.github.io/Spectra.


Contributing

Contributions are welcome. Please open an issue first to discuss what you'd like to change.

git clone https://github.com/alicank/spectra.git
cd spectra
dotnet build
dotnet test

License

MIT

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Spectra.Kernel:

Package Downloads
Spectra

AI workflow orchestration for .NET. Define workflows as graphs, mix code and agent steps, choose providers per step.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.2 111 5/1/2026
0.1.1 108 4/18/2026
0.1.0 114 4/14/2026