Graine AI

Paths and decisions

How a call chooses its next step. The path panel, the four ways a path can be taken, the order the call checks them in, rules, the decision model and what it reads, and values collected as the call moves.

A path joins one step to another and says when the call should take it. After every caller turn, the step the call is on looks at its paths and either moves the call along one of them or keeps it where it is. This page covers how that choice is made and everything you can set on a path.

The path panel

Select the label on an arrow to open its path. The panel's header says what kind of path it is and, when it has an order, where it is checked ("Rule · checked first"). Below it are three parts.

Where it leads

  • From: the step the path starts at. Click it to open that step.
  • To: where it leads. Any step, including the one it starts from.
  • Label: the text on the arrow, up to 60 characters. Left empty, the arrow shows the first words of the condition.

When to take it

  • AI decides, Rule or Always. A path that waits for an event shows the event's name here instead; those are edited in Settings › Advanced › Raw flow (see Events).
  • Below the choice: the Condition the decision model reads, the rules, or a note that this is the fallback.
  • Order: where the path stands among the step's rules and fallbacks. Empty counts as 0. See What Order changes.

Naming and collecting, folded until you open it: Tool name, Tool description and Collect while taking it. See Collecting values on the way and Tool name and tool description.

At the bottom, Insert step puts a new step of the kind you choose in the middle of the path, and Delete path removes it.

Four ways to take a path

AI decides. You write a Condition in plain words, and the decision model reads it together with the conversation. Write it as something that has happened, from the caller's side:

  • The caller has agreed a day and time for the demo.
  • The caller says they already use another product.
  • The caller asks to be called back later.

Give each likely answer a path, the refusals included. If none of a step's conditions fits what the caller said, and the step has no Always path, the call stays on the step and the step answers again: right for a question, wrong for a clear "no".

Conditions on one step should not overlap; when two could both be true, say in the conditions or in the decision guidance which one wins.

Rule. The path is taken when the call's data matches, checked directly with no model involved. See Rules.

Always. The step's fallback, taken when no rule holds and the decision model picks none of the AI-decided paths. A branch must have one. On a step that speaks, an Always path means the call always moves on, one way or another, the next time the caller says anything.

Event. The path waits for a named event that your own server sends into the live call, such as demo_booked. It is never taken because of something the caller said. See Events.

Which path the call takes

After each thing the caller says, and after each silence repeat, the step the call is on checks its paths in this order:

  1. Rules. Lowest order first. The first rule path that holds is taken, at once.
  2. The decision model. Only when no rule held and the step has paths the AI decides. It is asked once, and either picks one of those paths or keeps the call on the step. When the step also has an Always path, that path is offered to it as the default answer, so it always picks something.
  3. The Always path. Taken when nothing above was chosen.
  4. Nothing. The call stays, and the step replies again.
What the step hasWhen the caller speaks, the call…
Rules onlyfollows the first rule that holds, or stays.
Rules and an Always pathfollows the first rule that holds, or else the Always path.
AI-decided paths, with or without rulesfollows the first rule that holds; otherwise the decision model picks a path or keeps the call where it is.
AI-decided paths and an Always pathfollows the first rule that holds; otherwise the decision model picks a path, or the Always path when none fits.
An Always path onlymoves on every time.
No pathsstays. The step goes on answering, unless it ends the call.

If the decision model can't be reached or gives no usable answer, the call takes the Always path when the step has one, and otherwise stays.

Two more things affect when paths are checked at all: an AI reply step the call has only just reached is heard before its paths are checked, and a branch decides the moment the call arrives. Both are on How a call moves through a flow.

What Order changes

Order is a whole number, 0 or more, and lower comes first. A path with no number counts as 0, and paths with the same number keep the order they were added in. It matters in three places:

  • Between rule paths: they are checked lowest first, and the first that holds wins.
  • Between Always paths: only one is ever taken, the one with the lowest order (or the first added, on a tie). Check flags every other Always path on the step, since the call never takes it.
  • Between event paths for the same event: the lowest is taken.

It never moves an AI-decided path ahead of a rule, or the Always path ahead of either.

When two rule or Always paths on one step share a number, Check warns that their order is a tie.

Rules

A rule path is taken when all rules hold or when any rule holds, whichever you choose at the top. Each rule is a field, a comparison and, usually, a value. Add rule adds another.

ComparisonWhat to type as the value
is, is notOne value: text, a number, or true / false.
is above, is at least, is below, is at mostA number.
is one of, is none ofSeveral values, separated by commas.
containsOne value. Holds when the field's text contains it, or when the field is a list that holds it.
is filled in, is emptyNothing. Whether the call has the field at all.

