Skip to content

Agentic Inventory Q&A for Maat — Take Away

This lab produced one recurring lesson, hit in five unrelated places and confirmed again when the MCP server was upgraded: a missing capability makes the model improvise, and improvisation is what produces a confidently wrong answer or a runaway loop. The durable fix was always a tool, never a bigger prompt.

  • Guards and tools beat prompts. Every "model weakness" chased in this project turned out to be a missing capability, not a weak model — aggregation, duplicate detection, relationship grouping, proving absence, and impact analysis were all originally left to the model, and all five became reliable only once they moved into deterministic code. When the re-evaluation tried to fix an over-asking weak model with a hint in a tool's result, it had no net effect in two wordings and was rejected.
  • A model that is perfect on single questions can still be a bad chat model. Five models that tied with full marks on the (then 85-question) stateless capability suite ranged from 0% to 17.1% fabrication once the same questions were asked in a realistic conversation. After the forced re-lookup was added the range narrowed to 0–6.9%; on MCP 1.0.5 it is 0–0.9% for twelve of thirteen models and 6.5% for Mistral. The two rankings still differ: Qwen3.8-27B answers all 108 hard questions but scores 98.5% in conversation, while gemma-4-26B-A4B-it misses five hard questions and scores 100%. Stress-test accuracy does not predict conversational honesty, so model choice for a chat deployment has to be made on the conversation benchmark, not the capability score.
  • Failure must be distinguishable from emptiness — and a silent zero is the worst failure. A failed backend call used to fall through as an empty list, which — combined with "an empty result IS the answer" — let a real outage be reported to a user as a confident "there are none." Failures now raise a distinct error so the agent can say "I couldn't check" instead of inventing a zero. The same rule explains why the agent still guards MCP 1.0.5: six plausible filter shapes there still return a zero instead of an error.
  • Model size predicts almost nothing. A 27-billion-parameter model (Qwen3.8-27B) answered every hard question, and a 26B model with about 4B active parameters scored 103/108, while a 24B model of similar size scored 83/108 and a 235B model 93/108. What separates them is whether the model follows a routing table and calls a tool correctly — exactly the work this project moved out of the prompt and into Python. Screen a candidate rather than choosing by size.
  • The agent helps weak models most. With plain MCP, Mistral-Small-3.2:24b answered 34 of 108 hard questions with the server's guide prompt and 21 without it; with the agent, 83.
  • Anything shown to the model is input, including your own warnings about it. Provenance labels were originally visible as text in the conversation so the agent could "see" them — and the model learned to reproduce the label format itself, including claiming verification in prose. Moving the label to hidden metadata the model does not author closed that loop.

Engineering findings

