Project | AI & LLM

Testing RAG and AI Agents

61 eval cases in four versioned suites (RAG, robustness, security, agent) for a support assistant and an agent that can move money. There is no language model on purpose: BM25 retrieval and rules, so every number repeats exactly. A planner that misbehaves on purpose tests the guardrails: forbidden tools, bad arguments, endless loops.

On 28 Nov 2026 the quality gate passed: 135 tests passed and the 7 known misses failed as expected, 99 % coverage; RAG 1.000 on every measure, reworded questions 0.533 correct (limit 0.5), security and agent 1.000.

Evidence checked 28 Nov 2026 | Scheduled CI run on main

GitHub Actions workflow badge
On this page
  1. Problem and purpose
  2. Architecture
  3. Technology and tools
  4. Engineering decisions and approach
  5. Test scope and execution approach
  6. Results with dated evidence
  7. Evidence explorer
  8. Local setup and execution
  9. Workflow and reports
  10. Known limitations

Problem and purpose

There is no language model here, on purpose. Answers come from BM25 retrieval and sentence extraction and the agent's plans from rules, so every number is measured from code that really ran and repeats exactly. The graders and guardrails do not depend on how an answer was made, so a model could be swapped in behind the same interfaces.

The honest number is the robustness suite: keyword search cannot connect "fast option" with "express delivery", so 7 of 15 reworded questions fail, 5 by saying nothing and 2 by confidently citing the wrong section.

Architecture

question -> decline rule -> retrieve (access rule first) -> enough evidence? -> sentence + citation
task     -> planner -> guardrails -> tool -> back to the planner, up to 6 steps

Technology and tools

AreaTools
System under testPython 3.13, no runtime dependencies: BM25 retrieval, extractive answers with citations, a rule planner and a tool agent
Evals61 cases in four versioned suites: RAG 25, robustness 15, security 11, agent 10
Testspytest: 142 tests, 99 % coverage, 7 known misses as strict expected failures
GateLimits per suite and metric in configs/quality_gate.toml; a shrunken case file or a renamed metric fails too
CIGitHub Actions on every push and weekly; redacted traces kept as an artifact

Engineering decisions and approach

  • No model, so every number repeats exactly and the graders are tested on their own
  • Limits just below today's values: the gate stops things getting worse; it does not say this is good enough to ship
  • Known misses are strict expected failures, so a miss that starts passing fails the run until it is reviewed
  • A planner that misbehaves on purpose: forbidden tools, bad arguments, endless loops
  • One redacted trace line per case, kept with every CI run

Test scope and execution approach

Project-specific checks and execution details documented in the repository:

  • Retrieval measures: Recall at 3, mean reciprocal rank, correct answers, saying "not found" when it should, grounding in the citation
  • Access rules: a staff-only section, a section replaced by a newer notice, and a forum post containing a prompt injection
  • Security cases: injection, data leaks and redaction
  • Agent tasks checked by tools used, final status and final state
  • Every grader shown failing on a planted bad answer

Results with dated evidence

Historical repository or workflow evidence

Scheduled CI run on main

On 28 Nov 2026 the quality gate passed: 135 tests passed and the 7 known misses failed as expected, 99 % coverage; RAG 1.000 on every measure, reworded questions 0.533 correct (limit 0.5), security and agent 1.000.

Evidence checked: | Open dated evidence

Evidence explorer

Static screenshots are labelled as images; dated workflow links identify the execution evidence and its check date.

Test report screenshot. The quality gate table of the scheduled CI run on 28 Nov 2026. Static image; capture date is not recorded in the portfolio data.
Quality gate table: every suite within its limits

Test report screenshot. The quality gate table of the scheduled CI run on 28 Nov 2026. Static image; capture date is not recorded in the portfolio data.

28 Nov 2026: 135 tests passed and the 7 known misses failed as expected, 99 % coverage. RAG 1.000 on every measure; reworded questions 0.533 correct (limit 0.5) and 0.867 without a wrong answer (limit 0.85); security and agent 1.000.

Static material from the public repository. The linked verification record was checked 2026-11-28; that date is not a screenshot capture date.

Dated workflow record

Evidence checked 2026-11-28. Open Scheduled CI run on main

Local setup and execution

pip install -e ".[dev]"
pytest                              # all tests
python -m evals.run_evals           # the four suites and the gate

Workflow and reports

View workflow definition.

Known limitations

  • The RAG cases were written from the same documents the retriever was tuned on: 100 % says it works on what it was built for, not that it generalises
  • Keyword retrieval cannot match synonyms; the robustness suite shows it
  • A fictional company and knowledge base, small by design
  • There is no language model, and the RAG cases were written from the documents the retriever was tuned on, so 100 % says it works on what it was built for, not that it generalises.

Back to Projects