Slickflow Documentation

repository·master·Indexed 21 days ago

https://github.com/besley/slickflow

An intelligent .NET workflow engine for BPMN that integrates traditional business process management with AI capabilities, including LLM and RAG nodes, multi-agent orchestration using the ReAct pattern, and a built-in Business Rules Engine. It features a Frontend Designer, Backend API, and an MCP Server (sfmcp) to expose workflows as tools for AI assistants.

Tokens
11.7K
Snippets
45
Records
53
Agent score
75%

What's inside Slickflow

  1. Orchestrate multi-agent interactions using the ReAct pattern

    master

    Slickflow supports multi-agent orchestration using the ReAct (Reason → Act → Observe) loop. Each Agent node runs an autonomous loop:

    1. Reason: Analyzes the task and available tools.
    2. Act: Calls a registered tool (API, sub-agent, etc.).
    3. Observe: Receives the tool result and decides the next step.

    Agents use AgentConversationMemory to maintain per-session dialogue history across turns.

  2. Integrate LLM and RAG nodes into workflows

    master
    Slickflow allows you to add Large Language Model (LLM) and Retrieval-Augmented Generation (RAG) nodes directly into BPMN process diagrams as first-class workflow steps. This enables orchestrating multi-step AI pipelines including prompt construction, tool calls, knowledge base retrieval, and post-processing. Supported providers include OpenAI (GPT-4, GPT-3.5) and QianWen (Alibaba), with an extensible architecture for others like DeepSeek.
  3. Understand the Slickflow.Module.External.Tests workflow

    master

    This test suite simulates a customer-AI interaction to verify the integration of CustomerService and MessageService with Supabase.

    Workflow Steps:

    1. Variable Initialization: Sets user_message (simulated customer input) and ai_response (simulated AI reply).
    2. CustomerService Execution: Parses the user_message using regex to extract contact info (name, mobile, wechat, email). It then inserts or updates the biz_customer table in Supabase and writes the resulting customer_id to the process variables.
    3. MessageService Execution: Saves the user_message, ai_response, and the customer_id (if available) to the biz_conversation table in Supabase.
  4. Use rules for conditional routing in BPMN

    master

    Rules can be attached to gateway transitions in BPMN diagrams. When the engine reaches a split gateway, it automatically evaluates the rule expressions and follows the matching branch. Common patterns include:

    • Amount threshold routing: e.g., amount > 10000 routes to a senior approval branch.
    • Status-based branching: e.g., checking inventory levels.
    • AI output routing: e.g., routing based on an LLM confidence score.
  5. Create a PropertiesProvider to organize UI elements

    master

    A PropertiesProvider is responsible for registering custom properties and determining when they should appear in the panel. You use propertiesPanel.registerProvider to add your provider, typically using a LOW_PRIORITY to ensure it loads after the standard BPMN properties.

    Use the getGroups method to return a function that modifies the existing groups list. This allows you to conditionally inject your custom groups based on the selected element (e.g., only showing a 'Magic' group if a bpmn:StartEvent is selected).

    function MagicPropertiesProvider(propertiesPanel, translate) {
      // Register with a lower priority to load after basic BPMN properties
      propertiesPanel.registerProvider(LOW_PRIORITY, this);
    
      this.getGroups = function(element) {
        return function(groups) {
          // Add the custom group only if a StartEvent is selected
          if(is(element, 'bpmn:StartEvent')) {
            groups.push(createMagicGroup(element, translate));
          }
          return groups;
        }
      };
    }
    function MagicPropertiesProvider(propertiesPanel, translate) {
      propertiesPanel.registerProvider(LOW_PRIORITY, this);
    
      this.getGroups = function(element) {
        return function(groups) {
          if(is(element, 'bpmn:StartEvent')) {
            groups.push(createMagicGroup(element, translate));
          }
          return groups;
        }
      };
    }
  6. Manage human-centric workflows (BPM)

    master

    Slickflow supports traditional BPM patterns including Sequence, Split/Merge (AND/OR gateways), Sub-processes, and Multi-instance tasks.

    Core human-task operations include:

    • Start / Run: Launch or advance a process.
    • Withdraw: Pull a task back from a user.
    • SendBack: Return a task to a previous step.
    • Resend / Reverse / Jump: Advanced exception handling and routing.
    // Start a process instance
    IWorkflowService wfService = new WorkflowService();
    var startResult = wfService.CreateRunner("10", "Jack")
        .UseApp("DS-100", "Book-Order", "DS-100-LX")
        .UseProcess("PriceProcessCode")
        .Start();
    
    // Run to next step
    var runResult = wfService.CreateRunner("10", "Jack")
        .UseApp("DS-100", "Book-Order", "DS-100-LX")
        .UseProcess("PriceProcessCode")
        .NextStepInt("20", "Alice")
        .Run();
  7. Deploy Slickflow services using separate Docker images

    master

    For production environments requiring better isolation and scaling, you can run the components as individual containers.

    Components:

    1. Backend API: besley2096/slickflow-api (Requires database connection)
    2. Frontend Designer: besley2096/slickflow-designer (UI for workflow modeling)
    3. WebTest: besley2096/slickflow-webtest (Requires database connection)
    # Backend API
    docker pull besley2096/slickflow-api:latest
    docker run -d -p 5000:5000 \
      -e WfDBConnectionType=PGSQL \
      -e WfDBConnectionString="Server=host.docker.internal;Port=5432;Database=wfdbbpmn2;User Id=postgres;Password=your-password;TimeZone=UTC;" \
      --name slickflow-api \
      besley2096/slickflow-api:latest
    
    # Frontend Designer
    docker pull besley2096/slickflow-designer:latest
    docker run -d -p 8090:8090 \
      --name slickflow-designer \
      besley2096/slickflow-designer:latest
    
    # WebTest
    docker pull besley2096/slickflow-webtest:latest
    docker run -d -p 5001:5001 \
      -e WfDBConnectionType=PGSQL \
      -e WfDBConnectionString="Server=host.docker.internal;Port=5432;Database=wfdbbpmn2;User Id=postgres;Password=your-password;TimeZone=UTC;" \
      --name slickflow-webtest \
      besley2096/slickflow-webtest:latest
  8. Configure Supabase for Slickflow External Tests

    master

    To run the Slickflow.Module.External.Tests (which simulates customer-AI chats and saves data to Supabase), you must configure your Supabase credentials. You can provide these via an appsettings.json file or through environment variables.

    Option 1: appsettings.json

    Ensure the following keys are present in your appsettings.json (and copied to the output directory):

    • AiModelProvider:SupabaseProjectUrl
    • AiModelProvider:SupabaseServiceRoleKey (use your service role key, or an anon key for testing)

    Option 2: Environment Variables

    Alternatively, set the following environment variables:

    • SUPABASE_URL or SUPABASE_PROJECT_URL
    • SUPABASE_SERVICE_ROLE_KEY or SUPABASE_ANON_KEY
    {
      "AiModelProvider": {
        "SupabaseProjectUrl": "https://YOUR_PROJECT_REF.supabase.co",
        "SupabaseServiceRoleKey": "YOUR_SERVICE_ROLE_KEY"
      }
    }
  9. Initialize the Database with SQL Scripts

    master

    Slickflow uses SQL scripts located in the database/ directory to set up the schema and seed data.

    Import Order:

    1. Run the DDL script (wfdbtest2099_pgsql_schema.sql) to create tables, indexes, and sequences.
    2. Run the DML script (wfdbtest2099_pgsql_data.sql) to insert initial seed and demo data.

    Example using psql:

    psql -h 127.0.0.1 -U postgres -d wfdbtest2099 -f database/wfdbtest2099_pgsql_schema.sql
    psql -h 127.0.0.1 -U postgres -d wfdbtest2099 -f database/wfdbtest2099_pgsql_data.sql
  10. Set up Supabase database tables for Slickflow External Tests

    master

    The Slickflow.Module.External.Tests requires specific tables in your Supabase project to function. You must ensure the following tables exist:

    1. biz_customer: Stores customer contact information.
    2. biz_conversation: Stores the chat history between the user and the AI.

    You can create the biz_conversation table using the schema provided in Data/biz_conversation_supabase.sql within the project.