The field box suggests what a rule can read: values the call keeps up to date by itself, such as recipient_data.current_hour, _step_turns or _last_event; the variables your steps use, by their full name, as in recipient_data.plan; fields collected on earlier paths; every default you have set, by its full name; and fields you have given a type. Type anything else yourself: a variable the call is sent is recipient_data. followed by its name. The full list of what a rule can read, and exactly how values are compared, is on Using your data.

A field the call doesn't have

A rule on a missing field doesn't hold, whatever the comparison, except is empty. That includes is not and is none of: "plan is not basic" is false for a call that sent no plan at all.

Some rules that come up often:

To do thisRule
Treat weekends differentlyrecipient_data.current_weekday is one of saturday, sunday (the call's data must include its timezone)
Stop asking after a few tries_step_turns is at least 4
Give up on a silent caller_silence_repeats is at least 2
Skip a question already answereddemo_time is filled in
Send callers who speak Hindi elsewheredetected_language is hi
Pick out large accountsrecipient_data.seats is above 100

The decision model

The decision model chooses between a step's AI decides paths. It is asked only when the step has such paths and no rule held, once for the step, and once more for each branch the call then passes through that needs it. Its settings are in Settings › Models, under Choosing the next step (see Models).

What it reads

Each time it is asked, the decision model reads:

  • your decision guidance, or, without any, a built-in instruction to pick the path that matches what the caller wants;
  • the step's ID, and its instructions, or its title when it has none (a fixed line, a branch);
  • values the call picked up along the way: fields collected on earlier paths, data from events and fields from tool answers;
  • the conversation since the call reached this step, tool requests and results included, or the caller's latest words when nothing has been said on the step yet;
  • for each AI-decided path, its tool name, its condition (or its tool description when it has one), and the fields it collects, with what they mean and the answers they allow.

The variables the call was sent reach it through any {name} in your conditions, guidance and instructions, which are filled in first. It runs at temperature 0 and answers within Decision max tokens. Its answer names the path, gives a short reason and says how sure it is, from 0 to 1; you can read all three after the call (see Test and fix a flow).

Decision guidance

Decision guidance, in Settings › Models, is a set of rules for choosing paths that holds on every step. It replaces the built-in instruction rather than adding to it, so say plainly what should happen when nothing fits.

Choose a path only when the caller's answer is clear. If they ask a question first,
keep the call on the step so it can answer.
If they ask for a person at any point, choose the path to a person.
{first_name} is the only person you may discuss the account with.

Variables are filled in before the model reads it. Unlike other text, a variable with no value is not left out of the guidance: it reads as NULL, so give such variables defaults.

A different decision model for one step

In a step's Fine-tune this step, Decision model can name another model for that step, from the same provider as the agent's decision model, and Decision effort appears when it is a GPT-5 model. A stronger model on the one step with subtle choices, and a faster one everywhere else, is a common mix. A step with its own decision model but no AI-decided paths gets a warning: it would never be used.

Collecting values on the way

A path the AI decides can pick up details from the conversation as the call takes it. Open the path's Naming and collecting section and, under Collect while taking it, choose Add field for each one:

  • a name, such as preferred_channel;
  • a type: Text, Number or Yes / no;
  • optionally, what it means, which the decision model reads: "How they'd like the invitation sent";
  • for a text field, optionally, the answers it may take, separated by commas: Phone, Email, WhatsApp. The decision model must then answer with one of them, so a rule later on can test for an exact value.

Every field is required: the decision model takes the path only once it can fill them all in from the conversation, so a path that collects something waits until the caller has said it. Once the path is taken:

  • later steps can say {preferred_channel}, and rules can test preferred_channel;
  • a field collected again, on this path or another, replaces the earlier value;
  • after the call, your webhook receives every collected field with its latest value in collected_fields (see Webhook payloads).

Collecting on a path usually beats adding a step just to note an answer: the answer is captured by the same decision that moves the call on.

A field can't be named reasoning, confidence, recipient_data or detected_language, or start with _; those are taken, and the flow can't be saved with one. Names made of letters, numbers and _, starting with a letter, are the easiest to use in text, and the builder warns about others.

Tool name and tool description

The decision model sees each AI-decided path as a choice with a name.

  • Tool name is that name. You rarely need one, except that two AI-decided paths from one step to the same step must have different names: the builder gives the second one its own (go_to_<step>_2) when you add it. A name is up to 64 letters, numbers, _ or -, and can't be end_call, the name of one of the agent's tools, or another name the platform reserves.
  • Tool description, when set, is what the decision model reads about the path in place of its condition, and can use variables like the condition can. The builder warns when a path has a tool description but no tool name.

Next: Fixed lines.

On this page