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_inputsconfiguration - 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
| Node | Type | Description |
|---|---|---|
| START | Entry Node | Workflow starting point, configurable welcome message |
| END | Terminal Node | Workflow endpoint |
| IF_ELSE | Conditional Branch | Execute different branches based on conditions |
LLM Nodes
| Node | Type | Description |
|---|---|---|
| LLM | Text Chat | Basic text LLM conversation node |
| MULTIMODAL_LLM | Multimodal | Supports image, audio, and video input |
Knowledge Retrieval Nodes
| Node | Type | Description |
|---|---|---|
| KNOWLEDGE_RETRIEVAL | RAG Retrieval | Retrieve knowledge from vector store |
| KG_RETRIEVAL | Graph Retrieval | Retrieve knowledge from knowledge graph |
Tool Nodes
| Node | Type | Description |
|---|---|---|
| DOC_EXTRACTOR | Document Extraction | Extract document content |
| DATETIME_TOOL | Date & Time | Get current date and time |
| WEB_SEARCH_TOOL | Web Search | Execute web search |
| HTTP_REQUEST_TOOL | HTTP Request | Send HTTP request |
| CUSTOM_TOOL | Custom Tool | User-defined tool |
| COMMAND_EXEC_TOOL | Command Execution | Execute 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- Execution starts from the START node
- Nodes are executed sequentially following the connection order
- IF_ELSE nodes select branches based on conditions
- The output of each node serves as input for the next node
- 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) -> ENDData Analysis
START -> DOC_EXTRACTOR -> LLM(Data Extraction) -> HTTP_REQUEST(Data Query) -> LLM(Analysis Report) -> ENDContent Generation
START -> WEB_SEARCH_TOOL -> LLM(Content Generation) -> ENDCode 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();