Guide: Build an application flow
In this walkthrough you build a flow: an orchestration graph that runs a decision tree, branches
on its outcome, emails the applicant on approval, and finishes. It is the shortest complete path
through Flow Builder, and every larger flow is this shape repeated.
A flow is the layer above a decision tree. The tree decides; the flow decides what happens next
— price an offer, call an integration, send a message, wait, branch, fan out.
You drive it in natural language. The prompts below are what you type; the tool calls noted
underneath are what your assistant runs, so you can follow along and check its work.
Before you start
- A connection to the environment you want to build in. Sandbox is the safe place for a first build.
- A published decision tree to call from the flow. If you do not have one, do
Build a decision workflow first. - Skim the Flow Builder ground rules
— steps 3 and 6 are where they bite.
Step 1 — See what already exists
List my flows.
Tool: flows_list
Each row carries the flow's public_id — the flow_id every other flow tool takes — plus its
status, trigger type, whether it is active, and which version runs by default. If a flow close to
what you want already exists, read it with flows_get and edit that instead of starting over.
Step 2 — Create the flow
Create a flow called "Income screen" — it should screen an application on income and email the
applicant when they are approved.
Tool: flows_create with name and description
The new flow is a draft: no versions, no graph, not published, and — by design — not tied to any
product. What it does is decided entirely by its graph.
Step 3 — Find the ids your nodes will reference
This is the step people skip, and it is the one that saves the debugging.
Which decision trees can I call from a rule node? Show me what the income-screen tree consumes.
Tools: decision_trees_list, then flows_get_node_variables with kind="rule" and the tree's
numeric workflow id
flows_get_node_variables does two things at once: it returns the variables that reference
exposes, and it proves the reference exists for your tenant. A 404 here means you have the wrong
id — and a graph that saves fine with a bad id will still fail at run time.
It also returns config_key: the exact key the id belongs under in the node's data.
kind | id is | config_key |
|---|---|---|
rule | A decision tree's numeric workflow id | selectedRuleId |
pricing_engine | An offer table id | selectedPricingEngineId |
integration | A provider_type_id from flows_list_active_integrations | selectedIntegrationId |
Also list the integrations I could call from this flow.
Tool: flows_list_active_integrations
Use provider_type_id from that list, not id.
Step 4 — Save the graph as a draft
Save a draft: a trigger, then a rule node running the income-screen tree, approved applicants go
to an email node and then to an "Approved" end node, declined applicants go straight to a
"Declined" end node. The flow is triggered by an application. It takesannual_incomeas input.
Tool: flows_save_draft with graph, trigger_type=2, input_schema
The graph your assistant sends looks like this:
{
"start_node_id": "trigger-1",
"nodes": [
{"id": "trigger-1", "type": "trigger", "data": {"label": "Start"}},
{"id": "rule-1", "type": "rule", "data": {"selectedRuleId": 42}},
{"id": "email-1", "type": "email", "data": {"selectedActionId": 7, "outcomeId": 11}},
{"id": "end-ok", "type": "end", "data": {"label": "Approved"}},
{"id": "end-no", "type": "end", "data": {"label": "Declined", "outcomeId": 12}}
],
"edges": [
{"source": "trigger-1", "target": "rule-1"},
{"source": "rule-1", "target": "email-1"},
{"source": "rule-1", "target": "end-no"},
{"source": "email-1", "target": "end-ok"}
]
}Two things to notice.
Branching is on the target node. A rule node's outgoing edges carry no labels. The run picks
the edge whose target node has the matching data.outcomeId. Here email-1 carries the approve
outcome and end-no carries the decline outcome, so the tree's result chooses the branch.
Every branch ends on an end node. This is the rule LendAPI enforces at publish time, and the
most common reason a publish is refused.
Before anything is sent, flows_save_draft checks the graph locally: node ids, known node types,
edges that point at real nodes, an end node, and every reachable branch able to reach one. A
failure comes back as a validation_error and no call is made. Softer findings arrive as
graph_warnings next to the saved draft — read them; "node x is a rule node with no
selectedRuleId" is a run-time failure waiting to happen.
A flow has one draft at a time. Saving again updates that same draft; published versions are
never touched.
Step 5 — Validate
Validate the draft.
Tool: flows_validate
You get valid, errors and warnings. Errors block publishing. This changes nothing, so it is
safe to run as often as you like — and a read-only connection can run it too.
Step 6 — Test run
Test run the draft with
annual_incomeof 75,000 and show me what each node did.
Tools: flows_get_run_template for the payload shape, then flows_test_run
flows_test_run runs against a throwaway application and returns trace — what each node
received, what it decided, how long it took. That is where you find the node that misbehaved.
One caveat: a test run is safe for the application, not for the outside world. Integration nodes
really call out, and email and SMS nodes really send. Take them out of the draft first if that
matters.
Step 7 — Publish and switch on
Publish this version and make it the default, then activate the flow.
Tools: flows_publish with set_as_default=true, then flows_toggle_active with active=true
Publishing validates first and refuses the version if anything fails — nothing is written, and the
response carries the errors.
Two separate switches decide whether a flow runs:
default_version— whatflows_runexecutes. Publishing alone does not move it; pass
set_as_default=true.active— whether the flow runs at all.flows_toggle_activetakes an explicit boolean,
so calling it twice does not flip the flow back off.
Step 8 — Run it
Run the flow against application
<app_session>.
Tools: flows_get_run_template, then flows_run
flows_run is production: it executes default_version against a real application, calls real
integrations and sends real messages. An application-trigger flow needs app_session; an
API-trigger flow takes none and creates its own application.
Show me what happened on that application.
Tool: flows_get_execution_path
One step per visited node, with status, timings and inputs/outputs — PII stripped — plus
is_processing, which tells you whether the run is still in flight.
Step 9 — When a run is parked
If the flow has a delay node, a run can sit waiting. flows_get_execution_path shows the delay
step and reports is_processing.
This application has been waiting long enough — skip the delay.
Tool: flows_skip_delay
Everything downstream of the delay then runs at once, integrations and communications included.
The other two operations:
flows_suspendstops a run. It does not resume on its own — a human, orflows_rerun, has to
restart it.flows_rerunruns a version against the application again, reading its inputs from the
application's data as it is now rather than the original payload, and replaces the previous
result.
All three change a real application. Your assistant should confirm which application before
calling any of them.
If something goes wrong
| Symptom | Look at |
|---|---|
| The draft will not save | Read the validation_error — it names the node or edge |
| "Branch ending at … must finish on an end node" | The graph |
| "Validation failed; the version was not published" | Read validation.errors, fix, publish again |
| "Flow is not active." | flows_toggle_active with active=true |
| "No versions configured for this flow." | Publish a version and set it as the default |
| A node runs but does nothing | Its reference id is missing — check the last graph_warnings |
| "Invalid workflow ID" / "Invalid offer table ID" | Confirm the id with flows_get_node_variables |
| "Flow is already processing." | A run or delayed resume is in flight — check the execution path |
Full list: Flow failure modes and
troubleshooting.
See also
- Tool reference — Workflow Builder
- Flow Builder ground rules
- Build a decision workflow — the tree a
rulenode runs
Updated about 14 hours ago

