SemanticKernel.Graph
25.10.301
dotnet add package SemanticKernel.Graph --version 25.10.301
NuGet\Install-Package SemanticKernel.Graph -Version 25.10.301
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="SemanticKernel.Graph" Version="25.10.301" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SemanticKernel.Graph" Version="25.10.301" />
<PackageReference Include="SemanticKernel.Graph" />
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 SemanticKernel.Graph --version 25.10.301
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SemanticKernel.Graph, 25.10.301"
#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 SemanticKernel.Graph@25.10.301
#: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=SemanticKernel.Graph&version=25.10.301
#tool nuget:?package=SemanticKernel.Graph&version=25.10.301
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Semantic Kernel Graph
Graph-based workflow orchestration engine for Microsoft Semantic Kernel. Compose SK agents and functions as nodes connected by edges, with deterministic execution, dynamic routing, checkpointing, and event streaming.
- SK integration: uses native
Kernel,KernelFunction, andKernelArguments - Ready-made nodes:
FunctionGraphNode,ConditionalGraphNode, loops, error handling, and more - Execution:
GraphExecutor.ExecuteAsyncwith options for metrics, concurrency, and recovery - Observability: metrics, execution history, and optional streaming
Installation
dotnet add package SemanticKernel.Graph
Requirements: .NET 9.0 and Microsoft.SemanticKernel (already referenced by the package).
Get started in 60 seconds
Minimal example with a single function node (no external model required):
using Microsoft.SemanticKernel;
using SemanticKernel.Graph.Core;
using SemanticKernel.Graph.Nodes;
// Kernel (can be empty for local functions via CreateFromMethod)
var kernel = Kernel.CreateBuilder().Build();
// Node that wraps a local SK function
var fn = KernelFunctionFactory.CreateFromMethod((string? input) => $"Hello, {input}", functionName: "greeting");
var start = new FunctionGraphNode(fn, description: "Greeting").StoreResultAs("result");
// Graph: 1 node and start node
var graph = new GraphExecutor("MyGraph").AddNode(start).SetStartNode(start.NodeId);
// Execute
var args = new KernelArguments { ["input"] = "world" };
var result = await graph.ExecuteAsync(kernel, args);
Console.WriteLine(result.GetValue<string>()); // "Hello, world"
Integrating with Semantic Kernel models
You can also use SK plugin/model functions in graph nodes:
using Microsoft.SemanticKernel;
using SemanticKernel.Graph.Core;
using SemanticKernel.Graph.Nodes;
// Configure your provider (e.g., OpenAI/Azure OpenAI) according to your environment
var kernel = Kernel.CreateBuilder()
// .AddOpenAIChatCompletion("gpt-4o", apiKey) // OpenAI example
// .AddAzureOpenAIChatCompletion("deployment", endpoint, key) // Azure OpenAI example
.Build();
// Create an SK prompt function and wrap it in a FunctionGraphNode
var summarize = KernelFunctionFactory.CreateFromPrompt("Summarize the text: {{$input}}", functionName: "summarize");
var summarizeNode = new FunctionGraphNode(summarize).StoreResultAs("summary");
var executor = new GraphExecutor("Summary").AddNode(summarizeNode).SetStartNode(summarizeNode.NodeId);
var args = new KernelArguments { ["input"] = "Long text to summarize..." };
var summary = await executor.ExecuteAsync(kernel, args);
Console.WriteLine(summary.GetValue<string>());
Quick concepts
- GraphExecutor: builds the graph (adds nodes and connects), sets the start node, and executes
- IGraphNode: contract for an executable node; use
FunctionGraphNodefor SK functions - Connect: creates unconditional edges between nodes; use
ConditionalGraphNodefor branches - KernelArguments / GraphState: shared execution state and parameters across nodes
Next steps
- Explore additional nodes in
SemanticKernel.Graph.Nodes - Enable metrics/concurrency via
GraphExecutorconfiguration methods - See full examples in the https://skgraph.dev/examples project
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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.
-
net9.0
- FluentValidation (>= 12.0.0)
- FluentValidation.DependencyInjectionExtensions (>= 12.0.0)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
- Microsoft.Extensions.Caching.Memory (>= 9.0.10)
- Microsoft.Extensions.DependencyInjection (>= 9.0.10)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Logging (>= 9.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Options (>= 9.0.10)
- Microsoft.Extensions.Telemetry (>= 9.10.0)
- Microsoft.SemanticKernel (>= 1.66.0)
- Microsoft.SemanticKernel.Abstractions (>= 1.66.0)
- Newtonsoft.Json (>= 13.0.4)
- System.Buffers (>= 4.6.1)
- System.IdentityModel.Tokens.Jwt (>= 8.14.0)
- System.Memory (>= 4.6.3)
- System.Text.Json (>= 9.0.10)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.