Sigmus.Graph 0.0.8

dotnet add package Sigmus.Graph --version 0.0.8
                    
NuGet\Install-Package Sigmus.Graph -Version 0.0.8
                    
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="Sigmus.Graph" Version="0.0.8" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sigmus.Graph" Version="0.0.8" />
                    
Directory.Packages.props
<PackageReference Include="Sigmus.Graph" />
                    
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 Sigmus.Graph --version 0.0.8
                    
#r "nuget: Sigmus.Graph, 0.0.8"
                    
#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 Sigmus.Graph@0.0.8
                    
#: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=Sigmus.Graph&version=0.0.8
                    
Install as a Cake Addin
#tool nuget:?package=Sigmus.Graph&version=0.0.8
                    
Install as a Cake Tool

Sigmus.Graph

基于 YAML 配置的图形化任务编排框架,是 SigmusFrameworkV2 的核心模块。

功能

  • 图形化工作流 — 通过 YAML 定义任务节点与边,无需编写调度代码
  • 5 种边类型progress(顺序)、state(条件)、event(事件驱动)、switch(短路分支)、join(并行汇聚)
  • 状态管理 — Redis 风格 KV 存储,支持原子操作、过期策略、Watch 订阅
  • 条件表达式 — 内置 AST 缓存的表达式评估器,支持括号、状态引用、标签检查
  • SubGraph 嵌套 — 支持树形任务结构,每个子 Runner 拥有独立 State
  • 暂停/恢复 — 协作式暂停,精确恢复定时器剩余时间
  • 事件匹配 — 路径模板提取参数,支持 ResourceEvent / MessageEvent

安装

dotnet add package Sigmus.Graph

快速开始

1. 定义工作流(YAML)

runner:
  name: "MyRunner"

tasks:
  - name: "Hello"
    func: "PrintTask"
    parameters:
      message: "Hello, World!"

  - name: "Goodbye"
    func: "PrintTask"
    parameters:
      message: "Goodbye!"

edges:
  - from: START
    to: Hello
    type: progress
  - from: Hello
    to: Goodbye
    type: progress
  - from: Goodbye
    to: END
    type: progress

2. 创建并运行 Runner

var yaml = File.ReadAllText("workflow.yaml");
var config = new DeserializerBuilder().Build().Deserialize<GraphConfig>(yaml);

var runner = SimpleGraphRunner.Create(
    config.Runner,
    config.Tasks.ToArray(),
    config.ToRelationshipDataArray()
);

runner.PutFunc("PrintTask", async (task) =>
{
    var msg = task.GetParam<string>("message");
    Console.WriteLine(msg);
    return TaskStage.Completed;
});

await runner.Start();

3. 条件分支(switch 边)

edges:
  - from: CheckTask
    type: switch
    cases:
      - rule: "status==ok"
        to: SuccessTask
      - rule: "*"
        to: ErrorTask

4. 状态管理

runner.State.Set("count", 0L);
runner.State.Increment("count");
runner.State.Watch<long>("count", (old, now) => Console.WriteLine($"{old} -> {now}"));

边类型速查

类型 触发时机 短路
progress 上游任务完成
state 条件表达式满足
switch 上游完成,按 cases 顺序求值
event ResourceEvent / MessageEvent
join 所有上游均完成

依赖

  • Sigmus.Common

许可证

MIT © Luufery

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 (2)

Showing the top 2 NuGet packages that depend on Sigmus.Graph:

Package Downloads
Sigmus.Agent

SigmusAgent - AI Agent 工作流编排模块,基于 SigmusGraph 的 LLM 多步推理和 Agent 工作流

Sigmus.Subject

SigmusSubject - 上层集成模块,提供内置任务实现、Web API 集成和业务编排

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.8 101 4/16/2026
0.0.5 99 4/14/2026
0.0.4 92 4/14/2026
0.0.3 92 4/13/2026
0.0.2 114 4/8/2026
0.0.1 112 4/7/2026