workflow.branch
Operation: workflow.branch
Category: workflow
Tags: control-flow
Evaluate a condition and select a branch (then/else)
Runtime
Section titled “Runtime”Type: Native (built-in)
Timeout: 300s
Retries: 3 (ExponentialWithJitter)
Inputs
Section titled “Inputs”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
condition_path | String | No | "$context.condition" | Context path to evaluate (e.g., $context.score) |
Outputs
Section titled “Outputs”| Name | Type | Description |
|---|---|---|
branch | String | Selected branch name |
condition_met | Boolean | Whether the condition was true |
operator | String | Operator used |
Default Configuration
Section titled “Default Configuration”{ "else_branch": "else", "operator": "exists", "then_branch": "then"}import { WorkflowBuilder } from "@fabric-platform/sdk";
const workflow = new WorkflowBuilder("my-workflow") .node("workflow-branch", "transform", (n) => n.config({ operation: "workflow.branch", // ... node-specific config }) ) .build();from fabric_platform import FabricClient
fabric = FabricClient(api_key="fab_xxx")
wf_id = fabric.upsert_workflow("my-workflow", nodes=[ { "key": "workflow-branch", "kind": "transform", },])use fabric_sdk::FabricClient;
let client = FabricClient::new("http://localhost:3001", api_key)?;
let wf_id = client.upsert_workflow("my-workflow", serde_json::json!({ "nodes": [{ "key": "workflow-branch", "kind": "transform" }]})).await?;curl -X POST http://localhost:3001/v1/workflow-definitions \ -H "Authorization: Bearer $FABRIC_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "my-workflow", "nodes": [{ "key": "workflow-branch", "kind": "transform" }] }'Example
Section titled “Example”{ "key": "check-approval", "operation": "workflow.branch", "config": { "condition_path": "$context.approval.approved", "operator": "eq", "value": true, "then_branch": "publish", "else_branch": "revise" }, "outputs": [{ "name": "branch", "path": "$context.selected_branch" }]}Common Errors
Section titled “Common Errors”Condition path resolved to null — defaulting to else branch
Section titled “Condition path resolved to null — defaulting to else branch”Cause: The context path specified in condition_path does not exist
Fix: Ensure the upstream node produces output at the path you’re checking. Use workflow.validate_context before branching to catch this earlier