Symptom Root cause Fix Effect
"Most-used resource" answered by sampling one or two instances no aggregation tool; probing entities one by one blew the context window added a ranking tool ~189k tokens / 15 calls → ~19k tokens / 2 calls
"How many spans over 50 km" undercounted by roughly 5× the filter tool capped the search space, not just the result rows scan the whole category when filtering silent undercount → exact
Threshold filters returned 0 items silently filters were equality-only added >, >=, <, <=, !=, wildcards "there are none" → correct counts
Absence questions never terminated the agent had no way to conclude "zero" added an explicit "conclusive" signal + prompt rule multi-million-token timeout → tens of thousands of tokens, a few calls
"Duplicate router IDs" caused a loop no tally/duplicate-detection tool added a group-by-characteristic tool 17M+ token timeout → ~22k tokens / 2 calls
"Routers per vendor" / "average services per customer" looped aggregation only existed over characteristics, not relationships added relationship-level aggregation timeout → ~26k tokens / 2 calls
Inventory summary reported the wrong total, then the wrong categories the MCP silently caps at 10,000 objects per domain (1.0.2); since 1.0.5 the total is exact but the per-category breakdown is still counted over the first 10,000 rows detect the cap and recompute both totals and breakdown wrong total → exact, with truncation flagged; 17 of 21 service categories → all 21
Maat was OOM-killed mid-benchmark new whole-inventory tools re-paged the full inventory repeatedly longer cache lifetime, bounded concurrency, raised memory limit stack survives a full run
Cross-layer answers named the wrong network layer no guidance on which level to report added a precision rule + exact-name grading consistently correct level
The seeded inventory had thousands of orphaned objects and no spare capacity objects were created standalone, with no deliberate slack create parents before children; leave a portion of interfaces genuinely idle orphans dropped by over 90%; spare capacity became answerable
One model stopped calling tools entirely partway through the project the agent's own prompt and tool descriptions had grown past that model's practical capacity trimmed the system prompt and tool descriptions substantially fixed overhead per call cut by roughly a third; the model works again with no loss of accuracy
A rule added to stop one model dropping list items broke a different, previously-passing question the fix made the agent re-verify its own count, which backfired removed the rule a failing question returned to passing
A new, individually-correct tool made an unrelated question start timing out the new tool put too much simultaneous load on the inventory backend bounded its concurrency the affected question got both safer and faster
Weaker models reported real objects as "not found" they passed an object's name where an id was expected every tool that takes an id also accepts a name, with a clear "not found" message one weak model: hard questions 84 → 94, coverage 101 → 178 of 188
A weak model answered "none" for something that existed traverse took a relationship path the model had guessed, and an empty result read as "none" removed traverse from the model's tools (find_connected searches the path itself) weak models: 5 answers lost, 21 gained; others: 0 lost, 5 gained
Ambiguous-name results were bulky resolve_entity returned full objects for every candidate return {id, name, category}, cap wildcards over 25 matches results about 60% smaller; one weak model's hard-question tokens down 14%
A randomized-suite question was silently skipped in every run until it was noticed the template set could drop a question without anyone noticing each suite checks its exact question count before asking anything no question can silently vanish
A weak model reported the wrong cable's length the tool framework silently dropped an argument a tool does not have, so find_entities(name='cable-044') listed the first cable every tool now refuses an unknown argument and names its real ones that model's conversation score recovered from 75% to 90.5%; found only by the conversation suite
Two chat-facing servers answered anyone on the network, with no authentication, spending the LLM token they bound to all interfaces by default bind to 127.0.0.1; the container opts in explicitly and publishes on loopback only found by re-checking every user-facing surface after the server upgrade

Model selection lessons

  • Stateless accuracy and conversational honesty are different axes, and a deployment decision needs both. The fabrication rate is tracked as a first-class selection criterion, not an afterthought to the capability score.
  • GLM-5.1 stays the default on every measure available: it answered all 108 hard, 126 randomized and 201 coverage questions, and all but one conversation turn (an arithmetic slip). Qwen3.8-27B, DeepSeek-V4-Flash and GLM-5.3-Flash are equivalent fallbacks, within two questions per suite. A 27B model that reaches the frontier also means self-hosting is realistically on the table.
  • A model can fail the server without failing the agent. MiMo-V2.5 sends its filters as a JSON string, which MCP 1.0.5 rejects on every call (8 of 108 hard questions); through the agent it scored 107/108. A tool layer that normalises its inputs is a compatibility layer too.
  • Cheap screening catches disasters, not quality. A short capability probe reliably excludes models that cannot function at all, but only a full benchmark run separates "adequate" from "good," and only the conversation suite separates "good" from "trustworthy in a chat setting."
  • A benchmark is a snapshot of one build. Agent runs on 13 models span several builds over two weeks; the changes in between moved scores by a few questions per suite. Every run is now archived with the code, question and data fingerprints it was measured on, so two runs can be compared — or shown to be incomparable.

