Letting LLMs Hand Off at the Right Time: Layered Decision-Making for AI Agents

    Agents that route every single step through a large language model turn simple requests into long, expensive, and error-prone task chains. This article explains how to redistribute decision authority across a layered architecture: deterministic rules for hard constraints, small decision models for stable, limited-option choices, and LLMs for ambiguity, complex reasoning, and unknown situations. It covers the pitfalls of single-step accuracy, confidence thresholds, full-task cost analysis, training on real execution trajectories, and a low-risk rollout strategy—with practical design principles for building reliable agent systems.

    1. An Agent’s Cost Problem Is Often Hidden in Its Decision Loop

    Consider an agent that handles order-cancellation requests. It must recognize the user’s intent, verify identity, look up the order, check fulfillment status, determine whether confirmation is required, and finally execute the action and explain the result.

    From a business perspective, this is a routine flow. From a system perspective, it may involve multiple model inferences, multiple tool calls, and several state updates. If every “what should I do next?” decision is delegated to a large language model, even a simple request turns into a long task chain.

    Large language models excel at understanding complex language, synthesizing incomplete information, and handling open-ended problems—but not every step requires those abilities. Judging whether “identity has been verified,” whether “a tool call failed,” or whether “optional actions exist” often involves only explicit rules or a limited set of options.

    The key to optimization, therefore, is not simply finding a smaller model, but re-partitioning decision responsibilities:

    • Deterministic judgments should not be handed to a model.
    • Judgments with limited options and relatively stable context can be delegated to a small decision model.
    • Ambiguous, complex, or unknown situations should be reserved for the LLM.
    • Irreversible or high-impact operations need independent authorization and confirmation mechanisms.

    What truly needs to be handed off is part of the decision authority—not control of the entire task.

    2. Distinguish Open-Ended Reasoning from Limited-Option Decisions

    2.1 Open-ended reasoning requires generation and synthesis

    When a user asks, “Help me analyze why this batch of orders is anomalous and suggest how to handle it,” the system must decide on an analysis path, integrate multiple pieces of evidence, and organize an explanation. The answer space for such tasks is large, and all reasonable actions usually cannot be enumerated in advance.

    Tasks like this are a good fit for LLMs. However, generative capability does not equal execution authority. Even if the model proposes a plan, the business system must still validate whether it is legal and whether permission requirements are satisfied.

    2.2 Limited-option decisions suit constrained models

    Another class of problems has a small answer space, for example:

    • Should the next step be querying the order, or asking the user for the order number?
    • Is the current information sufficient to proceed?
    • After a tool failure, should the system retry, switch to an alternative path, or escalate to a human?
    • Has the current stage been completed?

    A small decision model can score candidate actions and select the most appropriate one. Because it does not need to generate lengthy explanations, it can reduce inference overhead under suitable task distributions and deployment conditions.

    But there is an easily overlooked prerequisite: the candidate set must contain the correct action.

    If the system offers only “cancel immediately” and “continue querying” while omitting “ask the user for confirmation,” the model—no matter how accurate—cannot make a complete business decision. Candidate-action generation is itself part of the system’s capabilities; responsibility cannot be shifted entirely onto the classification model.

    2.3 Deterministic business constraints should not become model multiple-choice questions

    For example, “orders must not be modified before identity verification passes” is a hard constraint. It does not require a model to decide whether to comply.

    Writing such requirements into a prompt cannot replace validation at the execution layer. Prompts can be ignored, and inputs can contain misleading information. Permission checks, state checks, and parameter validation must always be performed by trusted business logic.

    This means a reliable agent is not a pure model loop, but a control system jointly built from models and traditional software engineering.

    3. Why Good Single-Step Performance Doesn’t Guarantee Task Success

    The source material describes an important phenomenon: models that perform well on isolated decision problems do not necessarily maintain the same task success rate once integrated into a complete agent. Any specific numbers apply only to particular evaluation conditions and should not be treated as performance promises for all businesses, but the underlying issue is broadly relevant.

    3.1 Multi-step tasks amplify small errors

    Suppose a task contains ten critical decisions, each with 95% accuracy. Under the simplified assumptions that steps are independent and any error fails the whole task, the probability that every step in the chain is correct is approximately:

    95%¹⁰ ≈ 60%.

    Real tasks include error correction, retries, and step dependencies, so this result cannot be applied directly to predict real-world success rates. Still, it illustrates a fact: high single-step accuracy alone does not guarantee reliability in long flows.

    3.2 Errors shift the distribution of subsequent inputs

    Offline tests of decision models typically use well-organized states: complete user information, clean tool results, and normalized candidate actions.

    At runtime, however, an earlier step may have selected the wrong tool, omitted parameters, or written stale information into state. The model then faces a non-standard problem built on faulty premises.

    If a model is trained only on normal-flow data, it may fail to recognize such deviations and continue advancing down the wrong path.

    3.3 Locally reasonable is not globally correct

    “CANCEL THE ORDER NOW” may locally match the user’s intent, but from the perspective of the full process, identity may not yet be verified, the order may still be in fulfillment, or business rules may require an additional confirmation.

    Therefore, decision inputs must include more than the latest message. At minimum, they should contain the current goal, completed steps, tool results, permission status, pending conditions, and the business meaning of each candidate action.

    4. Build a Layered Architecture of Rules, Decision Models, and LLMs

    A practical architecture can be organized into five stages.

    4.1 State consolidation: show the model usable, not chaotic, information

    Unify conversation history, tool results, and process state into a consistent decision context. Key fields include:

    • The current task goal and process stage
    • Confirmed facts and their sources
    • Unconfirmed information
    • The result of the most recent tool execution
    • Available actions and their preconditions
    • Current user permissions and operation risk

    State summaries must preserve key constraints. Do not drop information like “not yet confirmed” or “data is stale” just to shorten the context.

    4.2 Rule filtering: remove illegal actions first

    Before scoring, remove candidate actions that are not permitted, based on permissions, process state, and business rules.

    For example, when identity verification has not been completed, actions that modify order state must not enter the executable set. When order state changes, cancellation conditions must be re-checked rather than relying on a previous judgment.

    Rule filtering both reduces the model’s difficulty and limits the risk of unauthorized operations.

    4.3 Small-model scoring: handle stable, limited-option choices

    For steps that still require semantic judgment after rule filtering, use a decision model to score candidate actions.

    Such steps should generally satisfy several conditions: the candidate actions have clear meanings, historical data is sufficient, the consequences of errors are controllable, and an observable correctness standard exists.

    4.4 Escalation routing: hand uncertainty back to the LLM

    If the small model cannot reliably distinguish among candidates, or it encounters an uncovered state, escalate to the LLM for further analysis.

    The LLM also cannot bypass the rule layer. It may supplement information, propose plans, or suggest additional candidate actions, but final execution must still pass business validation.

    4.5 Execution feedback: let results re-enter state

    After a tool executes, record structured results rather than only a one-sentence natural-language summary. Failure reasons, state changes, and whether side effects occurred all influence the next round of decisions.

    For operations with ambiguous outcomes, query the actual state before deciding whether to retry, to avoid duplicated side effects such as duplicate charges or duplicate cancellations.

    5. A Confidence Threshold Is Not a Universal Switch

    A common routing approach: if the small model’s score is high enough, execute; otherwise escalate to the LLM. This is a practical starting point, but three issues must be addressed.

    5.1 A score is not necessarily a probability of correctness

    A high score from the model may only mean it is high relative to the other candidates—not that the action has an equally high actual probability of being correct.

    Use independent validation data to examine the relationship between scores and actual accuracy, and calibrate as needed. Thresholds should be derived from business validation, not set by intuition.

    5.2 Different actions need different acceptance standards

    Read-only queries, user-data modifications, and irreversible operations carry different risks; they should not share a single threshold.

    Low-risk steps can prioritize reduced latency; high-risk steps should use stricter acceptance conditions plus confirmation or review mechanisms. Even if the model is highly confident, it cannot replace user authorization.

    5.3 Beyond the top score, watch the candidate gap

    If the top candidate and the runner-up are very close, there may be genuine ambiguity. Directly executing the top action may not be appropriate in that case.

    You can combine the top score, the score gap, input completeness, and action risk when deciding whether to accept. But these signals are only aids; they cannot replace end-to-end validation.

    The following is a generic control flow for illustration only; it does not correspond to any specific product interface:

    1. Read and validate current state
    2. Generate legal candidate actions based on business rules
    3. If there are no legal actions:
    4. Request more information, or route to human handling
    5. Else if the rules uniquely determine the next step:
    6. Select that action
    7. Else:
    8. Obtain small-model scores for the candidate actions
    9. If action risk is low
    10. and the score passes a calibrated acceptance condition
    11. and the input shows no anomalies:
    12. Select the highest-scoring action
    13. Else:
    14. Escalate to the LLM for further judgment
    15. Re-check permissions, parameters, and the latest state before execution
    16. For operations requiring confirmation, obtain valid confirmation first
    17. Execute the action and record the result

    Risk levels, acceptance conditions, and anomaly rules must be tailored to the actual business; there is no fixed configuration that works for all agents.

    6. Cost Optimization Must Account for the Whole Task, Not a Single Call

    A cheaper small-model call does not mean the complete task is necessarily cheaper.

    Let the cost of one small-model decision be C_small, the proportion escalated to the LLM be r, and the LLM call cost be C_large. The average model cost of this routing step can be roughly expressed as:

    Average cost = C_small + r × C_large.

    But this excludes routing overhead, tool execution, failed retries, context consolidation, and human handling. If the small model frequently selects the wrong tool, causing invalid calls, total cost can rise even though each inference is cheap.

    The same applies to latency. When the system first waits for the small model and then for the LLM, the escalation path stacks two inference times. A high escalation ratio can worsen tail latency.

    Therefore, evaluation should track, at minimum:

    • Average cost per successful task
    • End-to-end task success rate
    • Completion time for common requests and high-percentile requests
    • Escalation ratio and number of invalid tool calls
    • Retry count and human-takeover rate
    • Mis-execution rate for high-risk operations

    Cost metrics must be tied to quality metrics; otherwise, the system may simply trade more failures for fewer inference calls.

    7. Training and Evaluation Must Cover Real Execution Trajectories

    7.1 Collect states, candidates, and outcomes—not just Q&A

    Training samples should capture, as much as possible, the real context at the moment of decision: legal candidates, the chosen action, and the subsequent execution outcome.

    Do not simply treat all LLM outputs as correct labels. For critical steps, label quality should be determined by business rules, tool results, or human review.

    7.2 Cover anomalies and recovery scenarios

    Beyond the normal path, include cases of missing information, tool timeouts, insufficient permissions, order-state changes, and users changing their requests mid-flow.

    These samples teach the model to recognize “I should not continue now,” not merely which tool to pick in common situations.

    7.3 Measure single-step capability and task capability separately

    Offline classification accuracy is useful for model selection, but online decisions should rely on complete-task evaluation.

    A practical sequence: validate on a fixed test set first; then replay historical trajectories to inspect routing behavior; then run shadow mode, where the new policy only makes suggestions without executing, to compare it against the existing flow. Because historical replay cannot fully simulate environments that change when actions change, end-to-end testing under controlled conditions is still required.

    7.4 Preserve a complete audit trail

    Logs should be able to answer: which candidate actions existed, which were excluded by rules, what scores the small model gave, why escalation occurred, and what the final outcome was.

    When recording this information, limit the retention of sensitive data and implement necessary masking, access control, and retention-period management.

    8. Rollout Principle: Start with Low-Risk Steps, Then Gradually Expand

    The safest implementation is not to replace all LLM calls at once, but to first identify decision points that are called frequently, have stable candidate sets, and produce easily verifiable outcomes.

    For example, start with read-only tool selection, process-stage identification, and information-completeness judgment. After those are validated, move on to more complex routing. For high-impact operations, keep independent rule validation and authorization mechanisms in place even after introducing a small model.

    The system also needs fast rollback capability. When input distributions shift, success rates drop, or anomalous operations increase, you can suspend a class of small-model decisions and restore the original path instead of letting errors accumulate.

    Conclusion

    Letting LLMs hand off at the right time means transforming an agent from “relying on generative inference for every step” into a layered decision system with clear responsibilities and controllable risk.

    Rules handle deterministic constraints, small decision models handle stable limited-option judgments, LLMs handle complex understanding and anomaly analysis, and the execution layer controls permissions, state, and side effects.

    The goal is not to minimize LLM calls, but to let each type of computing take on the work it is best suited for—without compromising task quality. Only by validating success rate, cost, latency, and risk together does handing off become genuine engineering optimization, rather than shifting problems onto a cheaper model.