Workflows
Workflows give you a visual node-and-link canvas to connect bots with branching logic. Bots can output variables at runtime, and connections between nodes can route based on those variable values — letting you build dynamic, condition-driven automation pipelines.
Building a Workflow
Go to Web Console → Workflows → New Workflow. The canvas starts with a Trigger node. Add bot nodes and draw connections between them to define the execution path.
- Click + Node to add a bot, queue, or trigger node.
- Drag from the green dot on the right side of a node to the left dot of another to connect them.
- Click any connection line to configure its type (Success, Failure, or Value).
- Assign a runner to each bot node via the gear icon.
- Click Save then Run.
Connection Types
Every link between two nodes has a Connection type. Click any link on the canvas to open the Configure Connection modal and set it.
Success
Follows this path when the bot exits successfully (exit code 0). This is the default connection type.
Failure
Follows this path when the bot exits with an error (non-zero exit code). Use it to run a cleanup or notification bot on failure.
Value
Follows this path when a workflow variable matches an expected value. You configure the variable name, operator, and expected value. Evaluated only on success.
Workflow Variables
Workflow variables let you pass data between bots in the same workflow. Click Vars in the toolbar to open the variable panel. Each variable has a name and an optional initial value.
How variables reach your bot
Every variable declared in the workflow is injected into each bot's environment before it runs. The env var name is:
WORKFLOW_VAR_{UPPERCASE_NAME}For example, a variable named status is available in Python as:
import os
value = os.environ.get("WORKFLOW_VAR_STATUS", "")Bots Outputting Variables
A bot can write a new value to a workflow variable by printing a special marker line to stdout. The Runner captures this line and merges the values into the workflow state before advancing to the next node.
The KLANGO:VARS protocol
Print a JSON object on its own line in this exact format:
[KLANGO:VARS:{"variable_name": "value", "another_var": "42"}]The keys are variable names (matching what you declared in the Vars panel). Values are always strings — numbers should be passed as string representations.
Complete example:
import json, os
def main():
# Read a variable passed in from an upstream bot
count = int(os.environ.get("WORKFLOW_VAR_COUNT", "0"))
# Do some work...
result = "done" if count >= 10 else "retry"
# Write updated variables back to the workflow
print(f"[KLANGO:VARS:{json.dumps({'status': result, 'count': str(count + 1)})}]")
if __name__ == "__main__":
main()[KLANGO:VARS:...] line once. If the line appears multiple times, only the last occurrence is used. Any other print statements are captured as normal log output and displayed in the workflow log panel.Value Edge Routing
A Value edge compares the runtime value of a workflow variable against an expected value using an operator. Configure all three fields in the Configure Connection modal.
| Operator | Behaviour |
|---|---|
| == | Exact match (case-insensitive string comparison). |
| != | Not equal (case-insensitive). |
| > | Greater than — both sides are parsed as numbers (decimal). |
| < | Less than — both sides are parsed as numbers. |
| >= | Greater than or equal — numeric. |
| <= | Less than or equal — numeric. |
| contains | The variable value contains the expected string (case-insensitive). |
| startsWith | The variable value starts with the expected string (case-insensitive). |
| endsWith | The variable value ends with the expected string (case-insensitive). |
Important: enter values without quotes
The Expected value field is a plain string — do not wrap the value in quotes. The comparison is made against the raw variable value your bot outputs.
"ok"— compares against the literal string including the quote charactersok— compares against the string value your bot printed>, <, >=, <=) parse both sides as floating-point numbers. If either side cannot be parsed as a number, the condition evaluates to false and the edge is skipped. Make sure your bot outputs a plain number string like 42 or 3.14.Workflow Log
The log panel at the bottom of the Workflow editor shows real-time progress as the workflow runs. Each entry is timestamped.
[RUN]A bot was dispatched to a runner.[INFO]The runner picked up the job and started the bot process.[OK]The bot completed successfully.[FAIL]The bot exited with an error.[STOP]The workflow stopped — either cancelled or no outgoing path was defined for this result.[INFO] Workflow completedAll paths have finished successfully.Bot stdout (including the [KLANGO:VARS:...] line and any print statements) appears in the log after the bot finishes. Switch to the Variables tab in the log panel to see the current runtime state of all workflow variables at any point during execution.
Run Controls
While a workflow is running you have three controls:
Pause
Pauses the workflow after the current bot finishes. The workflow waits in a Paused state until you resume it.
Resume
Continues the workflow from where it was paused.
Stop
Cancels the current bot job and stops the entire workflow. The execution is marked as Cancelled.
Tips & Common Patterns
Pattern: decision bot + action bots
Use a lightweight first bot to evaluate a condition and set a variable, then connect multiple Value edges to the actual work bots. The decision bot itself does no heavy work — it just reads data and prints [KLANGO:VARS:...].
Pattern: error path with notification
Add a Failure edge from any bot to a notification bot (e.g. one that sends a Slack message or email). The notification bot can read the workflow variableWORKFLOW_VAR_* values to include context in the message.
Pattern: fallback / else
To model an if/else: add two Value edges with opposite conditions (e.g. status == done and status != done). Or combine a Value edge (the "if" case) with a plain Success edge (the "else" fallback — only reached when no Value edge matches).