Known limitations

  • Per-user permissions are opt-in. By default the agent reads Maat as one identity with one shared cache. Per-user mode (MAAT_PER_USER=1) checks every question's token online and reads Maat as that user; it is tested end to end through LibreChat (as an MCP tool and as the model) and in Chainlit. It needs a Keycloak token lifetime longer than the default 5 minutes and the access-filter mapper on every client that signs users in (a token without it sees everything), it loads Maat once per user, and it cannot stop the chat application from sharing a conversation: a shared chat shows its answers to whoever opens it, so sharing should be turned off where users see different inventories.
  • Invented values are reduced, not eliminated. Retrying an answer that shows no supporting lookup cuts fabrication sharply, but at least one model still produced invented answers that survived a retry. This is treated as a mitigation, not a cure.
  • A breakdown can be wrong when the total is right. The tools return exact numbers, but the model writes the answer: in one check a strong model gave the right total of 32 services for a router and put 10 of them under the wrong service type. For a number that matters, ask for that number directly.
  • Smaller models over-ask on shared names. Asked about "et-0/0/1 on r-232", a small model still lists every router that has an et-0/0/1 and asks which one, although the question already says. Stronger models pick the right one.
  • Behind another chat model, the safeguards end at the answer. Served as an MCP tool, the agent's provenance label is only as good as the host model's willingness to relay it.
  • The freshness label is per conversation, not per value. It reports when the most recent lookup happened, not when the specific number currently being quoted was last checked — and a chat client that stores text only loses even that.
  • The staleness path has not been exercised end to end, because every benchmark run so far has used a static inventory — closing this gap needs a write-capable test run against a quiet instance.
  • One dataset, one server version. Everything current was measured on a single synthetic inventory (24,455 objects) and MCP 1.0.5.
  • Every test question is ours. Neither the single-question suites nor the conversation scripts were collected from real operators, and the stress set was written to probe failures already seen, so it leans towards the hard cases. That remains the largest gap between this evaluation and how the agent will actually be used.

Process lessons worth carrying forward

  • Work does not travel between code paths by itself. More than once a fix landed on one surface (say, the CLI) and quietly did not apply to another (say, the LangGraph Studio integration), because each was written against a slightly different entry point. There are six ways in now. When a guard or a limit changes, treat the unit of work as every path that can reach the agent, not the feature in isolation — re-checking all of them after the server upgrade is what found the two unauthenticated servers listening on the network.
  • Check the access model on a real testbed before building on it. Two of Maat's behaviours were found only by trying: a token with no filter claim sees everything, and a user's filter overrides a query's condition on the same attribute instead of narrowing it. Neither is in the documentation; the first would have turned a per-user agent into a leak, and the second gives a filtered user wrong answers unless every result is re-checked.
  • An oracle that is merely present is not enough. It has to be derived independently, at run time, and it has to be unquotable from the question — a checker that can be satisfied by echoing the prompt back measures nothing.
  • Roughly half of the apparent failures in the first real benchmark run were defects in the test harness, not the agent. Every failing question is read individually before being counted; more than one "model weakness" turned out to be a grading defect that had been marking a correct answer wrong.
  • Remove a tool on evidence, not on instinct — and the same goes for keeping one. Taking each tool away in turn and re-running only the questions that used it showed which tools earned their place. traverse did not; common_between, describe_category, find_connected and resolve_entity did, on the weak models.
  • A false alarm on an honest answer costs more than the miss it prevents. The "this may be fabricated" warning had to be tuned more than once after it fired on true statements — a warning users stop trusting is worse than no warning, because it is the last signal standing between a user and an invented inventory value.
  • A signal that fails silently while the surrounding output still looks right is the most dangerous kind of bug. A provenance label was once dropped by a stray code path for several consecutive correct answers, and nothing about the visible output indicated anything was wrong — the numbers were all still right. Integrity signals need their own tests, independent of whether the answer itself is correct.
  • Don't depend on someone else's fix. Feedback on the MCP server was sent to its maintainers, and the whole re-evaluation was done treating version 1.0.5 exactly as shipped. Every decision had to hold without an upstream change.