Review the prerequisites
Suitable for: Backend developers learning Agent applications.
- Entity disambiguation and constraint preservation in query rewriting
- The purpose of rewriting is to express the known intention more retrievably and not to create missing facts. Entity, negation, time, and scope must have a source, and ambiguities affecting the answer need to be preserved or clarified.
How does the mechanism work?
Step-by-step explanation
- What should I do if the two candidates are very similar?
Move from resolving references to ambiguities that can change the answer.
- How can a user retain an entity that he just rejected in the last round?
Multi-turn state must handle corrections, rather than merely accumulate related terms.
- How to deal with different definitions brought by query expansion?
Even when broader coverage improves, prevent different business definitions from being merged.
Foundation · Understand the concepts
Understand the principle · Entity disambiguation and constraint preservation in query rewriting
Objectives of this level: Identify ambiguous entities and constraints in the supplied structured evidence.
Visual guide · Resolve intent without adding facts
This function validates an already extracted intent, not a model rewrite. Preserve exclusions and dates; current access must be checked again at retrieval. Select the figure to open it at full size.
Same after-sales project
The after-sales user asks “Can it be returned, excluding gifts, during October?” after comparing two orders. This exercise validates a structured intent envelope from already extracted inputs; it does not parse natural language, generate a model rewrite or measure retrieval quality. The server’s current allowed_entities narrows candidates but mentioning an order does not grant access.
The existing capstone main-return creates a return application; it does not execute a refund. These manifests are independent fictional extensions or policy/evidence/counting exercises. They do not add real refunds, publication, model calls or Java execution to the capstone runtime.
Read complete fixtures
ambiguous
{
"text": "Can it be returned, excluding gifts, during October?",
"candidates": [
"order-a",
"order-b"
],
"allowed_entities": [
"order-a",
"order-b"
],
"selected_entity": null,
"constraints": {
"exclude": [
"gift"
],
"from_date": "2026-10-01",
"to_date": "2026-10-31"
}
}
Expected
{
"expected": {
"status": "clarify",
"entities": [
"order-a",
"order-b"
],
"text": "Can it be returned, excluding gifts, during October?",
"constraints": {
"exclude": [
"gift"
],
"from_date": "2026-10-01",
"to_date": "2026-10-31"
}
},
"error": null
}
explicit-choice
{
"text": "Can it be returned, excluding gifts, during October?",
"candidates": [
"order-a",
"order-b"
],
"allowed_entities": [
"order-a",
"order-b"
],
"selected_entity": "order-b",
"constraints": {
"exclude": [
"gift"
],
"from_date": "2026-10-01",
"to_date": "2026-10-31"
}
}
Expected
{
"expected": {
"status": "search",
"entities": [
"order-b"
],
"text": "Can it be returned, excluding gifts, during October?",
"constraints": {
"exclude": [
"gift"
],
"from_date": "2026-10-01",
"to_date": "2026-10-31"
}
},
"error": null
}
preserve-negation
{
"text": "Can it be returned, excluding gifts, during October?",
"candidates": [
"order-a",
"order-b"
],
"allowed_entities": [
"order-a",
"order-b"
],
"selected_entity": "order-a",
"constraints": {
"exclude": [
"opened",
"gift"
],
"from_date": "2026-10-01",
"to_date": "2026-10-31"
}
}
Expected
{
"expected": {
"status": "search",
"entities": [
"order-a"
],
"text": "Can it be returned, excluding gifts, during October?",
"constraints": {
"exclude": [
"gift",
"opened"
],
"from_date": "2026-10-01",
"to_date": "2026-10-31"
}
},
"error": null
}
Reason before coding
Two authorized candidates require clarification. Explicit order-b yields only that entity. preserve-negation retains both gift and opened exclusions plus the original date range; no shortened query may discard these constraints.
Write your predicted decision, evidence used and evidence still absent for each sample before running anything. Match the complete protocol in the implementation track; the examples alone are not the entire contract.
Responsibility boundary
Four tracks are learning methods, not job levels. Junior candidates own bounded code and a counterexample; intermediate candidates own integration/recovery and changed-business evidence; senior candidates add architecture, isolation/migration/incident ownership and one specialty. Real API and JD-required production experience stay separate evidence gates. A fixed local pass is not a learner mastery or hiring certificate.
code example
Read the visible decision evidence
Two authorized candidates require clarification. Explicit order-b yields only that entity. preserve-negation retains both gift and opened exclusions plus the original date range; no shortened query may discard these constraints.
Before running, name one fixture assumption you would need to replace with trusted service evidence.
Acceptance task for this level
Before execution, annotate the three visible fixtures with decision, gate order, known fact and missing evidence; then compare your predictions with the supplied expectations. Contract: build_query_plan(payload).
Reading this browser’s record…
Hide the answer and check your understanding
Do two candidates become unambiguous because one appeared most recently?
Expand reference derivation
No. This contract requires clarification unless explicit choice or one authorized candidate resolves it.
Further explanations and practice
When encountering unfamiliar principles, first read the implementation, continuous questioning and migration cases, and then independently explain the premise and boundaries. Answers and notes are saved to the original account record.
All linked explanations and exercises (1 )
Sources and verification scope
The principles are based on public information; the numbers, cases and tasks are the teaching design of this website. Offline experiments verify the range noted on this page, and the learning effect still needs to be judged through independent tasks and feedback.