Reasoning node
The Reasoning node is where an agent decides. It reads the conversation, answers the questions you wrote, and sends the run down the arrows whose conditions match. Everything an agent does differently for different people starts here: a refund request goes one way, a greeting another, an angry customer to a person.
Each question is a reasoning. A node can run one or many, and each returns answers the rest of the workflow can use.
Why decide in a node
You could put every rule in one long prompt and hope the model follows it. A Reasoning node makes each decision its own step, and that changes four things:
- Purpose-built models decide. Yes/no questions and fixed categories are answered by classification models that Docana runs for this job, not by a general chat model. You write the question in plain words and never choose or tune a model.
- Routing stays fast. A classification answers in a fraction of the time a written reply takes, so a workflow can decide several things about a message before the person notices a wait.
- Every decision is recorded. Each run keeps the score and the outputs of each reasoning. When an answer goes wrong you can see which decision sent it there.
- Decisions are tested, not trusted. Evals replay realistic conversations and check the path each one took. The Evals page shows how many of the workflow's nodes and arrows your tests cover and lists the paths none of them reach, and Auto-improve can update the workflow until the evals reach the score you set.
The result is an agent whose behavior you can read, measure, and change one decision at a time.
What a reasoning is
A reasoning has four parts:
| Part | What you write |
|---|---|
| Name | A short name, such as "Refund eligibility" |
| What to evaluate | One or two plain sentences: what to judge, and how to fill each output |
| Evidence | What the reasoning reads to decide |
| Outputs | What the workflow learns from it |
You create reasonings on the Reasonings tab of the agent builder, then turn on the ones each Reasoning node should run. One reasoning can serve several nodes.
Outputs
Every reasoning returns a score from 0 to 10. You can also ask for named outputs:
| Output | Use it for | Example |
|---|---|---|
| Yes / no | A gate | isRefundRequest: true or false |
| Fixed choice | A classification with a known set of answers | topic: one of BILLING, ACCESS, SHIPPING, OTHER |
| Other data | Pulling facts out of the conversation: text, numbers, lists, nested objects | orderNumber, items |
Say in the description how each output is decided. "Set isRefundRequest to true only when the person clearly asks for their money back" works. "Detect refunds" does not.
For a fixed choice, always include an honest way out such as OTHER or NEEDS_CLARIFICATION. A list with no way out forces a wrong answer onto a message that fits none of them.
When you define what the score means, write the scale into the description: what a 2 is, what a 9 is. A score measures the outcome. It is not a confidence.
Evidence
A reasoning reads only what you select:
| Evidence | What it is |
|---|---|
| User input | The current message |
| Chat history | Earlier messages that help interpret it |
| Actual output | The reply the agent produced |
| Expected output | A reference answer to compare against |
| Retrieval context | What was found in your knowledge collections |
| Execution context | Values from earlier steps of this run |
Select only what the decision needs. More evidence takes longer to read. With user input and chat history both selected, recent messages count more.
A reasoning that checks facts in an answer can also search the knowledge base while evaluating. Keep that on for factual checks and turn it off for tone, greeting, or format.
Fast and general evaluation
Docana picks how each reasoning is evaluated:
- Fast evaluation uses a classification model built for this job. It answers yes/no questions, fixed choices of 2 to 32 options, and scores whose scale can be kept. It is quicker and cheaper than a generative model.
- General evaluation uses a generative model. It is needed for free text, open-ended numbers, nested data, images and other attachments, and when you set a custom model or reasoning effort.
One output that needs general evaluation moves the whole reasoning to it. So when a decision is on the path of every message, keep it to yes/no and fixed choices, and pull free-text facts out in a separate reasoning.
The builder tells you which one a reasoning will use, under Designed for fast evaluation or General evaluation needed. What happens at run time also depends on the company's permissions, availability, the size of the evidence, and whether a later step needs a written explanation.
Routing on the answers
Each arrow leaving a Reasoning node has a condition on the answers: a score at or above a threshold, a yes/no output being true, a choice equal to a value, a field being present.
Three kinds of arrow behave differently:
- An arrow with a condition fires when the condition matches.
- A default arrow fires only when no condition matched. It is the "anything else" path. Every Reasoning node that routes should have one.
- An arrow with no condition always fires, alongside whatever else matched. Two of these do not choose between paths: they run both.
Arrows that match run in parallel. That is what you want when one message needs two things done, and a problem when you meant to pick one. The routing policy below settles it.
The three settings
Which reasonings run
- All (default): every enabled reasoning runs on each message.
- Contextual: a small router picks the reasonings relevant to the message, and the rest are skipped.
Contextual keeps a node with many reasonings fast. Two things to know:
- A skipped reasoning returns nothing. Conditions on its outputs do not match, so the default arrow matters even more.
- Pin any reasoning that must always run, such as one that extracts a value a later step depends on. You can also add guidance for the router in plain words, such as "run Invoice lookup whenever the person mentions an invoice, even indirectly".
When none of the picked reasonings reaches its threshold, the router gets one more chance to pick up to two of the ones it skipped. After that the node takes its default arrow.
Which arrows fire
- All matching (default): every arrow whose condition matches fires, in parallel.
- Best reasoning only: the highest-scoring reasoning wins, and only its arrows fire.
- Top reasonings: the same, for the number of reasonings you set.
Use Best reasoning only when a message must go down exactly one path. Asking each reasoning to "only match when the others do not" does not work, since each is evaluated on its own. Letting them all score and keeping the best one does.
Ties go to the reasoning higher in the node's list, so drag them into priority order. Arrows that do not depend on a score, such as a default arrow or a condition on the context, are outside the contest and fire as usual.
Cache policy
A conversation has many messages, and most do not change the decision.
| Policy | What it does | Use it when |
|---|---|---|
| Auto (default) | Keeps the answer and runs a light check for whether it is stale | Most nodes |
| Always | Keeps the answer until it is cleared | The decision holds for the whole conversation, such as the language |
| Never | Decides again on every message | Each message can change the path |
A Clear Cache node wipes kept answers, for when the subject changes mid-conversation.
Patterns that work
Route the request. One reasoning with a fixed choice (BILLING, ACCESS, SHIPPING, OTHER), an arrow per value, and a default arrow to a step that asks what the person needs.
Gate a risky step. A reasoning before a refund or a cancellation: "Is the order inside the 30 day window?" with the choices ELIGIBLE, NOT_ELIGIBLE, UNKNOWN. Send UNKNOWN to a step that asks for the missing date.
Extract, then act. A reasoning that pulls the order number and the email into outputs. Pin it under contextual selection so the steps after it always have the values.
Check the answer before it goes out. A reasoning that reads the actual output and the retrieval context and scores whether the reply is supported by the sources. Route a low score to a step that says it does not know, or to a person.
Several specialists, one winner. Many reasonings, each scoring how well the message fits its subject, with Best reasoning only. Order them by priority for ties.
Mistakes to avoid
- No default arrow. A message that fits nothing has no path to follow.
- Two arrows with no condition. Both fire. Use conditions, or a default arrow for the fallback.
- One reasoning that does everything. Routing, extracting, and judging quality in one reasoning is slower and harder to test. Split it.
- Explanations inside a choice. List bare values such as
BILLING. A value written as "BILLING, for invoices and charges" does not match the condition onBILLING. - All the evidence, always. A greeting check does not need the knowledge base.
Test and measure
- Evals can assert which nodes a conversation reached, so a routing change that breaks a path fails a test. Coverage shows the nodes and arrows no eval has exercised yet: write one for each before you rely on that path.
- Conversation Insights can count how often each node is reached, which turns your routing into a chart of what people ask for.
- The Logs of a run show each reasoning's score and outputs.
Next steps
- Workflow nodes: every other kind of node
- Instructions node: the step that acts on the decision
- Creating an agent: build a workflow from the start