{"id":33175195,"url":"https://github.com/LittleLittleCloud/StepWise","last_synced_at":"2025-11-20T20:02:08.379Z","repository":{"id":256436302,"uuid":"854892959","full_name":"LittleLittleCloud/StepWise","owner":"LittleLittleCloud","description":"A C# framework to build, visualize and execute event-driven workflow","archived":false,"fork":false,"pushed_at":"2025-05-10T16:34:57.000Z","size":4837,"stargazers_count":142,"open_issues_count":13,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-11-05T02:18:35.742Z","etag":null,"topics":["agentic","dotnet","llm","nextjs","shadcn-ui","typescript","workflow","workflow-engine"],"latest_commit_sha":null,"homepage":"https://littlelittlecloud.github.io/StepWise/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LittleLittleCloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-10T00:13:59.000Z","updated_at":"2025-10-28T16:59:45.000Z","dependencies_parsed_at":"2024-09-25T01:01:23.866Z","dependency_job_id":"dbc4c948-66e0-4c97-a257-6dfe8324803f","html_url":"https://github.com/LittleLittleCloud/StepWise","commit_stats":null,"previous_names":["littlelittlecloud/stepwise"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/LittleLittleCloud/StepWise","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LittleLittleCloud%2FStepWise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LittleLittleCloud%2FStepWise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LittleLittleCloud%2FStepWise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LittleLittleCloud%2FStepWise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LittleLittleCloud","download_url":"https://codeload.github.com/LittleLittleCloud/StepWise/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LittleLittleCloud%2FStepWise/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285503668,"owners_count":27182913,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-20T02:00:05.334Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agentic","dotnet","llm","nextjs","shadcn-ui","typescript","workflow","workflow-engine"],"created_at":"2025-11-16T02:00:36.116Z","updated_at":"2025-11-20T20:02:08.367Z","avatar_url":"https://github.com/LittleLittleCloud.png","language":"C#","funding_links":[],"categories":["Full fledged product"],"sub_categories":[],"readme":"\u003ca name=\"readme-top\"\u003e\u003c/a\u003e\n\n\n\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"./asset/stepwise-logo.svg\" alt=\"StepWise Logo\" width=\"100\"\u003e\n\n# StepWise\n\n\u003cdiv align=\"center\"\u003e\n \u003cstrong\u003e \u003ch3\u003e A code-first, event-driven workflow framework for .NET \u003c/h3\u003e \u003c/strong\u003e\n\u003c/div\u003e\n\u003cp align=\"center\"\u003e\n\n[![License](https://img.shields.io/badge/license-MIT-green)](./LICENSE)\n[![NuGet Version](https://img.shields.io/nuget/v/LittleLittleCloud.StepWIse?label=NuGet\u0026labelColor=grey\u0026color=green)](https://www.nuget.org/packages/LittleLittleCloud.StepWise)\n[![Doc](https://img.shields.io/badge/Doc-Online-blue)](https://littlelittlecloud.github.io/StepWise/)\n[![build](https://github.com/LittleLittleCloud/StepWise/actions/workflows/dotnet-build.yml/badge.svg)](https://github.com/LittleLittleCloud/StepWise/actions/workflows/dotnet-build.yml)\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.reddit.com/r/StepWise_AI\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/StepWise-%23FF4500.svg?style=for-the-badge\u0026logo=Reddit\u0026logoColor=white\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.linkedin.com/groups/14564165\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge\u0026logo=linkedin\u0026logoColor=white\" /\u003e\n    \u003c/a\u003e\n    \u003ca  href=\"https://twitter.com/stepwise_ai\"\u003e\n        \u003cimg src=\"https://img.shields.io/twitter/follow/StepWise?style=social\" height=\"28\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://stepwisegallery20241128154731.azurewebsites.net/\"\u003e\n      \u003cpicture \u003e\n        \u003csource width=\"225\" media=\"(prefers-color-scheme: dark)\" srcset=\"./asset/try-live-demo.svg\"  \u003e\n        \u003csource width=\"225\" media=\"(prefers-color-scheme: light)\" srcset=\"./asset/try-live-demo.svg\"  \u003e\n        \u003cimg alt=\"Try Live Demo\" src=\"./asset/try-live-demo.svg\" \u003e\n      \u003c/picture\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003c/div\u003e\n\n[Demo](https://github.com/user-attachments/assets/cca9d32d-1b59-455e-b19b-535943047ad0)\n\n## What is StepWise?\nStepWise is a .NET framework which assists you to code, visualize and execute event-base workflow. It is designed to help you build complex workflows in a simple and efficient way. StepWise comes with the following key features:\n- **Code-First**: Define workflows using C# code in your project.\n- **WebUI** Visualize and execute workflows from your favorite browser using StepWise WebUI.\n- **Event-Driven**: Execute steps in parallel and resolve dependencies automatically.\n- **AI-Powered**: Work with `Geeno`, a built-in AI assistant in StepWise WebUI to help you run and analyze workflows with ease.\n- **MCP Integration**: Create machine-callable workflows by turning StepWise workflows into MCP servers.\n- **Microsoft.Extensions.AI Support**: Seamlessly integrate StepWise Workflow with Microsoft.Extensions.AI `IChatClient` to utilize AI capabilities.\n\n## Table of Contents\n- [Quick Start](#quick-start)\n  - [Quick Start with Template](#quick-start-with-template)\n  - [Quick Start with StepWise WebUI](#quick-start-with-stepwise-webui)\n  - [Quick Start with Microsoft.Extensions.AI](#quick-start-with-microsoftextensionsai)\n  - [Quick Start with MCP](#quick-start-with-mcp)\n- [Examples](#examples)\n- [Dependency Management between Steps](#dependency-management-between-steps)\n\n\n## Quick Start\n\nHere's a simple example of how to define a workflow to prepare dinner. The workflow consists of several steps, such as chopping vegetables, boiling water, cooking pasta, and cooking sauce. The final step is to serve dinner, which depends on all the previous steps. When executed, the workflow will automatically resolve the dependencies between steps and execute them in the parallel if possible.\n\n```csharp\npublic class PrepareDinner\n{\n    [Step(description: \"\"\"\n        This example demonstrates how to use stepwise to create a simple dinner preparation workflow.\n        - source code: [PrepareDinner.cs](https://github.com/LittleLittleCloud/StepWise/blob/main/example/HelloWorld/PrepareDinner.cs)\n\n        It returns the current time when the workflow starts and then simulates the preparation of dinner.\n        \"\"\")]\n    public async Task\u003cDateTime\u003e Start()\n    {\n        return DateTime.Now;\n    }\n\n    [Step(description: \"boil water\")]\n    [DependOn(nameof(Start))]\n    public async Task\u003cstring\u003e BoilWater()\n    {\n        await Task.Delay(2000);\n\n        return \"Boiled water in 2 seconds\";\n    }\n\n    [Step(description: \"cut vegetables\")]\n    [DependOn(nameof(Start))]\n    public async Task\u003cstring\u003e CutVegetables()\n    {\n        await Task.Delay(3000);\n\n        return \"Cut vegetables in 3 seconds\";\n    }\n\n    [Step(description: \"cook vegetables\")]\n    [DependOn(nameof(CutVegetables))]\n    [DependOn(nameof(BoilWater))]\n    public async Task\u003cstring\u003e CookVegetables(\n        [FromStep(nameof(CutVegetables))] string vegetables,\n        [FromStep(nameof(BoilWater))] string water)\n    {\n        await Task.Delay(4000);\n\n        return $\"Cooked vegetables in 4 seconds. {vegetables}, {water}\";\n    }\n\n    [Step(description: \"cook meat\")]\n    [DependOn(nameof(Start))]\n    public async Task\u003cstring\u003e CookMeat()\n    {\n        await Task.Delay(5000);\n\n        return \"Cooked meat in 5 seconds\";\n    }\n\n    [Step(description: \"\"\"\n        Serve dinner.\n        This will call all the preparation dinner steps in parallel and return the time taken to prepare the dinner.\n        \"\"\")]\n    [DependOn(nameof(CookVegetables))]\n    [DependOn(nameof(CookMeat))]\n    public async Task\u003cstring\u003e ServeDinner(\n        [FromStep(nameof(Start))] DateTime start,\n        [FromStep(nameof(CookVegetables))] string vegetables,\n        [FromStep(nameof(CookMeat))] string meat)\n    {\n        var time = DateTime.Now - start;\n        return $\"Dinner ready in {time.TotalSeconds} seconds\";\n    }\n}\n```\n\n### Quick Start with Template\nStepWise provides a list of templates to help you get started quickly. To install the template, run the following command:\n\n```bash\ndotnet new -i LittleLittleCloud.StepWise.Template\n```\n\nThis will install the following templates:\n- stepwise-console: A console application template with StepWise.\n\nTo create a new project using the template, run the following command. This will create a new console application project with StepWise WebUI configured.\n\n```bash\ndotnet new stepwise-console\n```\n\nAfter creating the project, you can run the project and visit `http://localhost:5123` to see the StepWise WebUI.\n\n### Quick Start with StepWise WebUI\n\nStepWise WebUI is a built-in WebUI for visualizing and executing workflows. To use StepWise WebUI, simply add the following code to your project:\n\n```csharp\n// program.cs\nvar host = Host.CreateDefaultBuilder()\n    //.UseEnvironment(\"Development\")\n    .ConfigureWebHostDefaults(webBuilder =\u003e\n    {\n        webBuilder.UseUrls(\"http://localhost:5123\");\n    })\n    .UseStepWiseServer()\n    .Build();\n\nawait host.StartAsync();\n```\n\nThen, use `StepWiseClient` to add workflows to StepWise UI:\n\n```csharp\nvar stepWiseClient = host.Services.GetRequiredService\u003cStepWiseClient\u003e();\n\n// Add the workflow to the StepWise server\nstepWiseClient.AddWorkflow(prepareDinner);\n\n// Wait for the host to shutdown\nawait host.WaitForShutdownAsync();\n```\n\nNow, you can visit `http://localhost:5123` to see the StepWise UI and execute the workflow.\n\n### Quick Start with Microsoft.Extensions.AI\nPlease visit [M.E.AI Examples](example/MEAI/) to learn how to integrate StepWise with Microsoft.Extensions.AI `IChatClient`. This will allow you to use AI capabilities in your workflows, such as generating text or analyzing data using AI models.\n\n### Quick Start with MCP\nPlease visit [MCP Examples](example/MCP/README.md) to learn how to create a StepWise workflow and turn it into an MCP server.\n\n## Examples\nYou can find more examples in the [examples](https://github.com/LittleLittleCloud/StepWise/tree/main/example) directory.\n\n## Dependency Management between Steps\n### Step Dependency\nIn StepWise, you can define dependencies between steps using the `[DependsOn]` attribute. This ensures that a step is executed only after its dependencies have been satisfied.\n\n\u003e [!Note]\n\u003e Prevent circular dependencies between steps, otherwise, the workflow engine will remind you with an exception.\n\n### Variable Dependency\nVariable dependencies of a step means that the step requires certain variables to be available in the context before it can be executed. If all variable dependencies are met, the step can be executed in parallel with other steps that don't have dependencies on it. In StepWise, variable dependencies are the input parameters of a step.\n\n\u003e [!Note]\n\u003e `[FromStep]` attribute doesn't affect the step dependency. It is used to pass the output of one step as input to another step.\n\nStepWise automatically manages dependencies between Steps:\n- Use the `[DependsOn]` attribute to specify dependencies between Steps.\n- The StepwiseEngine resolves these dependencies and ensures Steps are executed in the correct order.\n\n## Parallel Execution\n\nStepWise supports parallel execution of steps that do not have step dependencies on each other. This can significantly improve the performance of your workflows by executing independent steps concurrently.\n\n## `StepWiseEngine`\n`StepWiseEngine` is the core component of StepWise that manages the execution of workflows. It uses a consumer-producer approach to execute steps in the correct order while handling dependencies between steps and parallel execution when possible. You can visit this [documentation](./article/DeepDiveToStepWiseEngine.md) to learn more about how the `StepWiseEngine` works.\n\n## Primitives\n\nStepWise is built around two main primitives:\n\n### 1. Step\n\nA Step is the smallest unit of work in StepWise. It represents a single task or operation within a workflow.\n\n- **Definition**: A Step is essentially a C# method decorated with the `[Step]` attribute.\n- **Properties**:\n  - Name: A unique identifier for the step.\n  - Input Parameters: The data required by the step to perform its task.\n  - Output: The result produced by the step (if any). **Must be a Task or Task\u003c\\T\u003e**.\n  - Dependencies: Other steps that must be executed before this step. This is specified using the `[DependsOn]` attribute.\n- **Usage**: \n  ```csharp\n  [Step]\n  [DependsOn(nameof(OtherStep))]\n  [DependsOn(nameof(AnotherStep))]\n  public Task\u003cData\u003e GetData(int id)\n  {\n      // Implementation\n  }\n  ```\n\n### 2. Workflow\n\nA Workflow is a collection of Steps that together accomplish a larger task.\n\n- **Definition**: A Workflow is typically represented by a class containing multiple Step methods.\n- **Usage**: \n  ```csharp\n  public class DataProcessingWorkflow\n  {\n      [Step(Name = \"GetData\")]\n      public Task\u003cData\u003e GetData(int id) { /* ... */ }\n\n      [Step(Name = \"ProcessData\")]\n      [DependsOn(nameof(GetData))]\n      public Task\u003cResult\u003e ProcessData([FromStep(\"GetData\")] Data data) { /* ... */ }\n\n      [Step(Name = \"SaveResult\")]\n        [DependsOn(nameof(ProcessData))]\n      public Task\u003cstring\u003e SaveResult([FromStep(\"ProcessData\")] Result result) { /* ... */ }\n  }\n  ```\n\n## Contributing\n\nWe welcome contributions to StepWise! Please see our [Contributing Guide](https://github.com/LittleLittleCloud/StepWise/tree/main/CONTRIBUTING.md) for more details.\n\n## License\n\nStepWise is released under the MIT License. See the [LICENSE](https://github.com/LittleLittleCloud/StepWise/tree/main/LICENSE) file for details.\n\n## Support\n\nIf you encounter any issues or have questions, please file an issue on the GitHub issue tracker.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLittleLittleCloud%2FStepWise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLittleLittleCloud%2FStepWise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLittleLittleCloud%2FStepWise/lists"}