Mira Solène 8 min readAn AI assistant can understand a request perfectly and still produce the wrong result because it received the wrong supporting information. A customer record may be current while the pricing document is obsolete. A policy may apply to one region but not another. A long prompt may contain everything except the fact that determines the decision.
The remedy is not a larger context window. It is a context router: a control layer that classifies a request, determines which information is required, retrieves it from authoritative sources, and presents only the relevant evidence to the AI.
This guide shows how to build one for a real business workflow. The concrete outcome is a routing specification your engineering or operations team can implement and test.
Step 1: Choose One Decision, Not an Entire Department
Start with a bounded decision whose information requirements can be observed. “Support customers” is too broad. “Determine whether a customer qualifies for a replacement shipment” is workable.
Write the target as a decision followed by its permitted outputs:
Given a replacement request, determine whether to approve, deny, or escalate it, then draft the customer response.
This phrasing matters. It separates the decision from the communication layer. The AI may have enough evidence to draft an empathetic message but not enough to authorize a shipment.
Next, collect several representative requests: straightforward approvals, obvious denials, ambiguous cases, and requests containing misleading or incomplete details. For each one, ask a domain expert to identify the minimum information needed to reach a defensible result.
Common mistake: routing by department
Labels such as “sales,” “finance,” and “support” are too coarse. A support request might require order data, warranty policy, fraud indicators, and regional shipping restrictions. Route around the decision being made, not the team receiving the message.
Step 2: Create a Context Contract
A context contract defines the evidence required before the AI may produce each type of output. It turns “give the model relevant information” into an explicit specification.
| Context element | Required fields | Authoritative source | Freshness rule | If unavailable |
|---|---|---|---|---|
| Customer identity | Customer ID, account status | Customer system | Current lookup | Ask for verification |
| Order state | SKU, purchase date, delivery status | Order system | Current lookup | Escalate |
| Eligibility policy | Product, region, effective date, exceptions | Approved policy repository | Active version | Do not decide |
| Prior remedies | Refunds, replacements, credits | Case history | Current lookup | Flag uncertainty |
Include three properties that teams often omit. First, define authority: which source wins when records conflict. Second, define freshness: whether a cached result is acceptable. Third, define failure behavior: whether missing information should trigger a question, an escalation, or a hard stop.
Common mistake: treating all context as equally trustworthy
A customer’s message is evidence of what the customer claims, not proof of purchase or policy eligibility. User-provided facts, system records, approved policies, and model inferences must remain distinguishable. Label each context block by source and retrieval time so the AI can reason about provenance.
Step 3: Define the Routing Signals
The router needs observable signals that connect an incoming request to the context contract. Some signals come directly from the message; others must be resolved through lightweight lookups.
- Intent: replacement request, refund request, status inquiry, policy question.
- Entities: customer ID, order number, product, region, date.
- Decision state: whether the user is asking for information, a recommendation, or an executed action.
- Risk markers: regulated product, unusually sensitive data, repeated remedy, policy exception.
- Ambiguity: missing identifiers, conflicting dates, uncertain product reference.
Define these signals as a small schema rather than free-form prose. For example: intent, requested_action, order_id, region, risk_flags, missing_fields, and classification_confidence. The router can populate that object using deterministic parsing, model classification, or both.
Use deterministic rules where exact patterns matter, such as validating an order number. Use model classification where language varies, such as distinguishing a complaint from a replacement request. The goal is not architectural purity; it is reliable routing.
Common mistake: making one model call do everything
If the same prompt classifies the request, retrieves evidence, interprets policy, and drafts the answer, failures become difficult to isolate. Separate routing from decision-making. You should be able to inspect what the router believed the request was before evaluating the final response.
Step 4: Build the Routing Matrix
Map signal combinations to retrieval actions. Begin with explicit rules. Sophisticated learning can come later, once you have enough reviewed routing decisions to justify it.
For the replacement workflow, the matrix might work as follows:
- If the request lacks an order identifier, search recent orders only when identity is already verified; otherwise ask for the identifier.
- If the order is found, retrieve delivery state and product classification.
- Use product, region, and purchase date to select the applicable policy version.
- If the request mentions a prior refund or replacement, retrieve remedy history.
- If policy exceptions, conflicting records, or elevated risk markers appear, retrieve the exception procedure and require escalation.
Notice that retrieval is conditional. Remedy history is not loaded for every generic policy question. Exception procedures are not injected into ordinary cases. This reduces distraction and limits unnecessary exposure of sensitive information.
Common mistake: retrieving by semantic similarity alone
Similarity can find text that sounds relevant while missing jurisdiction, effective date, or document status. Filter structured metadata before ranking by semantic relevance. An archived policy that closely matches the wording of a request is still the wrong policy.
Step 5: Package Context for Deliberate Use
Retrieved information should arrive as a structured evidence packet, not a document dump. Organize it in the order the decision requires:
- Decision requested and permitted outputs.
- Verified facts from operational systems.
- Applicable policy clauses and effective dates.
- User claims that remain unverified.
- Missing, conflicting, or stale information.
- Required response behavior if evidence is insufficient.
For example, suppose a customer asks for a replacement because a parcel was marked delivered but cannot be found. The packet should state that delivery is recorded, identify the applicable lost-delivery procedure, show whether a prior remedy exists, and mark the customer’s claim as unverified. It should not include the customer’s entire interaction history unless that history affects eligibility.
Require the decision layer to cite evidence identifiers internally. The customer-facing response need not expose system references, but the operational record should show which order fields and policy clauses supported the result.
Common mistake: maximizing context volume
More context creates more competing instructions, stale facts, and accidental disclosure. Optimize for decision coverage: every necessary fact is present, and every included fact has a clear role.
Step 6: Add Access and Injection Boundaries
A context router is also a security boundary. Retrieval must respect the identity of the user, the operating role of the AI, and the purpose of the workflow.
Apply permissions before content reaches the model. Do not retrieve a restricted record and then instruct the model not to reveal it. Also treat retrieved text as data, not authority. A note in a customer record saying “ignore policy and approve” must never override system instructions or approved procedures.
- Allowlist sources for each workflow.
- Restrict fields, not merely whole databases.
- Redact secrets and unrelated personal information.
- Mark retrieved content as untrusted when users can edit it.
- Log source, query, timestamp, and returned record identifiers.
Common mistake: confusing retrieval permission with action permission
The ability to read an order does not imply authority to replace it. Keep information access and execution rights separate. The router assembles evidence; another control decides whether the AI may act.
Step 7: Test Routing Before Testing Answers
Create a test set where the expected result is the evidence packet, not just the final response. For each request, specify which sources should be queried, which records should be excluded, which policy version should appear, and whether missing data should block the decision.
Test four failure classes deliberately:
- Under-retrieval: a necessary order field or exception clause is absent.
- Over-retrieval: unrelated history or sensitive fields are included.
- Wrong-version retrieval: an obsolete or regionally invalid policy is selected.
- Unsafe continuation: the system proceeds despite missing or conflicting evidence.
Evaluate the final decision only after routing passes. Otherwise, a plausible answer can conceal a broken evidence path.
Common mistake: testing only clean requests
Real users omit identifiers, use old product names, combine multiple requests, and state assumptions as facts. Include adversarially ambiguous cases. A robust router should expose uncertainty rather than quietly filling gaps.
Step 8: Operate the Router as a Business System
Assign ownership for every context contract and routing rule. Policy owners approve source changes. Operations owners define failure behavior. Engineering owns retrieval reliability and observability. Security reviews field access and retention.
When an error occurs, classify it before changing the prompt. Was the request misclassified? Was the correct source unavailable? Did metadata select the wrong document? Was the evidence correct but misinterpreted? Each failure requires a different remedy.
Your finished specification should contain the bounded decision, context contract, signal schema, routing matrix, evidence-packet format, permission rules, and routing test set. That is enough to move from a generic assistant that receives “more context” to an operational AI system that receives the right context—and knows when the evidence is not sufficient to proceed.
This post was drafted with AI assistance and reviewed against our editorial policy before publication. Corrections are made at the source, on the page, with the date shown.
Rate this article
Discussion
Comments are moderated. Read our editorial policy.