Workflow Builder
The Workflow Builder lets you compose agents, tools, and custom logic into graph-based workflows. Each workflow is a directed graph of nodes connected by edges. Nodes perform actions -- querying data, calling agents, evaluating conditions, waiting for approvals -- while edges define the execution path, including conditional branching and parallel forks.
Navigate to AI > Workflow Builder to open the visual canvas.
Workflow Structure
A workflow consists of nodes (what to do) and edges (when to do it). Every workflow begins with a Start node and terminates at one or more End nodes.
Node Types
| Node Type | Description | Configuration |
|---|---|---|
| Start | Entry point of the workflow. Receives input parameters. | Input schema definition. |
| End | Terminal node. Returns final output. | Output mapping. |
| Action | Executes a tool or agent. | Tool name, input mapping, timeout. |
| Condition | Evaluates an expression and branches the flow. | Boolean expression using variables. |
| Loop | Iterates over a collection or repeats until a condition is met. | Iterator variable, break condition, max iterations. |
| Parallel | Forks execution into multiple concurrent branches. | Branch definitions, join strategy (all, any, n-of-m). |
| Transform | Applies a data transformation to variables. | Transformation expression or function. |
| CustomFunction | Executes user-defined code (JavaScript or Python). | Function code, runtime, timeout. |
| Retriever | Fetches data from a data source or external system. | Source config, query, pagination. |
| Wait | Pauses execution until a condition is met or a timeout expires. | Wait condition, timeout, polling interval. |
| Retry | Wraps a node with retry logic. | Max retries, backoff strategy, retry condition. |
| HumanInput | Pauses execution and requests input from a user. | Prompt, input schema, assignee, deadline. |
Action Node Example
- id: fetch_sales
type: Action
tool: query
input:
query: |
from sales
filter date >= @{start_date}
filter date <= @{end_date}
aggregate {total = sum amount}
group region
datasource: sales_warehouse
output:
variable: sales_data
Condition Node Example
- id: check_threshold
type: Condition
expression: "${sales_data.total} > 1000000"
edges:
true: generate_report
false: flag_for_review
Edges and Conditional Branching
Edges connect nodes and define the execution path. Each edge can optionally carry a condition that determines whether the edge is followed.
| Edge Property | Description |
|---|---|
| source | The ID of the origin node. |
| target | The ID of the destination node. |
| condition | Optional boolean expression. If omitted, the edge is always followed. |
| priority | When multiple edges leave a node, priority determines evaluation order. |
| label | Human-readable label displayed on the canvas. |
edges:
- source: check_threshold
target: generate_report
condition: "${sales_data.total} > 1000000"
label: "High revenue"
- source: check_threshold
target: flag_for_review
condition: "${sales_data.total} <= 1000000"
label: "Below threshold"
If a node has multiple outgoing edges and none of the conditions evaluate to true, the workflow engine follows the edge marked as default. If no default edge exists and no condition matches, the workflow fails.
Variable Interpolation
Workflows use variable interpolation with the ${variable} syntax to pass data between nodes. Variables are scoped to the workflow run and populated by node outputs.
| Syntax | Description | Example |
|---|---|---|
${var} | Reference a workflow variable. | ${sales_data.total} |
${input.param} | Reference a workflow input parameter. | ${input.start_date} |
${node_id.output} | Reference a specific node's output. | ${fetch_sales.output.total} |
${env.KEY} | Reference an environment variable. | ${env.API_KEY} |
Variables support dot notation for nested access and bracket notation for array indexing:
${sales_data.regions[0].name}
${fetch_sales.output.rows[*].amount}
Error Strategies
Each workflow and individual node can be configured with an error handling strategy.
| Strategy | Description | Use Case |
|---|---|---|
| FailFast | Stop the entire workflow immediately on the first error. | Critical pipelines where partial results are unacceptable. |
| ContinueOnError | Log the error and continue to the next node. Failed node output is null. | Best-effort pipelines where some steps are optional. |
| RetryWithBackoff | Retry the failed node with exponential backoff before failing. | Transient failures (network timeouts, rate limits). |
| Custom | Execute a user-defined error handler function. | Complex recovery logic (fallback data sources, alerting). |
error_strategy:
default: RetryWithBackoff
retry:
max_retries: 3
initial_delay_ms: 1000
max_delay_ms: 30000
backoff_multiplier: 2
overrides:
- node: send_email
strategy: ContinueOnError
- node: fetch_critical_data
strategy: FailFast
When FailFast is applied to a Parallel node, all concurrent branches are cancelled when any single branch fails. Make sure this is the behavior you want before using FailFast with parallel execution.
Building a Workflow
Visual Canvas
The Workflow Builder provides a drag-and-drop canvas:
- Add nodes -- Drag node types from the palette onto the canvas.
- Connect nodes -- Click and drag from one node's output port to another node's input port to create an edge.
- Configure nodes -- Click a node to open its configuration panel. Set tool, input mappings, conditions, and error strategy.
- Set variables -- Define workflow input parameters in the Start node. Map outputs from each node to named variables.
- Validate -- Click Validate to check the workflow graph for errors (disconnected nodes, circular references, missing configurations).
- Test -- Run the workflow with sample inputs in a sandboxed environment.
- Publish -- Save and publish the workflow for production use.
YAML Definition
You can also define workflows entirely in YAML:
workflow:
name: quarterly_revenue_report
version: 1.0.0
input:
- name: quarter
type: string
- name: year
type: integer
error_strategy:
default: RetryWithBackoff
nodes:
- id: start
type: Start
- id: fetch_data
type: Action
tool: query
input:
query: "from sales | filter quarter == '${input.quarter}' | filter year == ${input.year}"
- id: analyze
type: Action
tool: llm
input:
prompt: "Analyze the following sales data and identify trends: ${fetch_data.output}"
- id: generate_report
type: Action
tool: markdown
input:
content: "${analyze.output}"
- id: end
type: End
output: "${generate_report.output}"
edges:
- source: start
target: fetch_data
- source: fetch_data
target: analyze
- source: analyze
target: generate_report
- source: generate_report
target: end
Monitoring Workflows
Published workflows are monitored from AI > Workflow Runs:
| Metric | Description |
|---|---|
| Run status | Current state: running, completed, failed, paused (waiting for human input). |
| Node-level timing | Execution duration for each node in the graph. |
| Variable inspector | View the value of every variable at each step of execution. |
| Error log | Detailed error messages and stack traces for failed nodes. |
Next Steps
- Multi-Agent Coordination -- Coordinate multiple agents and workflows with event-driven patterns.
- Agent Builder -- Create agents that workflows can invoke.
- Agent Catalog -- Browse available agents to include in your workflows.