liveBook · Manning

Query refinement

As explained in AI Agents in Action, Second Edition

Query refinement is the technique of reformulating a search query when its results are absent, weak, or insufficiently relevant.

Query refinement is the recovery step used when retrieval returns weak, empty, or irrelevant results: reformulate the query and try again before concluding that information is absent. section 7.2.3

A practical refinement loop can use:

  • Synonyms when the wording may not match the stored information. section 7.2.3
  • Broader terms when the initial query is overly specific. section 7.2.3
  • Subquestions when the original request contains several information needs. section 7.2.3
  • A retry before treating an empty result as evidence that the answer is unavailable. section 7.2.3

From failed retrieval to refinement

A query such as “Nebula Forge engine uses” can return no matches, causing an agent to answer “Unknown.” A refinement instruction makes the agent try a better keyword query before giving up. Clarifying the search tool as a keyword-search function reinforces this behavior. section 7.2.3

How AI Agents in Action, Second Edition covers it

How deep it goes
Explains three refinement tactics and prompt or tool-description fixes, but stops short of retrieval-system changes.
Examples
Uses an empty search for “Nebula Forge engine uses,” an “Unknown” answer, and a clarified keyword-search tool.
What it assumes
Assumes a retrieval tool and teaches how to respond when its results do not contain the answer.
What you can do after
Apply it via agent instructions or a tool description to retry searches with synonyms, broader terms, or subquestions.
How it connects
Connects retrieval, query decomposition, synonyms, keyword search, tool instructions, and evaluation.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Agents in Action, Second Edition. The section links point to the parts of the book it draws on.