Fallback
A mark on the path a flow takes when its first choice is refused or fails — the other way is the nodes behind it.
2 min read
Fallback marks the moment a flow leaves its first choice. It calls nothing itself: the other way is made of the nodes behind it, most often another AI Model with a cheaper model.
- Node
- Fallback
- Type
fallback- Category
- Model
- Ports
- Default
defaultmust be connected
- Default
- Ends the path
- No
What it does
When an execution reaches the node, the node writes a fallback_used event into the trace, with the reason you gave it, and passes the execution on through Default. A node without a reason writes the event without one.
A model node behind it makes a call of its own and takes a hold of its own. The first call holds nothing any more: a hold it took was given back when the call failed or was refused.
When to use it
On a branch that leaves a model node — Error, Pool exhausted or Deny — or the Deny branch of Budget Check, before the way that replaces the first choice. Several branches may lead into the one node.
To read in the trace why the main path was left: the reason says it in your words.
Switching from one connection to another within one call is the provider pool's work and needs no node — Provider pools. The node is for another path of the flow.
The template Smart model choice is built this way — AI flow templates.
Settings
| Setting | What it is for |
|---|---|
reason | Why the main path was left, in your words. Optional. The trace shows it with the event of the node; a reason of only spaces is not written. |
In the builder the setting is the field Reason. A new node has none.
Ports
The node has one port, Default, and it is required.
Output
The node hands on the input of the request as it came. A later node reads a field of it by the path nodes.<key>.output.<field>, where <key> is the key of this node in the flow, as it would read it by input.<field>.
Errors
The node raises no error of its own. When the flow is published, only its port is checked: Default has to lead somewhere.
Example
- Request — Default → AI Model
- AI Model — Success → Return Response
- AI Model — Deny → Fallback
- AI Model — Pool exhausted → Fallback
- Fallback — Default → AI Model
- AI Model — Success → Return Response
The first AI Model calls the strong model. When the call is refused, or the attempts of its pool run out, the execution passes Fallback and the second AI Model calls a cheaper model with a hold of its own. Either answer goes to Return Response.
Related
AI Model — the ports a model call leaves through.
Ports and branching — several connections into one node.
AI flow templates — the template that falls back to a cheaper model.
Built from openapi b070e1f, sdk contract 5cc7055, php ae4a53b, node 84bc62d