ARCHITECTURE
Governed Knowledge, Not Auto-Magic Memory
What it takes to make an SRE agent trustworthy: lessons from building a Kafka knowledge layer
By Subhojit Banerjee (Staff Engineering Review) · Dec 2026 · 14 min read
The hard part of production AI agents is not the model. It is what the model may know, touch, and remember, and how you enforce those boundaries in code rather than prompts.
When LLM agents fail in production, teams usually reach for a larger model or rewrite the system prompt. In practice, almost every serious failure comes from system design: unverified retrieval, over-privileged service accounts, self-poisoning memory, unmeasured rollouts, and missing entity context.
This review lays out the architecture, code-enforced invariants, explicit refusals, and staged proof plan we used to build a governed knowledge layer for a Kafka SRE copilot.
1. Five Ways LLM Agents Fail in Production
None of these are model problems. Every one of them is fixed by system design: controlling what the agent may know, touch, and remember, and measuring whether it helps.
- Confidently wrong: on a retrieval miss, the model receives the nearest-looking document and answers fluently. "Lag after deploy" and "lag after rebalance" look alike to an embedding model and require opposite runbooks.
- Over-privileged: agents commonly run under a shared service account. One prompt injection hidden inside a log line gives the agent every capability that account holds.
- Self-poisoning memory: auto-memory writes unreviewed lessons back into what the agent reads next time. One wrong lesson, or a planted one, gets repeated with full confidence on every future incident.
- Unprovable value: demos are not measurements. Most agent evals feed a passive dashboard and block nothing, so regressions ship quietly.
- Context, not compute: Netflix reported that a typical regression took roughly four hours to root-cause, mostly spent rebuilding entity relationships their tools already knew.
Calibration Numbers Every Agent Builder Should Know
Published operational findings point in the same direction across companies:
- Less than 1 point accuracy gained from adding raw retrieval to an analytics agent (Anthropic, self-service analytics).
- +6% accuracy at the cost of +32% tokens and +72% latency for an adversarial-review step (Anthropic, self-service analytics).
- 98% to 100% leak and prompt-injection success rate without provenance gating (OGX provenance evaluation).
- Roughly 4 hours to root-cause a typical regression, mostly context assembly, with ~49,000 applications validated against one authoritative catalog before entering the graph and correlation chains discarded below a 0.6 confidence threshold (Netflix TechBlog, Oct 2026).
2. Four Invariants Enforced in Code, Not in a Prompt
A principle that lives only in a prompt is a suggestion. Every core constraint must live where prompt injection cannot reach.
- Read-only by construction: no write tools exist on the tool surface, and the underlying AWS IAM role has zero write actions.
- Cited or an honest gap: every claim cites a reviewed runbook span or a typed check. On a miss, the agent says there is no runbook for this, enforced by a no-fabrication property test in CI.
- Fail-closed per human: authorization uses the on-call engineer’s own rights verified offline. Deny overrides allow, and anything unknown defaults to deny.
- Facts only via reviewed PR: the corpus lives in git. A curator process can draft a pull request from observed misses, but only a human can merge it.
Code Produces Facts. The Model Produces Judgment.
We drew an explicit boundary between deterministic code and the language model per module. Code handles routing a question to exactly one runbook, executing every measurement as typed checks, enforcing identity, permissions, and audit logs, and running schemas, guards, and eval gates.
The model translates loosely worded questions into structured terms, chooses what to inspect next, weighs conflicting findings, explains conclusions, and drafts proposed corpus updates for human review.
Our promotion rule keeps that line moving intentionally: a reasoning path that reaches the same conclusion repeatedly in replay gets promoted into a deterministic check, while a check that produces false confidence gets demoted. We track the share of runbook steps backed by a check. It should rise over time, and it should never reach 100%.
Split Write Paths and Zero Agent Permissions
Facts and lessons never share a write path. Facts (runbooks, routing rules, known pitfalls) move strictly from a human-reviewed PR into the git corpus and into cited answers. Lessons (misses, dead ends, rejected hypotheses) accumulate automatically in an advisory log that can never be cited as fact. The only exit from advisory lessons to truth is a curator drafting a delta PR for human review.
Similarly, the agent never has permissions of its own. The on-call engineer authenticates through SSO and MFA. The orchestrator mints a short-lived delegation token carrying the engineer as subject, the agent as actor, and a single tool server as audience, bound to the agent’s key with DPoP. The server verifies the token offline (signature, issuer, audience, expiry, proof of possession), evaluates a deny-wins policy covering both tools and runbooks, writes every allow and deny decision to a write-once S3 Object Lock audit log before returning data, and queries AWS with its own read-only role without forwarding the user token. Both locks must agree.
3. Architecture: Request Path and Human-Gated Learning Loop
The system spans three operational zones (orchestration and human approval, the Kafka MCP knowledge layer, and AWS/GitHub infrastructure) inside one unified trust domain with zero changes to the platform core. A single diagnosis follows eight steps:
- Ask: the on-call engineer asks the orchestrator why a topic is backing up.
- Mint: the orchestrator issues a short-lived DPoP-bound delegation token tied to the engineer and the agent key.
- Call: the model turns the free-text question into structured symptom terms and calls the runbook lookup tool.
- Verify and log: deterministic code verifies the token offline, checks policy, and writes a WORM audit record before touching any data.
- Route: structured terms map deterministically through a decision tree to one complete runbook, or return an honest gap and log the miss.
- Measure: runbook steps invoke typed checks that query MSK and CloudWatch via a read-only IAM role.
- Explain: the model reasons over typed findings and cited runbook spans with full provenance labels.
- Approve: any proposed action waits at a human-in-the-loop gate where a named engineer decides.
How the Layer Improves Without Trusting the Agent
Improvement runs on a separate loop: a gap, dead end, or engineer rejection is captured as a miss; the curator drafts an incremental delta with supporting evidence and rejection memory; a bot opens a draft PR that cannot merge itself; CI runs the evaluation gate with the miss turned into a permanent fixture; a human reviews and merges; and the corpus reloads on the next deploy.
The evaluation gate uses three tiers: Tier 1 Wiring (right tools, arguments, order) blocks merge; Tier 2 Behaviour (right answer by the right path, with forbidden conclusions and must-rule-out lists per fixture) blocks merge; Tier 3 Judges (rubric-scored explanation quality) stays advisory only. Safety is never averaged into accuracy, every run is stamped with git SHA, skill hash, model ID, and token count, and certification auto-revokes the moment a suite fails.
4. What We Refused, and What Would Change Our Mind
Adopt patterns and interfaces. Defer heavy engines behind clean seams with written revisit triggers, and reject what breaks your trust boundary:
- Vector RAG as the core: similarity is not relevance and fabrication is untestable across dozens of runbooks. Revisit only if decision-tree precision degrades in evals.
- Auto-written agent memory: merges improvement and truth onto one write path. Never for facts.
- A database for knowledge: a write API bypasses review while git already versions everything. Revisit only if the corpus outgrows git.
- A separate knowledge MCP server: splits one trust domain and one audit trail. Never.
- Replacing the platform runtime with raw graph frameworks: frameworks lack per-dispatch human identity, approval gates, and gitops governance.
- RDF ontology or graph database: our questions are two hops over thousands of entities. Revisit only when multi-hop traversal becomes a measured bottleneck.
- Automated remediation: trust has not been earned yet. Revisit only after shadow and advisory phases, behind explicit approval gates and simulation.
Beyond Kafka: Govern the Contract, Federate the Stores
Rather than migrating every enterprise system into one monolithic context store, we wrap existing systems of record (Snowflake semantic views with SELECT-only access, DataHub ownership and lineage URNs) alongside curated domain packs under one contract: human identity and policy on every call, provenance on every answer, append-only audit for every allow and deny, query-not-data for sensitive scopes, and self-revoking certification against a shared acceptance suite.
5. Staged Proof and Open Problems
Trust is earned in four stages, each with an exit criterion: (1) retrospective replay of solved incidents with the knowledge layer toggled on vs off; (2) a six-week shadow run beside on-call engineers comparing conclusions; (3) advisory mode showing cited evidence while humans decide; and (4) gated acting later behind simulation and approvals. Across stages we report four rates: correct root cause, fabricated or uncited claims, red-herring conclusions, and tokens and latency per diagnosis.
Five open problems remain at the top of our backlog: an entity identity map linking consumer groups, applications, teams, and recent deploys validated against DataHub; a deterministic deploy-before-lag composite check; a taint runtime ensuring untrusted spans never trigger tools even after context compaction; judge stability (keeping rubric judges strictly advisory); and pulling incident-chat correction harvesting forward.
The guiding principle stays simple: make the model’s freedom narrow, auditable, and worth paying for. The token proves who asked. The policy decides what they may touch. The read-only role makes even a mistake harmless. Everything else earns its place by ablation.
Key Takeaways
- The hard part of agents is not the model; it is what the model may know, touch, and remember.
- Code produces facts and enforces permissions; the model produces judgment.
- Facts change only through human-reviewed pull requests; advisory lessons never become facts on their own.
- The agent never holds permissions of its own; human identity travels with every call down to the data.
- If a capability is not measured on vs off against real incidents, it is an opinion, and evals must gate releases.
References cited: Netflix TechBlog, "Ontology-Driven Observability" (Oct 2026); Anthropic self-service analytics benchmarks; OGX provenance evaluation; ACE (Agentic Context Engineering).