Skip to content

Visual Workflow Engine

One of the core features of NiteMoon AI Platform is the visual workflow engine, which allows users to build complex AI workflows through a drag-and-drop interface, enabling multi-step AI pipelines without writing code.

Key Features

  • 13 built-in node types: Covering LLM chat, knowledge retrieval, conditional branching, tool invocation, and more
  • Visual orchestration: Drag-and-drop interface for intuitive complex flow construction
  • Context passing: Data flow between nodes through ref_inputs configuration
  • Token statistics: Real-time tracking of token consumption across the entire workflow
  • SSE streaming response: Support for Server-Sent Events streaming output

Node Types

Flow Control Nodes

NodeTypeDescription
STARTEntry NodeWorkflow starting point, configurable welcome message
ENDTerminal NodeWorkflow endpoint
IF_ELSEConditional BranchExecute different branches based on conditions

LLM Nodes

NodeTypeDescription
LLMText ChatBasic text LLM conversation node
MULTIMODAL_LLMMultimodalSupports image, audio, and video input

Knowledge Retrieval Nodes

NodeTypeDescription
KNOWLEDGE_RETRIEVALRAG RetrievalRetrieve knowledge from vector store
KG_RETRIEVALGraph RetrievalRetrieve knowledge from knowledge graph

Tool Nodes

NodeTypeDescription
DOC_EXTRACTORDocument ExtractionExtract document content
DATETIME_TOOLDate & TimeGet current date and time
WEB_SEARCH_TOOLWeb SearchExecute web search
HTTP_REQUEST_TOOLHTTP RequestSend HTTP request
CUSTOM_TOOLCustom ToolUser-defined tool
COMMAND_EXEC_TOOLCommand ExecutionExecute system command

Workflow Execution Flow

mermaid
graph TD
    A[START] --> B[LLM Node]
    B --> C{IF_ELSE Condition}
    C -->|Condition 1| D[KNOWLEDGE_RETRIEVAL]
    C -->|Condition 2| E[WEB_SEARCH_TOOL]
    D --> F[END]
    E --> F
  1. Execution starts from the START node
  2. Nodes are executed sequentially following the connection order
  3. IF_ELSE nodes select branches based on conditions
  4. The output of each node serves as input for the next node
  5. Execution completes upon reaching the END node

Technical Implementation

Graph Traversal Algorithm

The workflow engine uses graph traversal algorithms to execute nodes, supporting:

  • Sequential execution
  • Conditional branching
  • Parallel execution (planned)

Context Passing

Data flows between nodes through ref_inputs configuration:

json
{
  "ref_inputs": {
    "user_query": "{{START.output}}",
    "context": "{{KNOWLEDGE_RETRIEVAL.results}}"
  }
}

Token Statistics

Real-time tracking of token consumption across the entire workflow, including:

  • Input token count
  • Output token count
  • Total token count

Use Cases

Intelligent Customer Service

START -> LLM(Intent Recognition) -> IF_ELSE -> KNOWLEDGE_RETRIEVAL -> LLM(Generate Response) -> END

Data Analysis

START -> DOC_EXTRACTOR -> LLM(Data Extraction) -> HTTP_REQUEST(Data Query) -> LLM(Analysis Report) -> END

Content Generation

START -> WEB_SEARCH_TOOL -> LLM(Content Generation) -> END

Code Examples

Create a Workflow

java
// Create workflow definition
WorkflowDefinition workflow = new WorkflowDefinition();
workflow.setName("Intelligent Customer Service Workflow");

// Add nodes
WorkflowNode startNode = new WorkflowNode("START", "Start");
WorkflowNode llmNode = new WorkflowNode("LLM", "Intent Recognition");
WorkflowNode endNode = new WorkflowNode("END", "End");

// Connect nodes
workflow.addEdge(startNode, llmNode);
workflow.addEdge(llmNode, endNode);

// Save workflow
workflowService.save(workflow);

Execute a Workflow

java
// Execute workflow
WorkflowExecution execution = workflowService.execute(
    workflowId,
    Map.of("userQuery", "How to configure the RAG knowledge base?")
);

// Get execution result
String result = execution.getResult();

Copyright © 2023-2026 nitemoon.cn All Rights Reserved