Skip to content

Basic Workflow Examples

This guide provides simple workflow examples to help you understand the core concepts of NebulaFlow.

Example 1: Simple Greeting Workflow

Goal

Generate a greeting message using an LLM and display it.

Workflow Structure

Start → LLM Node → CLI Node (Shell) → End

Step-by-Step Setup

  1. Add Start Node
  2. Drag from palette to canvas
  3. No configuration needed

  4. Add LLM Node

  5. Drag from palette
  6. Configure:

    • Model: openai/gpt-4o (or any available model)
    • System Prompt: "You are a friendly assistant."
    • User Prompt: "Generate a warm greeting for a new user."
    • Temperature: 0.7
  7. Add CLI Node

  8. Drag from palette
  9. Configure:

    • Content: echo "${1}" (the full command line; ${1} refers to the first parent output)
    • (Optional) Mode: command (default)
    • (Optional) Shell: bash (default)
  10. Add End Node

  11. Drag from palette
  12. No configuration needed

  13. Connect Nodes

  14. Connect Start → LLM
  15. Connect LLM → CLI
  16. Connect CLI → End

Execution

Click the Run button. The LLM will generate a greeting, and the CLI node will print it.

Example 2: File Processing Workflow

Goal

Read a file, process it with an LLM, and save the result.

Workflow Structure

Start → CLI (Read) → LLM (Process) → CLI (Write) → End

Step-by-Step Setup

  1. Start Node - Default

  2. CLI Node (Read)

  3. Content: cat input.txt (the full command line)
  4. (Optional) Mode: command (default)
  5. (Optional) Shell: bash (default)

  6. LLM Node

  7. Model: openai/gpt-4o (or any available model)
  8. System Prompt: "You are a text processor. Summarize the following text concisely."
  9. User Prompt: ${1} (the output from CLI Read)
  10. Temperature: 0.5

  11. CLI Node (Write)

  12. Content: echo "${1}" > summary.txt (where ${1} is the LLM output)
  13. (Optional) Mode: command (default)
  14. (Optional) Shell: bash (default)

  15. End Node - Default

Execution

The workflow reads a file, generates a summary, and saves it to a new file.

Example 3: Conditional Processing

Goal

Process data differently based on its content.

Workflow Structure

Start → LLM (Analyze) → If/Else → [True] LLM (Process A)
                                   → [False] LLM (Process B)
                                    → End

Step-by-Step Setup

  1. Start Node - Default

  2. LLM Node (Analyze)

  3. Model: openai/gpt-4o (or any available model)
  4. System Prompt: "Analyze the following text and determine if it's positive or negative."
  5. User Prompt: ${1} (the output from Start Node)
  6. Temperature: 0.3

  7. If/Else Node

  8. Content: ${1} == "positive" (where ${1} is the output from LLM Analyze)
  9. True Branch: Connect to LLM Node A
  10. False Branch: Connect to LLM Node B

  11. LLM Node A (Positive)

  12. System Prompt: "Generate an encouraging response."
  13. User Prompt: ${1} (the output from LLM Analyze)

  14. LLM Node B (Negative)

  15. System Prompt: "Generate a supportive response."
  16. User Prompt: ${1} (the output from LLM Analyze)

  17. End Node - Default

Execution

The workflow analyzes input text and routes it to different processing paths based on sentiment.

Example 4: Looping Workflow

Goal

Process multiple items in a list.

Workflow Structure

Start → Loop Start → LLM (Process) → CLI (Save) → Loop End → End

Step-by-Step Setup

  1. Start Node
  2. Output: (optional) can be used to override iteration count
  3. Example: 3 (if using override)

  4. Loop Start Node

  5. Iterations: 3 (fixed number of iterations)
  6. Loop Variable: i (available as ${i} in loop body)
  7. Loop Mode: fixed
  8. (Optional) Override iterations: connect a parent node to the special input port

  9. LLM Node

  10. System Prompt: "Generate a greeting for iteration ${i}."
  11. User Prompt: Iteration ${i} (or any content)
  12. Temperature: 0.7

  13. CLI Node

  14. Content: echo "${1}" >> results.txt (where ${1} is the LLM output)
  15. (Optional) Mode: command (default)

  16. Loop End Node

  17. No configuration needed

  18. End Node - Default

Execution

The workflow runs the loop body 3 times, each time using the iteration index ${i}. The LLM generates a greeting, and the CLI appends it to a file.

Example 5: API Integration

Goal

Fetch data from an API and process it.

Workflow Structure

Start → CLI (Fetch) → LLM (Analyze) → CLI (Send) → End

Step-by-Step Setup

  1. Start Node - Default

  2. CLI Node (Fetch)

  3. Content: curl https://api.example.com/data
  4. (Optional) Mode: command (default)

  5. LLM Node

  6. System Prompt: "Analyze the following JSON data and extract the main insights."
  7. User Prompt: ${1} (the output from CLI Fetch)
  8. Temperature: 0.5

  9. CLI Node (Send)

  10. Content: curl -X POST -H "Content-Type: application/json" -d '${1}' https://api.example.com/insights
  11. (Optional) Mode: command (default)
  12. (Optional) Shell: bash (default)

  13. End Node - Default

Execution

The workflow fetches data, analyzes it with an LLM, and sends the insights to another API using a CLI node with curl.

Common Patterns

Sequential Processing

A → B → C → D
Simple linear flow where each node processes the output of the previous one.

Branching

A → B → C
    ↘ D → E
Conditional branching based on node output.

Parallel Execution

A → B → C
A → D → E
Multiple paths from the same node (requires careful data handling).

Looping

A → Loop Start → B → C → Loop End
Repeating operations on multiple items.

Best Practices

Start Simple

  • Begin with 2-3 nodes
  • Test each node individually
  • Add complexity gradually

Test Incrementally

  • Run the workflow after each node addition
  • Check intermediate outputs
  • Use Preview nodes for debugging

Handle Errors

  • Add condition nodes for error checking
  • Use try-catch patterns where possible
  • Log errors for troubleshooting

Optimize Performance

  • Batch operations when possible
  • Use appropriate delays
  • Cache results when reused

Next Steps