Consider a message to a software company’s support desk: “I changed my card yesterday, and now I can’t get into my account.” Where should it go? Billing is plausible. So is account access. We might need to know whether the subscription payment failed, what “can’t get in” means, or whether the customer is reporting two separate problems. Before deciding which model to use, it helps to notice how many different things are hiding inside the apparently simple instruction to route this ticket.

The first is the state, meaning the information presented to the model for this decision. It might contain the message alone, or the message together with account status and relevant conversation history. TypeSafe’s state documentation makes this separation explicit: the state holds the material to examine, while the questions specify the judgments to make. Named fields can help distinguish the customer’s words from a payment record or an earlier reply. A pile of text may contain the right facts and still make their relationships unnecessarily hard to follow.

Choosing the state is part of designing the decision. If the ticket mentions “the same problem as last week,” omitting last week’s conversation removes potentially important evidence. Including three years of unrelated messages creates a different problem. I would start with the information needed for the particular judgment, make dates and sources clear, and add more only when it helps. A customer’s claim that a payment succeeded and a payment system’s record that it failed should remain distinguishable. The model should not have to guess who said what.

Next comes the question. “What should we do?” gives the model a remarkable amount of work to interpret. “Which support team should investigate the customer’s inability to sign in?” is more specific. “Does the message report a failed payment?” asks something different again. A useful question identifies one judgment and the criteria for making it. If we ask whether a customer requested a refund, the answer concerns the request. It tells us nothing by itself about eligibility, whether the money has already been returned, or who is authorized to approve it.

The answer is the value the model returns under an agreed contract. For routing, that could be one department from a supplied list. For the failed-payment question, it could be yes or no, possibly accompanied by a probability. The contract should also account for inputs that don’t support a clear decision. Depending on the interface, that might mean an “insufficient information” option or separate judgments about whether the needed evidence is present. Otherwise, the application can force a tidy answer out of a thoroughly untidy situation.

The fourth part is the action, what the application actually does after receiving the answer. It could put the ticket in a queue, fetch another record, or ask someone to review the case. This distinction appears in familiar language-model integrations too. In OpenAI’s function-calling workflow, a model requests a function call and application code executes it. Producing an answer and carrying out its consequences are separate steps. Keeping that boundary visible gives us somewhere to apply permissions, ordinary data checks, and the rules governing the workflow.

That boundary matters even when the answer comes with a convincing probability. An estimated 90 percent chance that a message requests cancellation might justify putting it in a cancellation queue. Automatically closing the account is a different action, with a different cost if the interpretation is wrong. We can use the same model judgment while changing what we are willing to do with it. No probability, however impressive its decimal places, grants the application permission to take an action it otherwise shouldn’t take.

Several questions about one state can make the reasoning easier to inspect. We might ask about the primary problem, whether payment failure is mentioned, and whether a human response is requested. We still have to decide how those answers fit together. Separate predictions can conflict, and a model’s answer to one question needn’t constrain its answer to another. If the payment system says the subscription is active, code can enforce that fact rather than asking the model to reconsider it until we like the result.

This breakdown also gives us a practical way to investigate mistakes. Did we omit a crucial record from the state? Did two reasonable readers interpret the question differently? Did the model choose poorly despite clear evidence, or did our code turn a reasonable prediction into an unreasonable action? Saving an appropriate record of those pieces, subject to privacy and retention requirements, makes the investigation much less mysterious. With the boundaries in place, we can get more precise about the middle of the process: whether the question really calls for yes or no, one choice, or a position on a scale.

← Back to writing