Building a Flow

Step-by-step guide to creating AI agent workflows with visual node-based interface

Workflow Builder in Sapientia enables you to design complex AI agent workflows tailored to your needs using a visual node-based interface. The system utilizes a Graph Execution Engine to execute flows sequentially.


Core Concepts

A workflow consists of:

  • Nodes: Processing units that perform specific tasks (agent, condition, search, etc.)
  • Edges: Connections linking nodes and determining execution flow
  • State Data: Data flowing between nodes through input and output variables

Building a Workflow

1. Access Workflow Builder

Open the Workflow Builder menu from the Sapientia application sidebar.

2. Add Nodes

Drag & drop nodes from the Floating Sidebar on the left side of the canvas:

Available Nodes:

  • Agent: AI Node with custom system prompt
  • Condition: Logic branching using CEL expressions
  • Search Internet: Search for information from the internet
  • Read Document: Read content from local files
  • Search Memories: Query from vector database memories
  • Call Command: Execute shell commands
  • Call API: Call external HTTP APIs
  • Send Response: Send response to user
  • User Approval: Request user approval before proceeding
  • End: Terminate workflow
  • Note: Documentation notes (not executed)

3. Connect Nodes

Click and drag from the output handle (right point) of a node to the input handle (left point) of the target node to create a connection.

Connection Rules:

  • Start node must exist and cannot be deleted
  • Every workflow must begin from the Start node
  • Condition nodes have multiple output handles (if-0, if-1, else)
  • Approval nodes have 2 outputs (approved, rejected)

4. Configure Nodes

Click a node to open the Config Panel on the right side. Each node type has different configurations:

Example: Agent Node

  • Node Name: Agent identification name
  • Input Source Expression: CEL expression to retrieve input data
  • System Prompt: Instructions for the AI agent
  • Output JSON Schema: (Optional) Expected output structure

Example: Condition Node

  • Conditions: List of CEL expressions for evaluation
  • Case Name: Label for each condition
  • Expression: CEL expression (example: input.score > 80)

5. Test Workflow

  1. In the Start node, enter a Test Prompt in the Config Panel
  2. Click the Run button (▶) in Floating Controls
  3. The workflow will execute in preview mode
  4. Watch the execution flow animation and status of each node:
    • Loading (blue): Node is being processed
    • Success (green): Node completed successfully
    • Error (red): Node encountered an error

6. Save & Export

Saving:

  • Click the Save button (💾) to save the workflow to local database

Export/Import:

  • Export: Click Export button to download workflow data
  • Import: Click Import button to load workflow data

7. Reset Workflow

Click the Reset button to restore the workflow to default configuration.


Data Flow Between Nodes

Data flows through object variables with the following structure:

{
  prompt: "user input",
  input: {
    // Data from previous node
  },
  output: {
    // Current node execution result
  }
}

Accessing Data in Subsequent Nodes:

  • Use input.propertyName to access output from previous node
  • Use output.propertyName for final workflow result
  • Use CEL expressions for data transformation