Start with the routing decision

Use routing when the same input can follow genuinely different paths, with its own data, instructions, tools, or success criteria. Instead of asking a single prompt to interpret everything, the system classifies the intent and sends the case to a specialized workflow. This separation reduces the mixing of responsibilities, but it adds a step that also needs to be measured.

The first question is not which model to use, but whether the categories are distinct enough to guide different decisions. In an internal inbox, access requests, policy questions, purchasing requests, and technical incidents may require different sources and actions. If all of them receive the same search and the same response, the system may retrieve irrelevant context or offer an unsuitable action.

For well defined tasks, prefer a workflow with explicit paths, not an agent that freely decides each step. This recommendation follows the distinction between predictable workflows and more flexible agents described in the reference, as well as the guidance to increase complexity only when it improves the result. [1]

  • Classification answers one question: which process should receive this input?
  • Retrieval answers another: which authorized data supports the next step?
  • Action answers a third: which operation, if any, can be executed safely?

Sources and references: [1]

Separate classification, retrieval, and action

Treat classification as a structured output, with a closed set of categories, an indication of operational confidence, and extracted fields when they are indispensable. The router should not write a final answer or call business tools. Its role is to choose the path and flag ambiguous, incomplete, or out of scope cases.

After routing, each path should retrieve only the context it needs. A policy request may consult approved documents, while an incident may consult technical records and an access request may check identity data and permissions. Retrieving everything for every path increases noise and makes it harder to discover why an answer was produced.

Action should be a separate step, with parameters validated in code and clear limits. An informational response may end without a tool, while a system change, ticket opening, or approval requires checking required fields, identity, authorization, and current state. The model may propose structured arguments, but the executing service should reject values that are invalid, missing, or incompatible with the operation.

  • Define mutually understandable categories, including an option for uncertainty or escalation.
  • Maintain data contracts between steps, such as category, identifier, urgency, and a short rationale.
  • End the informational path before taking action when there is no legitimate need to change data.

Hypothetical example of an internal inbox

Consider a company that receives messages in an internal inbox such as “I cannot access the dashboard,” “What is the travel policy?” and “Buy a monitor for the team’s new member.” The first component classifies each message as technical support, corporate policy, or a purchasing request. If a message combines topics, such as access and purchasing, the result may contain multiple intents or route the case for clarification instead of choosing an arbitrary category.

In the technical support path, the system extracts the available identifier and retrieves compatible internal articles without executing changes. In the policy path, it searches the current version of authorized documents and drafts a response with the appropriate documentary reference. In the purchasing path, it collects the cost center, item, and rationale, checks applicable rules, and prepares a structured request for the purchasing system. Execution remains outside text generation and occurs only when the process requirements are present.

This design makes testing more specific. It is possible to check whether the message was classified correctly, whether retrieval brought back the expected document or record, and whether the action received valid arguments. It also becomes easier to replace a source, change an approval policy, or revise a prompt without turning the entire inbox into behavior that is impossible to diagnose.

  • For a message without a reliable category, request clarification or route it to the appropriate queue.
  • For a purchasing request, separate data extraction, policy consultation, and order creation.
  • For a message containing instructions inside an attachment, treat the content as untrusted data, not as a system rule.

Sources and references: [2][3]

Control risks where they arise

Routing does not eliminate the risks of malicious text or incorrect interpretation. An internal message, attachment, or retrieved passage may contain instructions that attempt to change the system’s behavior. Therefore, pass external content as data, not as a privileged instruction, and turn the classifier’s output into closed fields before passing it to the next step. The recommendation to use structured outputs and isolate untrusted data is especially relevant when the workflow includes tools. [2]

Also limit the exposure of each path. The classifier does not need access to employee records, and the policy path does not need to receive purchasing credentials. Tools should have names, parameters, and limits that make dangerous combinations more difficult. For operations with external effects, include a confirmation or approval step suited to the risk, without allowing a sentence generated by the model to be treated as authorization.

Evaluate each transition separately and monitor behavior after changes. A useful evaluation tests normal inputs, incomplete messages, multiple intents, text in different formats, attempts at indirect instruction, and ambiguous arguments. In addition to the final result, record the category, retrieved source, selected tool, and validation applied, while avoiding the storage of more sensitive content than necessary.

  • Measure category errors and routing errors as different problems.
  • Test tool arguments, permissions, and invalid states, not only response quality.
  • Define a safe outcome for low confidence, conflicting intents, and missing essential data.

Sources and references: [2][3]

Choose the smallest architecture that solves the case

A practical decision can follow three levels. At the first level, a single call answers or classifies a simple input. At the second, a workflow routes to fixed paths, retrieves specific context, and calls a validated action when necessary. At the third, an agent dynamically chooses tools and steps because the task is open ended and the number of steps cannot be predicted. For an internal inbox with stable categories, the second level is usually the most explainable starting point.

Do not turn categories into separate agents without evidence that specialization improves the result. Each new path creates contracts, tests, observability requirements, and additional failure modes. Start with simple APIs and components, establish a set of representative cases, and compare the routed workflow with a simpler alternative. The reference on evaluations recommends testing early, using data close to real use, and observing each point of nondeterminism. [3]

The criterion for moving forward should be operational: routing distinguishes important cases, retrieval provides suitable context, and action respects process limits. If most errors come from poorly defined categories, refine the taxonomy. If they come from outdated documents, correct the source. If they come from invalid arguments, strengthen the tool contract. Changing the model before locating the failure tends to hide the problem rather than solve it.

  • Use a fixed workflow when the paths and tools can be described in advance.
  • Consider an agent only when the required flexibility cannot fit within explicit routes.
  • Review the taxonomy when new categories appear frequently or when two routes receive the same treatment.

Sources and references: [1][3]

  • List the input categories and write down, for each one, which different decision it enables.
  • Define a structured schema for the router, including ambiguous cases, multiple intents, and missing fields.
  • Map the authorized sources and tools for each route while maintaining only the access that is necessary.
  • Create test cases for classification, retrieval, action arguments, malicious text, and integration failures.
  • Choose pass criteria for each stage and record the events needed to investigate regressions.

Common questions

When does an inbox need routing?

When different types of messages require different sources, instructions, permissions, or actions, and those differences can be expressed as testable categories.

Should retrieval and action remain in the same component?

Generally, no. Separating them makes it possible to validate retrieved context before executing an operation and reduces the risk that textual output becomes an unauthorized change.

When is an agent preferable to fixed routes?

When the number of steps and subtasks depends deeply on each input and cannot be anticipated without losing necessary capability, provided that suitable limits and evaluations exist.

Sources and references

  1. Anthropic: Building effective agents ↗Accessed on October 20, 2026
  2. OpenAI: Safety in building agents ↗Accessed on October 20, 2026
  3. OpenAI: Evaluation best practices ↗Accessed on October 20, 2026