An Agent That Knows What It Can't Know¶
Learning objectives
By the end of this module you should be able to:
- Explain why a strictly corpus-grounded agent, given a question about the live outside world, will confidently produce the wrong kind of answer — and why that's a prompt-design failure, not a model failure.
- Distinguish detecting that a question needs an external capability from executing that capability, and why keeping those separate is what makes detection safe in a policy-controlled environment.
- Describe how over-repeated grounding instructions distort behavior, and what consolidating them into one clear fence plus one clear voice buys.
- Explain why an honesty feature needs negative-control evaluations as much as positive ones.
The wrong kind of right answer¶
Grounded, retrieval-backed agents are built around one rule: answer only from the evidence. That rule is what makes their answers citable and auditable — and it fails in a very specific, very embarrassing way the first time someone asks about the weather.
The agent can't know the weather. But it was never told it could say so. Every instruction it has points inward at the corpus, so it does the only permitted thing: it describes the corpus. The user asked about rain and got a list of their own documents — a response that is simultaneously fully grounded, fully cited, and completely useless.
The failure has three separate roots, and it's worth being able to name each one:
- The router had no vocabulary for "outside." A query classifier that only knows corpus-shaped categories will file every question, however worldly, into one of them.
- The capability was invisible. The platform had an opt-in web research capability — but the prompt never mentioned it, so the model could not suggest it.
- The grounding rule was stated five times and the engagement rule once, with hedges. When instructions conflict, repetition wins. Nothing ever said "you may acknowledge the limits of what you can see."
Detection is a signal, not a trigger¶
The fix starts in the router: a new category for questions that need live, current, outside-world information — weather, prices, news, anything "right now." But in a policy-controlled platform, the tempting next step — just run the web search automatically — is exactly wrong. External capability use is an explicit, per-turn, user-consented, policy-gated decision, and an intent classifier's guess must never substitute for any of those gates.
So the label is a signal, and only the wording of the answer changes:
- The turn still runs a normal corpus pass (never zero evidence — an empty context is its own failure mode).
- The synthesis prompt gains a conditional clause: say plainly that this question needs live outside information; never answer it from unrelated documents; offer corpus material only as clearly-labeled background.
- If — and only if — the tenant's policy permits external calls at all, one more sentence is allowed: the user can enable the web research toggle and ask again. For tenants whose policy forbids it, the model is explicitly instructed never to mention web capabilities at all. A suggestion an administrator has forbidden is not a feature; it's a policy leak.
The user interface closes the loop: the suggestion arrives as a flag on the response, and one click enables the toggle and re-asks. Consent stays where it belongs — with the user, per turn.
One fence, one voice¶
The deeper lesson is about prompt hygiene. The synthesis prompt had accumulated five separate grounding instructions — a persona rule, a boundary clause, a bare "only the retrieved context" line, a citation rule, and an output-contract rule — against a single engagement clause so hedged it qualified itself three times in one sentence.
Instruction repetition isn't neutral. Five restatements of "corpus only" don't make grounding five times stronger; they crowd out everything else the prompt is trying to say. The consolidation replaces the pile with two named blocks: one grounding fence (every claim from context, exact citation markers, never invent sources, say so plainly when the context doesn't cover something) and one voice ("be a genuinely engaged analyst, not a corpus index" — an honest "this needs live outside information" is a better answer than a forced one). Grounding still governs; it just no longer suffocates.
A second, quieter branch handles the adjacent case: when every retrieval arm comes back empty on an ordinary corpus question, the agent now says that honestly too — no fabricated citations, plus a suggestion for how to rephrase or what kind of document would need to exist.
Honesty needs negative controls¶
An intent classifier that detects "outside-world" questions has an obvious failure mode in each direction. Miss a weather question and you get the old behavior — annoying, but familiar. Fire on "what does our contract say about weather delays" and you've broken a working corpus answer — worse than the original bug.
That's why the evaluation fixtures for this feature come in pairs: the positive cases (weather, prices, news — in more than one language, because the classifier must not be English-only) assert the suggestion fires, and the negative controls — including one that deliberately mentions weather while asking about a document — assert it doesn't. The assertion is a boolean flag computed in code, not a phrase-match against generated prose, so it can't drift with the model's wording.
For further study¶
- Take any grounded-agent system prompt you have access to and count the grounding instructions. If there's more than one, work out which single sentence could replace them all — and what the model is currently not being told because of the repetition.
- Design the negative-control fixture set for a classifier that routes "needs a database query" vs. "needs a document search." What's the equivalent of "mentions weather but asks about a contract"?
- Sketch the trust boundary for a "suggest a capability" feature in a policy-controlled system. Where exactly must the eligibility check live so that the suggestion can never reach a user whose administrator disabled the capability?
Next: Retrieval That Checks Its Own Work — the evaluation harness this module's fixtures live in, and the discipline of measuring retrieval before tuning it.