← All case files

04 · Public · Research build · 2026

A retrieval agent that's allowed to say no

A seven-node LangGraph agent over arXiv cs.AI papers. Before every answer it decides whether to retrieve, call a tool, ask a clarifying question, refuse, or just talk.

PythonLangGraphFastAPIChromaBM25Groq

System flow

  1. Decidepick a path first
  2. Memory contextthree kinds, kept apart
  3. Retrieve or toolhybrid search, safe calculator
  4. Clarify or refusereal outcomes
  5. Grounded answeror plain chat

The problem

  • One-shot retrieval answers everything, including questions the corpus cannot support.

Constraints

  • Must run on a laptop and be reproducible.
  • Every architectural claim has to survive an ablation.

Decisions.

  1. Decide before you retrieve.

    A routing node chooses among retrieve, tool, clarify, refuse, answer and chat. Greetings and meta questions never touch the corpus.

  2. Clarify and refuse are outcomes, not errors.

    The evaluation covers retrieval, memory, refusal, clarification, tool routing and small talk, so the “no” paths are tested like any other.

  3. Three memories, kept distinct.

    Recent turns verbatim, an LLM-compressed digest of older turns, and structured facts about the user. The system can say which one it used.

  4. Heavier was not better.

    In the ablation, the lightweight hybrid (vector search with BM25 reranking) beat the cross-encoder, which added compute without improving retrieval.

  5. A calculator that can't run your code.

    The tool is an AST-based evaluator, not eval().

What it gave me

  • An 18-case evaluation with the ablation published alongside it, including the parts that did not help.

In hindsight

  • Eighteen cases is enough to catch regressions, not to claim generality. The README says so.
Next case file · 05

Prompt logs as a data-warehouse problem