<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Naveen Kumar Baskaran on Medium]]></title>
        <description><![CDATA[Stories by Naveen Kumar Baskaran on Medium]]></description>
        <link>https://medium.com/@naveenkumarbaskaran?source=rss-373be46e0d7f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*k6De3RiyIphr5xIAaUUINg.jpeg</url>
            <title>Stories by Naveen Kumar Baskaran on Medium</title>
            <link>https://medium.com/@naveenkumarbaskaran?source=rss-373be46e0d7f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 19:53:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@naveenkumarbaskaran/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Enterprises Don't Have an AI Problem. They Have a Trust Problem.]]></title>
            <link>https://medium.com/@naveenkumarbaskaran/enterprises-dont-have-an-ai-problem-they-have-a-trust-problem-0d4d72ea2251?source=rss-373be46e0d7f------2</link>
            <guid isPermaLink="false">https://medium.com/p/0d4d72ea2251</guid>
            <category><![CDATA[digital-transformation]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[enterprise-technology]]></category>
            <category><![CDATA[leadership]]></category>
            <dc:creator><![CDATA[Naveen Kumar Baskaran]]></dc:creator>
            <pubDate>Sun, 22 Nov 2026 15:54:19 GMT</pubDate>
            <atom:updated>2026-11-22T15:54:19.569Z</atom:updated>
            <content:encoded><![CDATA[<p>The bottleneck isn’t capability. It’s that no enterprise will let an agent take an action it can’t explain, reverse, or audit.</p><p>A procurement manager came to our team with a request: she wanted an AI agent to help approve purchase requisitions. The use case was real — she spent 3 hours a day reviewing routine approvals that matched clear rules. An agent could handle 80% of them.</p><p>We built it. It worked well in testing. We presented it to the IT governance board.</p><p>First question from the board: “If the agent approves something it shouldn’t, who’s liable?” We said the system had confidence thresholds and would escalate. Second question: “Where’s the audit trail — machine-readable, retained for 7 years per our compliance policy?” We pointed to the application logs. Third question: “What’s the reversal path if the agent approves a requisition that’s already been superseded by a contract change?”</p><p>We didn’t have answers. The project stalled for four months while we built the trust infrastructure.</p><p>The agent was ready on day one. The enterprise wasn’t.</p><p>My first instinct was that the board was being bureaucratic. The agent was accurate, the confidence thresholds were tuned, the testing was solid. I thought: if I show them better accuracy numbers, they’ll approve it.</p><p>I was wrong. The accuracy wasn’t the issue. The issue was accountability. No matter how accurate the agent was, the enterprise needed to answer: if something goes wrong, what’s the paper trail, and who takes responsibility?</p><p>Here’s the question every enterprise architecture review eventually arrives at: If the agent is wrong, what happens?</p><p>For consumer AI, the answer is: the user notices, corrects it, moves on. The cost is friction. Sometimes embarrassment.</p><p>For enterprise AI, the answer depends on what the agent did. If it answered a question wrong, the cost is a bad decision by the person who trusted it. If it took an action — created a record, triggered a workflow, committed a transaction — the cost is a data quality incident, a compliance finding, or an operational failure. And the question changes from “what happens?” to “who is responsible?”</p><p>That question doesn’t have a clean answer yet. Until it does, enterprises will not give agents real autonomy. This is not a technology problem. It’s a trust problem.</p><h3>What trust actually requires in an enterprise context</h3><p>Trust in enterprise systems is not vague. It’s specific, auditable, and legally meaningful.</p><p>Before any enterprise will let an agent take consequential action, four properties need to be present:</p><p>Explainability — Not “the model gave this answer.” The agent needs to produce a traceable chain: this was the question, these were the sources retrieved, these were the tools called, this was the reasoning, this was the conclusion. Enterprises have auditors. Auditors need to reconstruct decisions. “It was an AI” ends careers.</p><p>Reversibility — Not all enterprise actions are reversible. The ones that are need to be reversible in a way that leaves the system in a clean state. Agents need to know, before they act, whether the action is reversible and what the reversal path is. This information needs to be part of the tool contract, not discovered after the incident.</p><p>Audit log — Machine-readable. Tamper-evident. Retained for however long the regulation requires. Not “we can reconstruct it from the logs if we need to.” A first-class audit record generated at action time, in the same system the enterprise uses for everything else.</p><p>Human escalation — Not as a fallback. As a designed-in checkpoint. When agent confidence is below threshold, when the action exceeds a scope boundary, when the domain is flagged as high-risk — the agent stops, surfaces its reasoning, and waits for a human to approve. This is not a limitation. It’s the feature that makes the system trustworthy enough to deploy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iwikh-IYnKmJNcmCcgHKrQ.png" /></figure><h3>Why current agent frameworks skip all four</h3><p>Agent frameworks are built by people optimizing for demos. Demos reward autonomy, speed, and impressive-looking tool chains. They do not reward explanations, audit logs, reversibility checks, or escalation flows. Those things add latency, complexity, and friction to something that needs to look effortless.</p><p>So frameworks don’t model them. And teams building on top of those frameworks inherit a system shaped by demo incentives, then wonder why the enterprise architecture review keeps stalling.</p><h3>The first generation of trustworthy enterprise agents</h3><p>It won’t look like what the demos show.</p><p>Scope: One domain. One workflow. Clearly bounded. Read operations are automatic, no approval needed. Write operations require confidence ≥ 0.85 plus human approval gate. Audit logs are structured records written at execution time. Reversibility is labeled in the tool contract and confirmed before action. Irreversible actions require explicit double-confirmation. Escalation goes to a named human on-call. The agent knows to stop and ask. Ownership means a named human responsible in production.</p><p>None of this is technically hard. All of it requires deliberate design choices that most teams skip because the demo doesn’t require them.</p><h3>The timeline is organizational, not technical</h3><p>The LLMs are capable enough for enterprise action today. The models aren’t the bottleneck.</p><p>The bottleneck is: Enterprise IAM teams that haven’t defined what agent identity means. Legal teams that haven’t mapped AI actions to existing liability frameworks. Compliance teams that haven’t written policies for model-generated audit records. Operations teams that haven’t decided what escalation workflows look like when the agent is the first responder.</p><p>These are not fast problems to solve. They require coordination across organizations that rarely move together.</p><p>That’s why the timeline is 3 years. Not because the technology needs 3 years. Because the organization does.</p><p>This is part 4 of the Enterprise AI in Production series.<br>← Previous: The Real Reason Your Enterprise Agent Can’t Take Action | Next: Why Enterprise AI Agents Are Still 3 Years Away →</p><p>If this matched something you’ve run into — follow for the next post in the series. I publish once or twice a week on building production AI for enterprise systems.</p><p>Building something similar? I’d love to hear about it in the comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0d4d72ea2251" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Real Reason Your Enterprise Agent Can't Take Action]]></title>
            <link>https://medium.com/@naveenkumarbaskaran/the-real-reason-your-enterprise-agent-cant-take-action-c3ec86017d51?source=rss-373be46e0d7f------2</link>
            <guid isPermaLink="false">https://medium.com/p/c3ec86017d51</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[enterprise-software]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Naveen Kumar Baskaran]]></dc:creator>
            <pubDate>Sun, 22 Nov 2026 15:50:40 GMT</pubDate>
            <atom:updated>2026-11-22T15:50:40.041Z</atom:updated>
            <content:encoded><![CDATA[<p>It’s not the LLM. It’s that enterprise systems were designed to prevent exactly what agents try to do.</p><p>We had an agent that could answer any question about a maintenance order in under 4 seconds. Users loved it. So the natural next ask came: “Can it just create the order too?” We said yes. We wired up the OData endpoint, tested it in the dev sandbox, it worked perfectly. We deployed to staging.</p><p>First test in staging: the agent opened a changeset, built the order header, then hit a 30-second timeout on the materials API. The changeset was left open. The order existed in a half-created state. The only way to fix it was a manual transaction by a basis admin. It took 45 minutes.</p><p>That was the day I understood what “enterprise APIs aren’t agent-native” actually means in practice.</p><p>My initial hypothesis: this was a retry problem. Add idempotency keys, handle the timeout, retry the materials call. I built that. It helped. But then we hit the next wall: the agent didn’t know what to do when the second call succeeded but the third failed. Partial state again.</p><p>I went deeper — read the OData spec properly for the first time, traced every stateful operation in our integration, mapped what “rollback” actually means in SAP’s accounting layer. What I found wasn’t a missing feature. It was a structural mismatch between how agents work and how enterprise APIs were designed.</p><p>Three layers, all of which need to be solved before a single write operation is safe.</p><p>Your LLM is fine. Your prompt is fine. Your RAG pipeline — if you followed the patterns from the last few posts — is probably fine. The agent still can’t do anything useful in production. Here’s why.</p><h3>Enterprise APIs are not agent-native</h3><p>Consumer APIs are designed for agents. They’re stateless, RESTful, and return clean JSON. You call them, you get a result, you move on.</p><p>Enterprise APIs were designed for humans. Or, more precisely, for systems that behave like humans: stateful, session-aware, and operating inside a transaction context that the caller is expected to manage.</p><p>SAP’s OData APIs — the ones agents need to call to do anything meaningful in an ERP — have three properties that break naive agent integration:</p><p>They are transactional. You don’t create a maintenance order with one call. You open a changeset, build the order header, attach operations, assign materials, close the changeset, and commit. Stateless tool calls don’t compose naturally over this.</p><p>They are role-scoped. The same endpoint returns different data, allows different actions, and enforces different validations depending on the role of the calling identity. An agent calling with a display-only service account sees a completely different system than the operations engineer it’s trying to assist.</p><p>They are batch-optimized. Enterprise APIs were built to process thousands of records efficiently, not to serve low-latency single-record operations to an interactive agent. Response times of 3–8 seconds per call are normal. A 5-step agentic loop calling 3 tools per step is 45+ seconds of wall time, minimum.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c2Wg0-IK-IQGKoiqQIQr2Q.png" /></figure><h3>The three-layer problem</h3><p>Every enterprise agent integration has to solve three things simultaneously. Most solve one and discover the other two in production.</p><p>Layer 1: Auth — Who is the agent? With whose permissions? How does IAM audit it?</p><p>OAuth2 works fine for user-delegated flows. Agents aren’t users. Service accounts work fine for batch processes. Agents aren’t batch processes — they’re interactive, context-dependent, and need to operate on behalf of a specific user with that user’s permissions. What you actually need: impersonation scopes, short-lived delegation tokens, and an identity layer that the enterprise’s existing IAM infrastructure can audit. Most enterprise IAM systems weren’t designed for this. Building it is months of work that has nothing to do with AI.</p><p>Layer 2: Transaction integrity — What if the agent fails mid-operation? Who owns the half-created record?</p><p>If an agent fails mid-operation — the LLM context limit hit, a tool call timed out, the user closed the browser — what state is the system in? Consumer systems tolerate partial state. Enterprise systems cannot. A half-created purchase order is not better than no purchase order. It’s a data quality incident. Agents need transaction boundaries. They need to know when they’ve started something that must be completed or rolled back. Current agent frameworks don’t model this at all.</p><p>Layer 3: Rollback — Which actions are reversible? What does “undo” actually create?</p><p>Enterprise systems have correction mechanisms. They’re not clean. A goods receipt can be reversed. A settled accounting document cannot — it can only be offset with a counter-document, which itself generates audit entries. An agent that “reverses” an enterprise action by calling the reverse API has created two records, two audit entries, and a reconciliation problem. It has not undone the action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DGxwiaSY-EmvHcDZBDkXiA.png" /></figure><h3>What an agent-ready enterprise API actually looks like</h3><p>Three properties:</p><p>Idempotent at the agent boundary. The same intent, called twice with the same inputs, produces the same result. No side effects from retries. No duplicate records from timeout-and-retry patterns.</p><p>Describable to a model. The tool description — what it does, when to call it, what it refuses — should be writable in 100 words. If it takes a paragraph of caveats to describe when NOT to call it, the API isn’t agent-ready.</p><p>Audit-native. Every call records who called it, with what parameters, in what context. Not in application logs that expire in 30 days — in the same audit trail as human actions.</p><p>Most enterprise APIs have none of these properties. Building them retroactively is the actual work of enterprise AI integration.</p><h3>MCP is a partial answer</h3><p>MCP (Model Context Protocol) gives you composability. It doesn’t give you safety. MCP solves tool discoverability, composability across AI clients, and standard tool descriptions. It does not solve auth, transaction integrity, or rollback.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2ZCvLEAFYRXZ-saaM5v0Zw.png" /></figure><h3>The path forward</h3><p>The teams making real progress on enterprise agent actions right now are doing one thing differently: they’re not trying to make agents autonomous over existing enterprise APIs. They’re building new, thin, agent-native API surfaces — idempotent, audit-native, model-describable — on top of the enterprise system, and treating the existing OData/BAPI layer as an implementation detail.</p><p>It’s more work upfront. It’s the only approach that scales.</p><p>The alternative is an agent that works in the demo and creates incidents in production.</p><p>This is part 3 of the Enterprise AI in Production series.<br>← Previous: The 4-Node Pattern That Cuts Enterprise AI Costs by 80% | Next: Enterprises Don’t Have an AI Problem. They Have a Trust Problem. →</p><p>If this matched something you’ve run into — follow for the next post in the series. I publish once or twice a week on building production AI for enterprise systems.</p><p>Building something similar? I’d love to hear about it in the comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c3ec86017d51" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The 4-Node Pattern That Cuts Enterprise AI Costs by 80%]]></title>
            <link>https://medium.com/@naveenkumarbaskaran/the-4-node-pattern-that-cuts-enterprise-ai-costs-by-80-87205ef7eddd?source=rss-373be46e0d7f------2</link>
            <guid isPermaLink="false">https://medium.com/p/87205ef7eddd</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[enterprise-software]]></category>
            <category><![CDATA[cost-optimization]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Naveen Kumar Baskaran]]></dc:creator>
            <pubDate>Sun, 22 Nov 2026 15:33:09 GMT</pubDate>
            <atom:updated>2026-11-22T15:33:09.562Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IPFsnLWudO_knJtz" /><figcaption>Photo by <a href="https://unsplash.com/@cherstve_pechivo?utm_source=medium&amp;utm_medium=referral">Liana S</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Most teams build one monolithic agent. That’s why their bills are high and their answers are slow.</p><p>It was the end of month two. I pulled up our LLM billing dashboard expecting the usual — a few hundred dollars, steady growth. Instead: $4,200. The month before had been $900. We hadn’t changed the product. We hadn’t added users. Volume had grown 30%, but costs had grown 366%.</p><p>I spent the next two days profiling every request type. The culprit wasn’t what I expected. It wasn’t a rogue prompt, a loop bug, or an expensive model being misused. It was something simpler and more embarrassing: we were loading all 20 of our SAP tool schemas into every single request. Including the 17 that were irrelevant to the question being asked.</p><p>4,000 tokens × every request × growing volume. The math was brutal.</p><p>My first instinct was to switch models. If we used a cheaper model for simple queries, that would bring costs down. I tested it. It did help — but we were still loading all 20 tool schemas even for queries that only needed one tool. Switching models while keeping the monolithic architecture was like changing the engine in a car that was dragging an anchor.</p><p>So I started from scratch and asked: what does each part of the agent pipeline actually need to do its job? Classification doesn’t need a large model. Retrieval doesn’t need a model at all. Planning needs capability. Generation needs quality. And generation is the smallest part of the total token budget.</p><p>That question led to the 4-node pattern. Four stages, each running on the cheapest model capable of doing its job. The routing is what makes it work.</p><p>Six weeks after we deployed our first agent at scale, the token costs were 4× what we projected.</p><p>We hadn’t done anything obviously wrong. We’d built a reasonable system: a question comes in, the agent retrieves context, reasons over it, calls tools if needed, and generates a response.</p><p>The problem was that we were using the same model for everything. A capable, expensive model — doing routine classification work, simple lookups, and complex multi-step reasoning all at the same price point.</p><p>The fix wasn’t a better prompt. It was a different architecture.</p><h3>The 4-node pattern</h3><p>After a year of iteration, the system we run looks like this:</p><p>Node 1 — Classifier (Haiku: cheap, fast): Before anything else, classify the query. Is this a simple factual lookup? A comparison question? A multi-hop synthesis? A question that can’t be answered from the knowledge base at all? A small, fast model does this well. The classification prompt is about 200 tokens. The classification itself is a single token. Total cost: negligible. What you gain: 85% of your queries never reach the expensive path.</p><p>Node 2 — Retriever (no model): Hybrid retrieval — BM25 plus semantic search, merged via reciprocal rank fusion. Freshness filtering. Coverage check. The coverage judge is a ~50-token prompt with a 0–1 output. Run it. If coverage is below 0.7, rewrite and retry before moving to generation.</p><p>Node 3 — Planner (Sonnet, agentic path only): For the 15% of queries that need multi-hop reasoning, the planner determines the retrieval sequence: what to look for first, what that result implies about what to look for next, when to stop. This needs a capable model. It doesn’t need the most expensive one. The planner is making structural decisions, not generating prose.</p><p>Node 4 — Generator (Sonnet/Opus, dynamic): Generation happens once, at the end, after all retrieval is complete. Model selection is dynamic: verified high-coverage answers use a mid-tier model. Low-confidence synthesis escalates to the best available. The key insight: generation is the smallest part of the total token budget, and it’s where model quality matters most. Everything before it is scaffolding.</p><h3>The numbers</h3><p>Before (monolithic, single model): ~1,200 tokens × Opus price per query.</p><p>After (4-node pattern): ~380 tokens equivalent × blended price per query. Result: ~68% cost reduction across full query distribution. Simple path: under 2s end-to-end. Agentic path: 8–12s for a 3-step chain.</p><h3>The mistake most teams make</h3><p>They build the agentic path first because it’s impressive. Then they apply it to everything because it’s what they have.</p><p>A maintenance engineer asking “what’s the retry timeout for OC7?” doesn’t need a 5-step reasoning loop. They need a fast, accurate answer from the knowledge base. The agentic path wastes 10× the tokens and takes 6× as long.</p><p>Build the simple path first. Make it fast and accurate. Then add the agentic path for the cases that actually need it.</p><p>Route between them deliberately.</p><p>The 4-node pattern is the routing made explicit.</p><p>This is part 2 of the Enterprise AI in Production series.<br>← Previous: 5 Ways Enterprise AI Agents Fail Silently | Next: The Real Reason Your Enterprise Agent Can’t Take Action →</p><p>If this matched something you’ve run into — follow for the next post in the series. I publish once or twice a week on building production AI for enterprise systems.</p><p>Building something similar? I’d love to hear about it in the comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87205ef7eddd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PEOS: The 4-Node Pattern That Cut Our LLM Costs 80%]]></title>
            <link>https://medium.com/@naveenkumarbaskaran/peos-the-4-node-pattern-that-cut-our-llm-costs-80-2f7fdd2025d9?source=rss-373be46e0d7f------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f7fdd2025d9</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[peo]]></category>
            <dc:creator><![CDATA[Naveen Kumar Baskaran]]></dc:creator>
            <pubDate>Sun, 22 Nov 2026 15:24:34 GMT</pubDate>
            <atom:updated>2026-11-22T15:24:34.875Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/424/1*YlR8JzTkVZLLqx5c8YkhfA.png" /><figcaption>Fig. 1PEOS State Machine</figcaption></figure><p>We were spending <strong>$67/day </strong>on a single agent.</p><p>12,000 tokens per request. 8 LLM calls per conversation. Every tool result dumped into the next prompt. GPT-4’s context window was our credit card.</p><p>Three months later, that same agent handles the same workload for <strong>$12/day</strong>. Same accuracy. Better response formatting. Faster latency.</p><p>The fix wasn’t a cheaper model. It was a better <strong>architecture</strong>.</p><p><strong>What’s Wrong With ReAct</strong></p><p>ReAct (Reason + Act) is the default pattern in LangChain, CrewAI, and most agent frameworks:</p><pre>User → LLM thinks → calls tool → LLM sees result → thinks again → calls tool → <br>LLM sees all results → formats answer → User</pre><p><strong>Every loop iteration is a full LLM call with the ENTIRE conversation history</strong></p><p>By iteration 5, your prompt looks like:</p><pre>System prompt:        ~500 tokens<br>Conversation history: ~3,000 tokens<br>All tool results:     ~8,000 tokens  ← THIS IS THE KILLER<br>Tool definitions:     ~2,000 tokens<br>User message:         ~50 tokens<br>─────────────────────────────────<br>Total per call:       ~13,550 tokens × 8 calls = 108,400 tokens</pre><p>At GPT-4o pricing ($2.50/M input): <strong>$0.27 per conversation</strong>. With 250 daily users: <strong>$67/day</strong>.</p><p><strong>The PEOS Pattern</strong></p><p>PEOS splits the work into 4 specialized nodes:</p><pre>┌──────────────────────────────────────────────────────────────┐<br>│                                                                │<br>│    ┌──────────┐    ┌──────────┐    ┌──────────┐     ┌──────┐   │<br>│    │ PLANNER  │───▶│ EXECUTOR │───▶│ OBSERVER  │───▶│SYNTH │   │<br>│    │ 1 LLM    │    │ 0 LLM    │    │ 0-1 LLM   │    │1 LLM │   │<br>│    └──────────┘    └──────────┘    └─────┬─────┘    └──────┘   │<br>│                         ▲                │                     │<br>│                         └── RETRY ───────┘                     │<br>│                                                                │<br>│    Total: 2-3 LLM calls (vs 8+ in ReAct)                       │<br>│                                                                │<br>└──────────────────────────────────────────────────────────────┘</pre><p><strong>Each Node Has ONE Job</strong></p><pre>| Node         | Job                             | LLM Calls | Token Budget |<br>|--------------|---------------------------------|-----------|--------------|<br>| Planner      | Classify intent, pick tools     | 1         | ~800         |<br>| Executor     | Run tools, collect data         | 0         | 0            |<br>| Observer     | Quality gate — retry or proceed | 0-1       | ~300         |<br>| Synthesiser  | Format final response           | 1         | ~1,000       |<br>| Total        |                                 | 2-3       | ~2,100       |</pre><p>Compare to ReAct: 8 calls × 13,500 tokens = <strong>108,000 tokens</strong>.</p><p>PEOS: 2.5 calls × 850 tokens avg = <strong>2,125 tokens</strong>.</p><p>That’s a <strong>98% reduction </strong>in best case, <strong>80% average</strong>.</p><p><strong>Deep Dive: Each Node</strong></p><p><strong>Node 1: Planner</strong></p><p>The Planner is the most important optimization. It only sees:</p><pre>PLANNER_SYSTEM_PROMPT = &quot;&quot;&quot;<br>You classify user intent and select tools.<br><br>Available intents: {intent_catalog}<br>Available tool groups: {tool_groups}<br><br>Output JSON:<br>{&quot;intent&quot;: &quot;...&quot;, &quot;tools&quot;: [...], &quot;params&quot;: {...}}<br>&quot;&quot;&quot;<br><br># CRITICAL: Only last 3 user messages (not full history!)<br>user_context = [m for m in history if m[&quot;role&quot;] == &quot;user&quot;][-3:]</pre><p><strong>Why 3 turns? </strong>We tested 1, 3, 5, 10:</p><pre><br>| Context Window | Accuracy | Tokens | Latency |<br>|----------------|----------|--------|---------|<br>| 1 turn         | 78%      | 400    | 0.8s    |<br>| 3 turns        | 94%      | 650    | 1.1s    |<br>| 5 turns        | 95%      | 1,200  | 1.4s    |<br>| 10 turns       | 95%      | 3,000  | 2.1s    |</pre><p>3 turns hits the sweet spot. Going beyond 3 gains almost nothing.</p><p><strong>Node 2: Executor</strong></p><p><strong>Zero LLM calls.</strong> Just HTTP requests.</p><pre>class Executor:<br>    async def run(self, plan: Plan) -&gt; list[ToolResult]:<br>        # Only bind tools the Planner selected<br>        tools = self._bind_tools(plan.tools)  # 3-5 tools, not 20<br>        <br>        # Run in parallel<br>        results = await asyncio.gather(*[<br>            self._execute(tool, plan.params) <br>            for tool in tools<br>        ])<br>        <br>        # Truncate huge results<br>        for r in results:<br>            if len(str(r.data)) &gt; 50_000:<br>                r.data = truncate(r.data, 50_000)<br>        <br>        return results</pre><p><strong>Key insight:</strong> The Executor doesn’t need an LLM. It receives explicit instructions from the Planner (which tools to call, what params to pass). It just executes.</p><p>This is where ReAct burns money — it uses the LLM to decide “which tool should I call next?” at every step. We make that decision ONCE in the Planner.</p><p><strong>Node 3: Observer</strong></p><p>The Observer is the secret weapon. It’s a quality gate:</p><pre>class Observer:<br>    async def evaluate(self, results: list[ToolResult]) -&gt; Decision:<br>        successes = [r for r in results if r.success]<br>        failures = [r for r in results if not r.success]<br>        <br>        # All failed → FAIL<br>        if not successes:<br>            return Decision.FAIL<br>        <br>        # Partial failure + retries available → RETRY<br>        if failures and self.retries_remaining &gt; 0:<br>            self.retries_remaining -= 1<br>            return Decision.RETRY<br>        <br>        # Quality checks<br>        if self._has_empty_results(successes):<br>            return Decision.RETRY<br>        <br>        return Decision.DONE</pre><p><strong>Without Observer:</strong> Tool fails silently → Synthesiser formats empty data → User sees “Here’s your order summary:” with nothing below it.</p><p><strong>With Observer:</strong> Tool fails → Observer catches it → retries with different params or alternative tool → User gets actual data.</p><p>Our retry success rate: <strong>85%</strong>. That’s 85% of failures that would have been garbage responses.</p><p><strong>Node 4: Synthesiser</strong></p><p>The Synthesiser has ONE job: format data into a readable response.</p><pre>SYNTH_PROMPT = &quot;&quot;&quot;<br>Format the following tool results into a concise response.<br><br>Rules:<br>- Use markdown headers and bullet points<br>- Include relevant numbers/dates<br>- Generate 2-3 quick reply suggestions (max 28 chars each)<br>- If data is missing, say so clearly<br><br>Tool Results:<br>{results}<br><br>User&#39;s original question: {question}<br>&quot;&quot;&quot;</pre><p><strong>Why separate from Executor?</strong></p><p>- Executor results might be raw JSON (ugly for users)</p><p>- Synthesiser applies consistent formatting rules</p><p>- Quick replies need context awareness</p><p>- Cards/charts need structured DataPart output</p><p><strong>The Retry Loop in Practice</strong></p><p>Real scenario:</p><pre>User: &quot;What&#39;s the cost breakdown for order 4002310?&quot;<br><br>PLANNER → Intent: cost_analysis, Tools: [get_order_costs]<br><br>EXECUTOR → get_order_costs(&quot;4002310&quot;)<br>         → ERROR: 403 Forbidden (cost hierarchy not configured)<br><br>OBSERVER → Decision: RETRY (1 of 2)<br>         → Substitutes: get_order_header (has total cost fields)<br><br>EXECUTOR → get_order_header(&quot;4002310&quot;)<br>         → SUCCESS: {TotalPlannedCost: 15000, ActualCost: 12300, Currency: EUR}<br><br>OBSERVER → Decision: DONE<br><br>SYNTHESISER → &quot;Cost summary for order 4002310:<br>              • Planned: €15,000<br>              • Actual: €12,300<br>              • Variance: -€2,700 (18% under budget) ✅&quot;</pre><p>Without the Observer, the user would see: <em>”Sorry, I couldn’t retrieve cost data.”</em></p><p><strong>Implementation (Production Code)</strong></p><pre>class PEOSGraph:<br>    async def invoke(self, message: str, history: list) -&gt; Response:<br>        # 1. PLANNER (1 LLM call, small context)<br>        plan = await self.planner.run(<br>            message=message,<br>            context=history[-3:],  # Only last 3 turns<br>        )<br>        <br>        # 2. EXECUTOR (0 LLM calls)<br>        results = await self.executor.run(plan)<br>        <br>        # 3. OBSERVER (0-1 LLM calls, usually rule-based)<br>        retries = 0<br>        while retries &lt; 2:<br>            decision = await self.observer.evaluate(results)<br>            if decision == Decision.DONE:<br>                break<br>            if decision == Decision.RETRY:<br>                results = await self.executor.retry(plan, results)<br>                retries += 1<br>            if decision == Decision.FAIL:<br>                break<br>        <br>        # 4. SYNTHESISER (1 LLM call)<br>        response = await self.synthesiser.format(<br>            question=message,<br>            results=results,<br>            intent=plan.intent,<br>        )<br>        <br>        return response</pre><p><strong>Before/After Comparison</strong></p><p><strong>Token Usage Per Request</strong></p><pre>ReAct:  ████████████████████████████████████████ 12,000 tokens<br>PEOS:   █████████ 2,500 tokens<br>                                              ↑ 79% savings</pre><p><strong>LLM Calls Per Request</strong></p><pre>ReAct:  ●●●●●●●● 8.3 calls avg<br>PEOS:   ●●● 2.5 calls avg<br>                   ↑ 70% fewer</pre><p><strong>Cost Per Day (250 users)</strong></p><pre>ReAct:  $67.00/day ($2,010/month)<br>PEOS:   $12.40/day ($372/month)<br>                     ↑ $1,638/month saved</pre><p><strong>When NOT to Use PEOS</strong></p><p>Be honest — PEOS isn’t always the answer:</p><pre>| Use Case                               | Better Pattern   | Why                              |<br>|----------------------------------------|------------------|----------------------------------|<br>| Open-ended research (10+ tool calls)   | ReAct/CoT        | PEOS caps at planned tools       |<br>| Multi-step reasoning with dependencies | Plan-and-Execute | Steps depend on previous results |<br>| Single tool, simple Q&amp;A                | Direct call      | No orchestration needed          |<br>| Creative writing                       | Single LLM call  | No tools involved                |</pre><p><strong>PEOS is optimal for:</strong> 1–5 tool calls, known intent categories, deterministic routing, enterprise agents with cost constraints.</p><p><strong>Get the Code</strong></p><p>Full production-ready implementation:</p><p><a href="https://github.com/naveenkumarbaskaran/PEOSGraph"><strong>PEOSGraph</strong></a><strong> </strong>— LangGraph-compatible, async, with checkpointing</p><pre>pip install peosgraph</pre><pre>from peosgraph import PEOSGraph, PlannerNode, ExecutorNode, ObserverNode, SynthesiserNode<br><br>graph = PEOSGraph(<br>    planner=PlannerNode(intent_catalog=[&quot;search&quot;, &quot;detail&quot;, &quot;action&quot;]),<br>    executor=ExecutorNode(tools=your_tools, max_iterations=10),<br>    observer=ObserverNode(max_retries=2),<br>    synthesiser=SynthesiserNode(model=&quot;gpt-4o-mini&quot;),<br>)<br><br>result = await graph.invoke(&quot;Show me critical orders in plant 1000&quot;)</pre><p><strong>Next Up</strong></p><p><strong>Part 4:</strong> Google’s A2A Protocol — how agents discover and delegate tasks to each other. I built an SDK; here’s what the spec actually requires.</p><p><em>67/day → $12/day. What’s YOUR agent costing? Share your numbers — I’m curious how this compares across orgs.</em></p><p><strong>Tags:</strong> ‘Artificial Intelligence’ · ‘LLM’ · ‘Software Architecture’ · ‘Cost Optimization’ · ‘Python’</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f7fdd2025d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Ways Enterprise AI Agents Fail Silently (And How to Catch Them)]]></title>
            <link>https://medium.com/@naveenkumarbaskaran/5-ways-enterprise-ai-agents-fail-silently-and-how-to-catch-them-fa658e826477?source=rss-373be46e0d7f------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa658e826477</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[enterprise-software]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[mlops]]></category>
            <dc:creator><![CDATA[Naveen Kumar Baskaran]]></dc:creator>
            <pubDate>Sun, 22 Nov 2026 15:23:43 GMT</pubDate>
            <atom:updated>2026-11-22T15:23:43.420Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pRdQAFm_YU9SDxYf" /><figcaption>Photo by <a href="https://unsplash.com/@pray4bokeh?utm_source=medium&amp;utm_medium=referral">Bruno Guerrero</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The incidents you won&#39;t see coming — until they&#39;ve been running for weeks.</p><p>Six months after launch, an operations engineer flagged something strange. The agent was giving confident answers about a maintenance process — but the process had changed in a system update three months earlier. Nobody had filed a ticket. Nobody had complained. The agent had been wrong about this for 90 days, and because it always answered confidently, users had been acting on the wrong information.</p><p>When I dug into the logs, it wasn’t a one-off. Five of our twelve knowledge domains had stale documents that nobody had flagged. The agent’s retrieval was working perfectly — it was finding the best matching chunks. Those chunks were just outdated.</p><p>That was the moment I understood the difference between a failure that’s loud and a failure that’s quiet. Loud failures get fixed. Quiet ones compound.</p><p>My first reaction was to fix the stale document. Easy. But then I asked the harder question: how long had this been happening? And how many other domains had the same problem without anyone noticing?</p><p>I built a freshness audit script and ran it against the full knowledge base. Twelve domains. Five with documents overdue for review. Two with content that had been superseded by system updates. All of it still being served with high confidence scores.</p><p>That audit led to a broader investigation. Over the following weeks I catalogued every failure mode that had no visible signal — no ticket, no user complaint, no metric spike. Five patterns emerged. All of them were running in production on the day I found them.</p><p>The hardest failures in production AI aren’t the obvious ones.</p><p>Obvious failures are loud. The API goes down. The model returns garbage. The index is empty. Users complain immediately. You fix it.</p><p>Silent failures are different. The system appears to work. Metrics look fine. Users get answers. And somewhere in the background, the system is quietly wrong in a way that won’t surface for weeks — until someone acts on a bad answer, or the quarterly audit runs, or a new team member asks a question that exposes a gap the original team learned to avoid.</p><p>Here are the five that have burned me in production.</p><h3>Failure 1: Index drift</h3><p>What it looks like: answer quality gradually declines. Users stop trusting certain domains. The complaints are vague — “it used to be better.”</p><p>What’s actually happening: documents are becoming stale. The system updated three months ago. The organization kept moving. The index didn’t.</p><p>The insidious part: staleness doesn’t cause retrieval failures. The system still returns chunks — they’re just outdated. Confidence scores don’t reflect freshness. The model generates a fluent, confident answer from outdated information.</p><p>How to catch it: track verification dates. Run a weekly freshness audit. Anything overdue by more than one review cycle gets flagged to its owner and downgraded in confidence tier.</p><h3>Failure 2: Cross-domain blind spots</h3><p>What it looks like: questions that span two domains get partially-correct answers. The system answers the part it has coverage for, omits the part it doesn’t, and doesn’t tell you.</p><p>What’s actually happening: your retrieval is domain-partitioned. BM25 and semantic search find the best chunks within each domain. If the answer requires synthesizing across domains with uneven coverage, the system grabs what it can and generates from there.</p><p>The insidious part: partial answers are more dangerous than no answers. A user who gets “I don’t know” goes to find out. A user who gets a 70%-correct answer acts on it.</p><p>How to catch it: add a coverage-gap check before generation. If chunks cover less than 70% of the query surface, say so explicitly.</p><h3>Failure 3: Tool call proliferation</h3><p>What it looks like: costs spike. Latency increases. Nothing seems to have changed.</p><p>What’s actually happening: the agent discovered it can call tools, and now calls them reflexively — even when the answer is already in the retrieved context.</p><p>How to catch it: add usage guidance to tool descriptions. Then instrument call frequency per query. When a tool’s call rate exceeds the percentage of queries that genuinely need it, the description needs tuning.</p><h3>Failure 4: Silent degradation</h3><p>What it looks like: nothing, for weeks. Then someone runs an evaluation and the numbers are bad.</p><p>What’s actually happening: your eval suite was written at launch. The domain has expanded since then. The eval still covers the original distribution. New traffic areas go unmeasured.</p><p>How to catch it: run evaluation continuously. 50 reference questions, weekly. Add new questions when the domain expands. A 5-point score drop triggers investigation.</p><h3>Failure 5: Confidence score drift</h3><p>What it looks like: users stop citing the system in decisions. Trust quietly erodes. You find out in retrospectives, not in alerts.</p><p>What’s actually happening: confidence scores were calibrated at launch against the initial knowledge base. As the base evolves, the calibration drifts. High-confidence answers become less reliable. Users notice before the metrics do.</p><p>How to catch it: track confidence scores against actual accuracy weekly. If your high-confidence tier is correct less than 85% of the time, recalibrate.</p><h3>The pattern</h3><p>All five failures share a structure: the system appears to work, the metrics don’t flag it, and the problem compounds quietly until it’s expensive to fix.</p><p>The defense is not better architecture. It’s better instrumentation.</p><p>Build the measurement infrastructure before the optimization layers. Know what your system is doing before you try to make it do it better.</p><p>If you can’t measure it, you can’t trust it. If you can’t trust it, the enterprise won’t either.</p><p>This is part 1 of the Enterprise AI in Production series.</p><p>If this matched something you’ve run into — follow for the next post in the series. I publish once or twice a week on building production AI for enterprise systems.</p><p>Building something similar? I’d love to hear about it in the comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa658e826477" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What a Year of Production AI Actually Looks Like]]></title>
            <link>https://medium.com/@naveenkumarbaskaran/what-a-year-of-production-ai-actually-looks-like-b56640131aed?source=rss-373be46e0d7f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b56640131aed</guid>
            <dc:creator><![CDATA[Naveen Kumar Baskaran]]></dc:creator>
            <pubDate>Thu, 19 Nov 2026 13:07:11 GMT</pubDate>
            <atom:updated>2026-11-19T13:07:11.644Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4WJuMFHV0hB10ae8" /><figcaption>Photo by <a href="https://unsplash.com/@kevinache?utm_source=medium&amp;utm_medium=referral">Kevin Ache</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This is the last post in the series. Posts 1–4 covered the pieces: fixing RAG, building the reasoning loop, governing the knowledge base, wiring it up with MCP. This post is about what happens when you run all of it together, in production, for a year.</p><p>The honest version. Not the architecture diagram version.</p><p>The full stack, end to end</p><p>Here’s what the complete system looks like when a question comes in:</p><p>Route first: single-pass or agentic? One LLM call decides.</p><p>Single-pass: hybrid retrieve (BM25 + semantic → RRF) → freshness filter → coverage judge → generate.</p><p>Agentic (about 15% of queries): loop up to 5 steps — plan next retrieval → hybrid retrieve → reason over context → can answer? If yes, break. If no, continue. Then generate.</p><p>After either path: cite sources with confidence tier, owner, and last_verified date. Stream the response.</p><p>The whole thing — from question to first token — runs in under 2 seconds for single-pass. Agentic questions average 8–12 seconds for 3-step chains. Streaming covers the latency: users see the first sentence while the rest is still generating.</p><p>What actually breaks in production</p><p>The index drift problem</p><p>You build the system. You index everything. Three months later, 20% of the index is stale. Not because anyone did anything wrong — because the world moved and the index didn’t.</p><p>The fix we landed on: a weekly freshness job that scans every document, computes staleness scores, and opens GitHub issues for owners whose documents are overdue. Owners get one notification. If they don’t act in two weeks, the document gets downgraded to auto-imported confidence and surfaced with a staleness warning.</p><p>It sounds harsh. It’s the only thing that actually works.</p><p>The question the system can’t answer</p><p>Every system has a blind spot — questions it confidently answers wrong rather than saying it doesn’t know.</p><p>The pattern we see most: a question that spans two domains, one well-covered in the index, one not. The system retrieves confidently from the first domain, reasons over partial information, and generates a plausible-sounding answer that’s missing half the picture.</p><p>The fix: teach the system to surface its coverage explicitly. After the agentic loop, before generating, one additional check: “What domains does this question touch? Do we have good coverage of all of them?” If the answer is no, say so rather than generating with false confidence.</p><p>MCP tool call explosions</p><p>Once the AI has MCP tools, it wants to use them. All of them. For everything.</p><p>A question that could be answered from context triggers four tool calls. A simple lookup turns into a five-step investigation. Token costs spike. Latency spikes.</p><p>The fix: tool call budgets. Each tool description includes guidance on when not to call it. “Only call this if the answer is not already in context” reduces unnecessary calls by roughly 60%.</p><p>The “it was working yesterday” class of bugs</p><p>Retrieval quality degrades silently. The embeddings model doesn’t change, but the distribution of questions does. New terminology enters the domain that the index doesn’t have good coverage for.</p><p>The fix: a lightweight eval that runs weekly against 50 reference questions with known-good answers. When the composite score drops below threshold, it pages someone. The difference between catching degradation in a week versus catching it when a user escalates.</p><p>The numbers after a year</p><p>Coverage rate (questions where the system has relevant context): 87%<br>Staleness catch rate (outdated content caught before a user hits it): 83%<br>Unnecessary tool calls reduced after adding tool call budgets: ~60%<br>Mean time to detect retrieval degradation: down from weeks to days<br>Agentic queries (requiring 3+ source documents): ~15% of total</p><p>The other 85% of questions go single-pass. Agentic routing is not the default — it’s the escalation path.</p><p>What I’d do differently</p><p>Start with the eval, not the pipeline. The biggest time sink was building the retrieval and reasoning layers without a way to measure if they were actually improving. The eval suite should come first. It makes every subsequent decision concrete — does this change improve the score or not?</p><p>Treat the knowledge base as a product, not infrastructure. The docs, the ownership model, the freshness system — these need as much attention as the code. The teams that struggle are the ones that treat the KB as a one-time setup. The teams that succeed are the ones that have someone whose job includes keeping it current.</p><p>Default to simpler. The agentic loop, the coverage judge, the confidence tiers — these all add value, but they all add complexity. Start with hybrid retrieval and a staleness filter. Ship that. Only add the reasoning loop when single-pass is provably insufficient. Complexity compounds; add it deliberately.</p><p>Where this goes next</p><p>The pattern in this series — retrieval, reasoning, governance, protocol — is stable. What changes is what sits on top of it.</p><p>The next layer is agents that don’t just answer questions but take actions: filing tickets, triggering pipelines, updating documents, notifying owners. The same knowledge platform becomes the memory and context layer for autonomous agents operating in your systems.</p><p>That’s a longer series. But the foundation — a trustworthy, well-governed knowledge base accessible via a standard protocol — is the same.</p><p>Build the foundation right. The rest gets easier.</p><p>This series covered: fixing RAG → building the reasoning loop → governing the knowledge layer → wiring it with MCP → production reality. Each post stands alone; together they describe a complete system.</p><p>If you’ve built something similar and hit different failure modes — drop a comment. The interesting problems are always in the gaps between the architecture diagrams.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b56640131aed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MCP: The Protocol That Finally Makes AI Tools Composable]]></title>
            <link>https://medium.com/@naveenkumarbaskaran/mcp-the-protocol-that-finally-makes-ai-tools-composable-30ec7affb2d5?source=rss-373be46e0d7f------2</link>
            <guid isPermaLink="false">https://medium.com/p/30ec7affb2d5</guid>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Naveen Kumar Baskaran]]></dc:creator>
            <pubDate>Thu, 19 Nov 2026 12:13:43 GMT</pubDate>
            <atom:updated>2026-11-19T12:13:43.158Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7E3Wk7E5rfQg-HEc" /><figcaption>Photo by <a href="https://unsplash.com/@eclipticgraphic?utm_source=medium&amp;utm_medium=referral">Ecliptic Graphic</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Every team building AI tooling eventually hits the same wall.</p><p>You have a knowledge base. You have a RAG pipeline. You have Claude, or Cursor, or Copilot, or some internal tool. And every time you want to connect them, you write a custom integration. A REST client here. A plugin manifest there. A bespoke adapter for each tool that wants to talk to your system.</p><p>Six months later you have five integrations, all slightly different, all breaking in slightly different ways, all requiring maintenance.</p><p>MCP — the Model Context Protocol — is the answer to this. Not because it’s magic, but because it’s a standard. One server, any client.</p><p>What MCP actually is</p><p>MCP is an open protocol that defines how AI tools talk to external systems. Instead of each AI client implementing its own way to call your API, they all speak the same protocol. You implement the server once. Every MCP-compatible client — Claude, Cursor, any tool that adopts it — can use it immediately.</p><p>The mental model is USB-C for AI tools. Before USB-C, every device had its own cable. After USB-C, one cable works everywhere. MCP is that for AI context and capabilities.</p><p>The protocol has three primitives:</p><p>Resources — things the AI can read (documents, files, database records, API responses)<br>Tools — things the AI can call (search, write, execute)<br>Prompts — reusable prompt templates the client can invoke</p><p>That’s it. Everything in MCP is one of these three things.</p><p>Why this matters for the knowledge layer we built</p><p>In Posts 1–3 we built a knowledge platform: hybrid retrieval, agentic reasoning, versioned git-native knowledge base. All of it accessible via a REST API.</p><p>Without MCP: every AI tool that wants to use it needs a custom integration. Claude Code needs one. Cursor needs one. Your internal tools need one. Each is bespoke, each breaks independently.</p><p>With MCP: you write one server. Every tool connects to it the same way. The knowledge layer becomes a first-class capability any AI tool can use — search it, retrieve from it, check freshness, run investigations.</p><p>The whole server is under 50 lines of JavaScript. Any MCP-compatible client can now search your knowledge base, retrieve documents, and read the index — without you writing a single client-specific integration.</p><p>Connecting it to Claude Code</p><p>Add this to .mcp.json in your project:</p><p>{ “mcpServers”: { “knowledge-platform”: { “command”: “node”, “args”: [“.platform/src/mcp-server.mjs”] } } }</p><p>Claude Code reads .mcp.json on startup. The server runs in the background. Claude can now call search_knowledge, get_document, and read the index as naturally as any other tool. No REST client. No auth headers. No schema negotiation.</p><p>The transport options</p><p>MCP supports two transports:</p><p>stdio — the server runs as a subprocess, communicating over stdin/stdout. Zero network overhead. Best for local tools and CLI usage. This is what Claude Code uses.</p><p>SSE (HTTP + Server-Sent Events) — the server runs as an HTTP service, clients connect over the network. Best for shared infrastructure, remote teams, or when you want one server serving multiple clients.</p><p>For a team knowledge platform, SSE makes more sense: one server, everyone connects to it. For a personal tool or local dev workflow, stdio is simpler and faster.</p><p>What good MCP tool design looks like</p><p>The common mistake is exposing your entire API as MCP tools. Don’t. The AI calling your tools doesn’t need 40 endpoints — it needs 4–6 well-designed ones.</p><p>Good MCP tool design follows the same rules as good API design for humans, with one extra constraint: the tool’s description is part of the prompt. The AI reads it and decides whether to call the tool. A bad description means the tool never gets called, or gets called at the wrong time.</p><p>Name — verb + noun, specific: search_knowledge not query or get. The AI pattern-matches on names.</p><p>Description — say when to use it, not just what it does. “Search the knowledge base for a topic or question. Use this before answering any domain question.” is better than “Searches knowledge.”</p><p>Parameters — fewer is better. If a tool has 8 parameters, split it into two tools. The AI gets confused by too many options.</p><p>Return format — consistent, predictable. JSON with the same shape every time. The AI learns your schema after a few calls; changing it mid-session breaks the pattern.</p><p>The bigger picture</p><p>MCP changes the architecture of AI tooling in a subtle but important way.</p><p>Before MCP, AI capabilities were locked inside the client. Claude could do what Claude could do. Cursor could do what Cursor could do. Your custom tooling stayed custom.</p><p>After MCP, capabilities live on servers. The AI is a client that can reach any server speaking the protocol. Your knowledge platform, your CI system, your internal APIs, your database — all first-class AI capabilities, composable, shareable across tools.</p><p>This is the direction everything is heading. Building your platform as an MCP server today means you’re compatible with every AI tool that adopts the protocol tomorrow — and most of the serious ones already have.</p><p>Next: Putting it all together — the full architecture from query to answer, and what production actually looks like after a year.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30ec7affb2d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your Knowledge Base Is Lying to You]]></title>
            <link>https://medium.com/@naveenkumarbaskaran/your-knowledge-base-is-lying-to-you-9f34c080845d?source=rss-373be46e0d7f------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f34c080845d</guid>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Naveen Kumar Baskaran]]></dc:creator>
            <pubDate>Thu, 19 Nov 2026 12:02:27 GMT</pubDate>
            <atom:updated>2026-11-19T12:02:27.415Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tAYguC7w9gTKNsX4" /><figcaption>Photo by <a href="https://unsplash.com/@giamboscaro?utm_source=medium&amp;utm_medium=referral">Giammarco Boscaro</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Here’s something nobody says out loud: most AI systems that “work in demos” are running over a knowledge base that’s quietly wrong in ways nobody has bothered to measure.</p><p>Not catastrophically wrong. Just slowly, incrementally wrong. A doc updated six months ago that the index never saw. A procedure that changed after a reorg. A config value that was true when someone wrote it and isn’t anymore.</p><p>The retrieval layer can be perfect. The reasoning loop can be elegant. If the knowledge base underneath is stale, inconsistent, and ungoverned, the system produces confident misinformation at scale.</p><p>This post is about fixing that.</p><p>The three ways knowledge bases go bad</p><p>Documents that live outside the index</p><p>Someone writes the answer in a Confluence page. Someone else drops it in a Notion doc. A third person emails it to a distribution list. None of it makes it into the index.</p><p>The AI says “I don’t know.” The answer exists. The user loses faith.</p><p>The fix isn’t technical — it’s process. You need a single canonical place where knowledge lives, and a friction-free path for adding to it. Git works extremely well for this. A flat directory of markdown files, version-controlled, with a PR-based contribution flow, is simpler and more durable than any wiki.</p><p>Documents that are in the index but shouldn’t be</p><p>Outdated procedures. Deprecated APIs. Old team structures. These don’t just fail to help — they actively mislead. The model retrieves them with full confidence because embeddings don’t know time.</p><p>Track a last_verified date on every document. Flag anything not verified in the last 90 days. Surface it to whoever owns that domain. Don’t let the index silently accumulate rot.</p><p>Documents with no clear owner</p><p>Someone leaves the team. Their docs stay in the index. Nobody knows if they’re still accurate. Nobody reviews them when things change.</p><p>Every document needs an owner. Not a team — a specific person. That person gets notified when the doc hits its staleness threshold. When they leave, ownership transfers explicitly, not implicitly.</p><p>Why git is the right primitive</p><p>This sounds opinionated and it is.</p><p>A knowledge base is not a wiki. It’s not a database. It’s a corpus of versioned, reviewable, ownable text — and that’s exactly what git was designed to manage.</p><p>What you get for free:</p><p>Full history. Every change, by whom, when, and why. You can answer “what did we know about X on March 15th?” by checking out that commit.</p><p>Review before merge. A PR forces someone to look at a change before it enters the index. You catch errors, contradictions, outdated assumptions before they propagate.</p><p>Blame. When the AI gives a wrong answer, you can trace it to the specific commit that introduced the bad chunk. You have a paper trail.</p><p>Rollback. Bad document? Revert the commit. The index rebuilds from the previous state.</p><p>None of this is possible in a wiki or a database without building it yourself, badly.</p><p>The freshness system that actually works</p><p>The key insight: freshness isn’t about when a document was written. It’s about when it was last verified.</p><p>A document written three years ago and verified last week is fresher than a document written last month and never reviewed.</p><p>Every document needs: title, owner, last_verified date, confidence level (high/medium/low), source (verified/contributed/auto-imported), and review_cycle_days.</p><p>The review_cycle_days field is per-document intentionally. Some things change fast (API configs, pricing, team structures). Some things are stable for years (architectural patterns, foundational concepts). One-size-fits-all 90-day cycles create noise for stable docs and miss fast-moving ones.</p><p>The staleness score is simply days_since_verified divided by review_cycle_days. A score above 1.0 is overdue — surface it in the response. Above 2.0, exclude it from the default retrieval path and route to a “potentially stale” collection.</p><p>The contribution flow that keeps quality up</p><p>The biggest killer of knowledge base quality isn’t bad actors — it’s friction. If adding a document is hard, people don’t do it. If reviewing is hard, reviews don’t happen. The base drifts.</p><p>The flow: write a markdown file → add frontmatter → open a PR → automated check (frontmatter complete? no secrets? file in right place?) → owner reviews via CODEOWNERS → merge → index rebuild triggers automatically.</p><p>The automated check handles the mechanical stuff. The owner review handles the semantic stuff. Neither is optional.</p><p>The index rebuild on merge is worth emphasizing: contributors shouldn’t have to think about indexing. They write a document, it gets merged, it’s in the index within minutes. The pipeline is invisible.</p><p>Confidence tiers</p><p>Not all knowledge is equal. A document extracted from live API documentation is more reliable than a document someone wrote from memory after a meeting.</p><p>Tag it. Four tiers:</p><p>Verified — ADT-confirmed, source-of-truth. Full confidence, no warning.<br>Contributed — Team-submitted, owner-reviewed. Standard confidence.<br>Auto-imported — Scraped or generated. Surface provenance warning.<br>Draft — Unreviewed. Excluded from default retrieval.</p><p>When generating, include tier in the citation. “According to a verified source…” vs “According to a contributed document, last reviewed by [owner] on [date]…” Users can calibrate their trust. That’s more honest than presenting everything at the same confidence level.</p><p>What this looks like in practice</p><p>After six months running this:</p><p>Staleness alerts catch 80% of outdated content before a user hits it. The PR review flow rejects about 15% of contributions for quality reasons — and those rejections improve future contributions because contributors get feedback. Owners rotate properly; no document goes more than one ownership cycle without a check. When something goes wrong, the git history tells you exactly what changed and when.</p><p>The unglamorous truth is that good retrieval and good reasoning only matter if the knowledge underneath is trustworthy. The infrastructure around the documents is as important as the documents themselves.</p><p>Next: MCP — the missing protocol that lets any AI tool talk to your knowledge layer without custom integrations.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f34c080845d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When One Retrieval Pass Isn't Enough]]></title>
            <link>https://medium.com/@naveenkumarbaskaran/when-one-retrieval-pass-isnt-enough-6f42419f5d62?source=rss-373be46e0d7f------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f42419f5d62</guid>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Naveen Kumar Baskaran]]></dc:creator>
            <pubDate>Thu, 19 Nov 2026 11:57:37 GMT</pubDate>
            <atom:updated>2026-11-19T11:57:37.627Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*se_sDFsWD75nwA0e" /><figcaption>Photo by <a href="https://unsplash.com/@atomsmasher?utm_source=medium&amp;utm_medium=referral">Sandip Kalal</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>There’s a class of question that breaks well-tuned single-pass RAG every time.</p><p>Not because the index is bad. Not because the chunking is wrong. But because the answer doesn’t exist in any single chunk — it has to be assembled from multiple pieces that are scattered across the knowledge base, sometimes connected by logic that isn’t written down anywhere.</p><p>“What changed between version 2 and version 3 of this API, and does that affect the retry behavior we documented last year?”</p><p>Single-pass RAG retrieves the top-K chunks closest to that query. It gets some of version 2, some of version 3, maybe the retry docs. The LLM tries to reason over all of it simultaneously and produces something that sounds plausible but misses the actual connection.</p><p>This is where agentic RAG starts.</p><p>What makes a question “multi-hop”</p><p>A question is multi-hop when answering it requires at least two separate retrievals where the second depends on the result of the first.</p><p>Simple question: “What is the retry timeout for the payments API?”<br>One retrieval. Single chunk. Done.</p><p>Multi-hop question: “Does the retry timeout in the payments API match the SLA we committed to in the enterprise contract?”<br>Retrieval 1: payments API retry config → answer: 30 seconds<br>Retrieval 2: enterprise contract SLA terms → answer: max 45 seconds<br>Reasoning step: 30s &lt; 45s → yes, it complies</p><p>You can’t answer the second question without both retrievals and a reasoning step between them. Single-pass RAG collapses this into one shot and loses the chain.</p><p>The loop that fixes it</p><p>The core idea is simple: instead of retrieving once and generating, you build a loop where the model decides what to retrieve next based on what it already knows.</p><p>The loop has three steps that repeat:<br>1. Plan — look at what we know and decide what to retrieve next<br>2. Retrieve — hybrid search on that query<br>3. Reason — extract what we now know, what’s still missing</p><p>The loop exits when the model says it can answer, or when it hits the step limit.</p><p>plan_next_retrieval looks at what we know so far and decides what to look for next. If we have nothing yet, it formulates the first retrieval from the original question. If we have partial context, it generates a follow-up query that fills the gap. When nothing is missing, it returns null and the loop exits.</p><p>reason_over_context extracts what we now know after each retrieval. This is what lets the system build up a chain of reasoning rather than trying to answer everything at once. It explicitly names what’s still unknown — that feeds back into the next plan step.</p><p>can_answer is a quick check before generating. Prevents the model from producing an answer when it’s still missing something important. The model often wants to answer early with partial information — this gate forces it to wait.</p><p>The part people skip: knowing when to stop</p><p>The loop needs a hard exit — both a step limit and a coverage check. Without them, the model searches indefinitely on hard questions, burning tokens and time.</p><p>The step limit is a circuit breaker. For most questions, 2–3 steps is enough. 5 is generous. Beyond that you’re usually dealing with a question the index can’t answer, not one that needs more retrieval.</p><p>The can_answer check is what prevents premature answers. Without it you get confident-sounding partial answers that are technically wrong because they’re missing the second half of the chain.</p><p>What this costs and when it’s worth it</p><p>Agentic RAG is slower and more expensive than single-pass. Each step is an LLM call. A 3-step question costs roughly 3× the tokens of a single-pass question, plus retrieval overhead.</p><p>Worth it when:<br>- Questions span multiple documents or time periods<br>- The answer requires comparison or synthesis across sources<br>- Users are asking “how does X relate to Y” or “has anything changed about Z”</p><p>Not worth it when:<br>- The question is a simple lookup<br>- Latency matters more than completeness<br>- Your index is small enough that single-pass coverage is reliable</p><p>A simple classifier at query time routes easy questions to single-pass and complex ones to the agentic loop. One LLM call asking “is this answerable from a single document, or does it require combining multiple sources?” is usually enough.</p><p>Failure modes worth knowing</p><p>Hallucinated retrieval queries. The model sometimes generates a retrieval query for information that doesn’t exist in the index. The loop retrieves noise, the coverage check fails, and you hit your step limit. Log when you hit the limit — it’s usually a signal that the question is out of scope, not a retrieval failure.</p><p>Circular reasoning. The model retrieves the same chunks repeatedly because it keeps asking similar questions. Track retrieved chunk IDs and skip chunks already in context.</p><p>Latency. A 5-step loop with a coverage judge at each step can take 10–15 seconds. Use streaming to push partial results as the loop progresses — users tolerate latency far better when they see progress.</p><p>What we’ve built so far</p><p>Post 1 fixed the retrieval layer — hybrid search, freshness filtering, coverage checking.</p><p>This post added the reasoning loop on top — multi-hop decomposition, step-by-step synthesis, smart routing.</p><p>The next piece is the knowledge layer itself: how you structure, version, and govern the documents that feed all of this. Because a good retrieval loop over a bad knowledge base is still a bad system.</p><p>Next: Building a knowledge base your AI tools can actually trust — versioning, freshness, and why git is the right primitive.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f42419f5d62" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why RAG Fails in Production (And How to Fix It)]]></title>
            <link>https://medium.com/@naveenkumarbaskaran/why-rag-fails-in-production-and-how-to-fix-it-a49bcb3310b6?source=rss-373be46e0d7f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a49bcb3310b6</guid>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Naveen Kumar Baskaran]]></dc:creator>
            <pubDate>Thu, 19 Nov 2026 11:48:08 GMT</pubDate>
            <atom:updated>2026-11-19T11:51:56.411Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6gUUXQIxBF0x-A9H" /><figcaption>Photo by <a href="https://unsplash.com/@eclipticgraphic?utm_source=medium&amp;utm_medium=referral">Ecliptic Graphic</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Six weeks after every RAG demo, the tickets start.</p><p>“It gave me wrong information.” “It said it didn’t know — but the answer is right there in the docs.” “Same question, different answer every time.”</p><p>I’ve seen this pattern enough times to know: it’s not the model. The model is fine. The retrieval is broken.</p><p>Here’s what’s actually going wrong, and what I do about it.</p><p>The chunking is wrong and nobody notices until it’s too late</p><p>Everyone starts with fixed-size chunking. 512 tokens, overlap 50, ship it. It works in the demo because the demo questions are easy and the docs are clean.</p><p>Production is neither.</p><p>A 512-token window that cuts a procedure in half gives the LLM half a procedure. It fills in the rest. That’s not hallucination in the mystical sense — it’s a completely predictable response to incomplete input. A chunk that spans two unrelated topics matches queries it shouldn’t and misses the ones it should catch.</p><p>The fix sounds obvious once you say it out loud: chunk by meaning, not by size. Split on section headers and paragraph breaks first. Keep code blocks whole. Keep numbered lists whole. Tables are one chunk. Then apply a size ceiling as a hard limit, not a target.</p><p>The test I use: take any chunk out of context and ask whether it makes sense on its own. If a reasonable person would say “this is incomplete” — the chunk is broken.</p><p>You’re using one retrieval method when you need two</p><p>Semantic search is powerful. It also has a specific blind spot that will bite you: it finds conceptually similar text, not necessarily the text that actually answers the question.</p><p>Ask about “connection timeout errors” and you might surface a chunk about “resilience and reliability philosophy” that scores high on embedding similarity. Useful context, maybe. The actual fix, no.</p><p>BM25 — old-school keyword search — doesn’t have this problem. It’s precise on exact terms. But it misses paraphrases, synonyms, anything phrased differently from what’s in the document.</p><p>Neither alone is sufficient. Run both, merge the results.</p><p>Reciprocal Rank Fusion handles the merge — it re-ranks by combined position, which sidesteps the problem that the two methods produce scores that can’t be directly compared.</p><p>This one change closes 20–40% of recall gaps with zero changes to your documents or your model.</p><p>The pipeline has no idea when it’s failing</p><p>This is the quiet killer. Standard RAG: retrieve top-K, stuff into prompt, generate. If none of those K chunks actually contain the answer, the LLM either makes something up or says it doesn’t know. The pipeline produces output either way. It never flags that retrieval failed.</p><p>You find out from a support ticket two weeks later.</p><p>The fix is a coverage check between retrieval and generation — a quick LLM call that scores how well the retrieved chunks actually answer the query.</p><p>If that score is below 0.7, don’t generate — rewrite the query and retrieve again. Give it three attempts before falling back.</p><p>This one loop eliminates most “I don’t know” answers that weren’t actually knowledge gaps. They were retrieval failures that looked like knowledge gaps.</p><p>Your documents are going stale and your index doesn’t know it</p><p>A chunk from 18 months ago is still in your index. Still getting retrieved. Still being served with the same confidence score as something updated last week.</p><p>Procedures change. APIs change. What was true then may be wrong now.</p><p>Track freshness at ingest, not retrieval. Filter on it at retrieval time. When you have to serve a stale result, say so explicitly rather than silently serving it as fact. Users can handle uncertainty. They can’t handle confident misinformation.</p><p>What the minimal fix looks like end to end</p><p>Query<br>↓<br>Hybrid Retrieve (BM25 + semantic → RRF)<br>↓<br>Freshness filter<br>↓<br>Coverage judge<br>├─ ≥0.7 → Generate<br>└─ &lt;0.7 → Rewrite → retry (max 3×) → Generate with warning</p><p>Around 200 lines of Python on top of whatever vector store you already have. Not a rewrite — a wrapper. The difference between a system that erodes trust quietly and one that fails loudly enough to be fixed.</p><p>What this doesn’t solve</p><p>Multi-hop questions — ones that need information chained across several chunks — are a different problem. Single-pass retrieval will always struggle with them. That’s what the next post is about.</p><p>Index quality is also out of scope here. If wrong information is in your source documents, the retrieval layer can’t save you. That’s a governance problem, not an architecture problem.</p><p>If you’re hitting any of these in production, drop a comment — always curious what the failure mode looks like in the wild.</p><p>Next: When one retrieval pass isn’t enough — building the loop that judges its own answers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a49bcb3310b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>