Flow Control
Beyond agents and operators, betool provides control nodes to structure the logic of a pipeline.
Condition
A condition node routes exchanges to multiple outputs based on a predicate.
Configuration:
- Input slot — what is evaluated (
exchange.intent,webhook.payload.type…) - Branches — for each value (or boolean condition), a named output
- Default branch — mandatory (fail-safe)
Typical use: routing based on the intent detected by a classifier agent, or based on an HTTP status returned by an operator.
Loop
A loop node iterates over a collection. Configuration:
- Collection slot — the list to iterate over
- Iteration variable — the local name for the current element
- Limit — maximum number of iterations (safety guard)
On each iteration, the internal subgraph executes against the current element. Outputs are aggregated into a list.
An unbounded loop is a time bomb. Always set the max limit. The editor will refuse to publish without one.
Filter
A filter node removes exchanges that do not satisfy a predicate. Useful for eliminating noise before incurring downstream LLM costs.
Example: filtering emails whose from field is on a blocklist, or webhooks where type != "order.created".
Human approval (confirmation)
A confirmation node pauses the pipeline and waits for a human to approve or reject from the admin interface.
Configuration:
- Question — what is asked of the reviewer (with context placeholders)
- Branches —
approved/rejected(and optionally custom options) - Timeout — if no response is received, route to the default branch
- Notification — who to alert (email, Mattermost, Slack)
Typical use cases:
- Confirming a high-value outbound call.
- Validating a cancellation email before sending.
- Approving a sensitive response before publication.
The history preserves the reviewer's name and timestamp — fully traceable for audit purposes.
Best practices
- Always wire the default output. An exchange that falls into a void stays in
processingand blocks the queue. - Keep conditions simple. A condition with 12 branches is a signal that you need two cascaded agents rather than condensed logic.
- Limit nested loops. A loop inside a loop inside a loop means costs that explode. Prefer transforming the collection upstream instead.