Connections & conditions
By the end of this page you will be able to make a branch run only when it should, using either a value check or a yes/no question.
Prerequisites
- A graph with at least two connected agents (Canvas tour).
- Admin or Developer role.
Click a connection on the canvas to open its settings.
Always, or only sometimes
| Option | What it means |
|---|---|
| Always run | The target step runs whenever this connection is reached. This is the default. |
| Run only when a condition passes | The target step runs only if the condition is true. Otherwise it is skipped. |
How to decide
A condition can be evaluated two ways, and the right one depends on what the earlier agent wrote.
| Method | Use it when | Cost |
|---|---|---|
| Check a value | The earlier agent wrote something you can test — a score, a status, a flag. | Free |
| Ask an LLM | The earlier agent wrote prose, and you need a judgement about it. | One small LLM call each time the connection is evaluated |
Check a value
Write an expression against the shared scratchpad:
'##RISK_HIGH##' in stm.risk_verdictThe panel lists every value written by an earlier step, as clickable chips, so you rarely have to type a key by hand. Only upstream keys are offered — a condition referring to a later step would always be false, because that step has not run yet.
Available operators:
== != < <= > >= and or not inThe expression is checked as you type, so a mistake surfaces here rather than as a step that mysteriously skipped.
Two things count as false rather than as errors. A value that was never written counts as empty, and comparing two different kinds of thing counts as false. Either way the step is skipped, not failed. That is deliberate — a broken condition should not take the turn down — but it does mean a typo in a key name produces a branch that silently never runs.
If you reference a key that nothing writes, the panel warns you that the condition will always be false. Take that warning seriously; it is the most common cause of a dead branch.
Ask an LLM
Write a yes/no question about what the earlier agent produced:
Does the draft still need revision?
Use this when the earlier agent writes prose rather than a value — a review, a summary, an assessment. Each evaluation costs one small LLM call, so prefer Check a value where the data allows it.
Which model answers these is set once for the whole graph, under Conditions & repeats in Graph settings. A small, fast model is the right choice.
Getting a value worth testing
Check a value only works if an agent writes something testable. Ask for it in that agent’s instructions.
The simplest reliable technique is a marker the agent ends its reply with. A Risk Scorer told to finish with exactly one of ##RISK_HIGH##, ##RISK_MED## or ##RISK_LOW## gives you a condition that cannot be misread:
'##RISK_HIGH##' in stm.risk_verdictAn Editorial Reviewer that ends with ##VERDICT_APPROVED## or ##VERDICT_REWORK## gives a loop the same clean signal. Returning JSON with a named field works too, if the rest of your flow reads it.
Branching on ordinary prose with an expression is the usual reason a condition never matches. Either give the agent a marker to emit, or use Ask an LLM.
Conditions where branches meet
If several connections lead into the same step and they carry different conditions, the editor blocks the save:
Connections into ”…” carry different conditions — move each condition onto its source node, or route the branches through a join node first
Put the condition on the connection out of each branch instead, so each branch decides for itself whether it reaches the shared step.
Save your changes
Click Save in the header. Conditions are validated on save as well as while you type.
Common issues
- A branch never runs — The condition references a key nothing writes, or the value is a different type from what you compared it to. Both count as false.
- A branch always runs — The connection is still on Always run, or the expression is true more often than you think. Test it in the preview and watch the Live feed.
- “enter a yes/no question” — The connection is set to Ask an LLM with an empty question.
- Save is blocked where branches meet — Move each condition onto its own branch’s outgoing connection.