<?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 Srini Majji on Medium]]></title>
        <description><![CDATA[Stories by Srini Majji on Medium]]></description>
        <link>https://medium.com/@srinumajji_45317?source=rss-cbee9251b075------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*R7H5IsAPBKXqUqnA</url>
            <title>Stories by Srini Majji on Medium</title>
            <link>https://medium.com/@srinumajji_45317?source=rss-cbee9251b075------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 19:47:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@srinumajji_45317/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[Engineering a High-Precision Local RAG: An Architectural Deep Dive]]></title>
            <link>https://medium.com/@srinumajji_45317/engineering-a-high-precision-local-rag-an-architectural-deep-dive-bdc14346483b?source=rss-cbee9251b075------2</link>
            <guid isPermaLink="false">https://medium.com/p/bdc14346483b</guid>
            <category><![CDATA[ollama]]></category>
            <category><![CDATA[local-llm]]></category>
            <category><![CDATA[ai-architecture]]></category>
            <category><![CDATA[rags]]></category>
            <category><![CDATA[finops]]></category>
            <dc:creator><![CDATA[Srini Majji]]></dc:creator>
            <pubDate>Wed, 13 May 2026 04:41:34 GMT</pubDate>
            <atom:updated>2026-05-13T05:48:07.769Z</atom:updated>
            <content:encoded><![CDATA[<p>Moving beyond ‘it works’ to a measurable, faithful, and cost-effective retrieval pipeline on Apple Silicon</p><figure><img alt="A technical architecture diagram comparing ‘naive Retrieval’ versus a “High-Precision RAG Pipeline.” The naive side shows a disorganized data mess leading to a chaotic answer. The high-precision side illustrates a structured workflow including PDF ingestion, strategic chunking with overlap, ChromaDB storage, and an Evaluative Retrieval phase combining BM25 keyword search and Vector search through a Cross-Encoder Re-ranker. It concludes with a Generation phase using an Ollama-hosted LLM and a RAG" src="https://cdn-images-1.medium.com/max/1024/1*l_Y50CYjqPUHuAjJ6i1_XA.png" /></figure><h3>The Thesis: Moving Beyond “It Works”</h3><p>In this project, <strong>I set out to solve the precision problem in local RAG.</strong> While building a basic retrieval loop is straightforward, moving a system into production requires a level of grounding and reliability that naive implementations often miss.</p><p>In the current AI landscape, most developers stop once they see a chatbot respond. As architects, we stop when the system is <strong>measurable and faithful</strong>. This article breaks down a multi-stage RAG pipeline built to solve the most common “Day 2” problem in AI: <strong>Grounding</strong>. Our goal was a system that is 100% local (privacy), hybrid (precision), and audited (faithfulness).</p><h3>Ingestion Strategy: Recursive Chunking &amp; Semantic Bridges</h3><p>The first architectural hurdle is the <strong>Context Window vs. Information Density</strong> trade-off. We avoided naive character splitting in favor of a <strong>Recursive Character Text Splitter</strong>.</p><ul><li><strong>The Configuration:</strong> 800-token chunks with a 100-token overlap.</li><li><strong>The Logic:</strong> 800 tokens allow the LLM to ingest entire technical blocks (like monorepo migration commands) without losing structural context.</li><li><strong>The Bridge:</strong> The 100-token overlap ensures that if a critical detail is split at a boundary, the semantic “shadow” is preserved in the next chunk, preventing the retriever from missing content that spans across files.</li><li><strong>Vector Store:</strong> We utilized <strong>ChromaDB</strong> for its local persistence, enabling a zero-cost, zero-latency vector storage layer.</li></ul><h3>The Retrieval Engine: Hybrid Search &amp; Cross-Encoder Re-ranking</h3><p>Standard “Dense Retrieval” (Vector Search) is great for concepts but often fails on technical queries containing specific keywords like “Prisma” or “NestJS.”</p><ul><li><strong>The Hybrid Pattern:</strong> We combined <strong>Dense Vector Search</strong> (using nomic-embed-text) with <strong>Sparse Keyword Search (BM25)</strong>. This creates a safety net for exact-match terminology.</li><li><strong>The Re-ranking Node:</strong> To optimize the prompt’s signal-to-noise ratio, we pull a broad pool of 10 candidates and pass them through a <strong>Cross-Encoder</strong> (comparing local <strong>Sentence-Transformers</strong> vs. <strong>Cohere Rerank v3.5</strong>).</li><li><strong>Architect’s Note:</strong> Our benchmarks on an M1 Max (64GB RAM) showed local re-ranking latency at approximately <strong>0.16s</strong>, making it a viable production alternative to hosted APIs for technical documentation.</li></ul><h3>Generation Guardrails: Negative Constraint Enforcement</h3><p>The primary risk in RAG is the “Helpful Hallucination.” To prevent the model (<strong>Gemma 4:e4b via Ollama</strong>) from answering based on its training weights rather than the provided context, we implemented <strong>Strict Grounding</strong>.</p><ul><li><strong>Prompt Pattern:</strong> We utilized a “Negative Constraint” instruction, forcing the model to return a specific DATA_MISSING token if the retrieved context is insufficient.</li><li><strong>Citation Tracking:</strong> By mapping metadata directly from the ChromaDB results, we enforced <strong>Source Attribution</strong> (e.g., “See Page 16”), creating a verifiable paper trail for every generated claim.</li></ul><h3>The Measurement Layer: Measuring Faithfulness (The Ragas Approach)</h3><p>A production-grade system must be self-evaluating. We implemented a “Mini-RAGS” loop where the LLM acts as a “Judge” for its own output.</p><ul><li><strong>Metric:</strong> <strong>Faithfulness</strong>. The model evaluates if its response is 100% derived from the context.</li><li><strong>The “False Negative” Catch:</strong> During testing, a k = 3 retrieval triggered a guardrail incorrectly. By increasing the retrieval depth to k = 5, we achieved a <strong>10/10 Faithfulness Score</strong>, balancing system sensitivity with grounding.</li></ul><h3>Automation: The RAG Test Suite</h3><p>Finally, we treated the RAG pipeline like a software binary. We built a <strong>Regression Test Suite</strong> to automate the evaluation of:</p><ol><li><strong>Recall:</strong> Valid technical queries.</li><li><strong>Safety:</strong> Out-of-context “Cake Test” queries (e.g., “How do I bake a cake?”) to ensure the guardrails never fail.</li></ol><h3>Conclusion: The Pipeline is the Product</h3><p>The true value of RAG isn’t the LLM — it’s the <strong>engineering of the pipeline</strong>. By focusing on local execution, hybrid retrieval, and measurable faithfulness, we move AI from a “toy” to a reliable enterprise tool.</p><h4><strong>Technical Stack Summary:</strong></h4><ul><li><strong>Inference:</strong> Ollama (Gemma 4:e4b)</li><li><strong>Orchestration:</strong> LangChain</li><li><strong>Embeddings:</strong> Nomic-Embed-Text</li><li><strong>Vector DB:</strong> Chroma</li><li><strong>Re-ranking:</strong> Cohere v3.5 &amp; Local MiniLM</li><li><strong>Environment:</strong> Python 3.12 / macOS M1 Max</li></ul><h3>DISCLAIMER &amp; CONTEXT</h3><p>The architectural patterns and benchmarks shared here are based on <strong>Gemma 4:e4b</strong> and <strong>nomic-embed-text</strong> running locally on a <strong>macOS M1 Max (64GB RAM)</strong> via <strong>Ollama</strong>.</p><p>While these principles (Hybrid Search, Re-ranking, and Faithfulness scoring) are model-agnostic, your results may vary depending on:</p><ul><li><strong>Model Choice:</strong> Larger frontier models (e.g., Llama 3 70B) may offer higher reasoning capabilities but at a higher latency cost on local hardware.</li><li><strong>Document Density:</strong> High-precision RAG is highly sensitive to the quality and structure of the source PDFs.</li><li><strong>Hardware:</strong> Performance benchmarks specifically reflect Apple Silicon’s unified memory architecture.</li></ul><p>This project is a technical exploration of local-first AI, it is not intended as a replacement for managed enterprise RAG solutions with different scale requirements.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bdc14346483b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Tested the “Free Claude Code with Local Models” — Here’s What Really Happens]]></title>
            <link>https://medium.com/@srinumajji_45317/i-tested-the-free-claude-code-with-local-models-heres-what-really-happens-f8bcb98650bd?source=rss-cbee9251b075------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8bcb98650bd</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[localai]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[claude]]></category>
            <dc:creator><![CDATA[Srini Majji]]></dc:creator>
            <pubDate>Sun, 03 May 2026 01:09:02 GMT</pubDate>
            <atom:updated>2026-05-03T01:09:02.142Z</atom:updated>
            <content:encoded><![CDATA[<p><em>The internet says you can run Claude Code for free using local models. I tested it hands-on so you don’t have to.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PjTVv5DygWg9JgiOjO9POw.png" /></figure><p>If you’ve spent any time on YouTube or Medium lately, you’ve probably come across videos and articles claiming you can use Claude Code completely free by swapping in a local model like Gemma or Qwen. The thumbnails are catchy. The demos look convincing. And the comment sections are full of people saying “this changed everything.”</p><p>I’m a hands-on person. I don’t take things at face value. So I tested it myself and I want to share what I actually found, because the community deserves an honest account.</p><h3>The Setup</h3><p>I’ve been using Claude Code with my claude.ai subscription for several months. It’s become a core part of how I work to debugging complex issues, building features, navigating large codebases. I know what good looks like.</p><p>I also run local models on my machine. I have Ollama installed with three models:<br>- <strong>Gemma4:e4b</strong> (9.6 GB — Google’s latest)<br>- <strong>Qwen2.5:7b</strong> (4.7 GB)<br>- <strong>Hermes3</strong> (4.7 GB)</p><p>The setup these videos recommend involves running a tool called <strong>LiteLLM</strong> as a proxy between Claude Code and your local Ollama model. The idea is that LiteLLM translates Claude Code’s API calls into a format your local model understands. On paper, it sounds clever.</p><p>Here’s what actually happened.</p><h4>Test 1: Gemma4 through Claude Code</h4><p>After getting the proxy running (which itself required troubleshooting missing dependencies and unsupported parameters), I typed a simple question:</p><blockquote>&gt; “Which model are you using?”</blockquote><p>After 40 seconds of processing, this was the response:</p><blockquote>```<br>{“response”: “I am Claude Code, an interactive agent developed by Anthropic.<br>My underlying model is powered by the gemma4:e4b model…”}<br>```</blockquote><p>JSON. Not natural language. A structured object where a conversational reply should be.</p><p>I asked it to respond more naturally. Another 37 seconds. Same thing — JSON again.</p><h4>Test 2: Qwen2.5 through Claude Code</h4><p>I switched to Qwen. I typed:</p><blockquote>&gt; “hello”</blockquote><p>After over a minute, it responded by trying to call a tool to read a memory file from my filesystem. It didn’t say hello. It tried to perform an agent action in response to a greeting.</p><h3>Why This Happens, The Real Explanation</h3><p>Claude Code is not a chat interface with a model swapped in. It is a deeply integrated <strong>agentic system</strong> built specifically around Claude’s behavior. When you open Claude Code, it sends a carefully engineered system prompt that instructs the model on how to:</p><ul><li>Use tools (file read/write, bash commands, search)</li><li>Manage multi-step reasoning</li><li>Format responses for the interface to parse</li><li>Handle memory, context, and project state</li></ul><p>This entire system was designed and tuned for <strong>Claude models</strong>. When you swap in Gemma or Qwen, the model receives instructions it wasn’t trained to follow in that specific way. The result:</p><ul><li>Gemma wraps everything in JSON</li><li>Qwen tries to execute tool calls instead of responding naturally</li><li>Neither model reliably completes real coding tasks</li></ul><p>The YouTube demos work because they show simple, cherry-picked prompts in a controlled setting. They don’t show you a 40-second wait for a JSON-formatted hello. They don’t show tool call failures on a simple greeting. They don’t show what happens when you ask it to debug a real bug across multiple files.</p><h3>What Local Models Are Actually Good For</h3><p>I want to be clear that I am not dismissing local models. They are genuinely useful, just for different purposes:</p><ul><li><strong>Privacy-sensitive tasks</strong> where you don’t want data leaving your machine</li><li><strong>Offline work</strong> when you don’t have internet access</li><li><strong>Quick chat and explanations</strong> : run “<em>ollama run gemma4:e4b</em>” directly for clean, natural responses</li><li><strong>Experimenting and learning</strong> about AI models</li><li><strong>Simple, self-contained code snippets</strong> in a dedicated local tool</li></ul><p>The right interface for local models is <strong>Ollama CLI</strong>, <strong>Open WebUI</strong>, or <strong>LM Studio</strong> tools designed for them. Not Claude Code.</p><h3>The Honest Comparison</h3><p>After months of using Claude Code with Sonnet for real software engineering work, and then testing local models through the same interface, the gap is not subtle. It’s enormous.</p><p>Claude Code with Sonnet:<br>- Understands multi-file context<br>- Executes complex multi-step tasks reliably<br>- Reasons about architecture and tradeoffs<br>- Responds in seconds with accurate, actionable output</p><p>Local model through Claude Code proxy:<br>- JSON-formatted responses<br>- Tool call confusion on basic input<br>- 40–60 second response times<br>- Unreliable behavior on anything beyond trivial prompts</p><h3>The Bottom Line</h3><p>The “free Claude Code with local models” trick is not a trick, it’s a misunderstanding of how Claude Code works. You’re not getting Claude Code for free. You’re getting a broken experience that happens to share the same interface.</p><p>If you’re serious about software engineering productivity, your Claude subscription is worth it. If you want to use local models, use them with the right tools and they will serve you well for the right jobs.</p><p>Test things yourself. That’s the only way to know what’s real.</p><p><em>Have you tested local models with Claude Code? What was your experience? Share in the comments.</em></p><p><strong>DISCLAIMER</strong></p><p><em>My findings are based on Gemma4:e4b and Qwen2.5:7b running on my local machine. Larger, more capable models may behave differently. However, the fundamental mismatch between Claude Code’s agentic system prompt and non-Claude models remains a structural limitation regardless of model size. There is also no official claim from Anthropic that any local model is compatible with Claude Code</em>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8bcb98650bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Real Cost of AI Agents: My $20/Day Wake-Up Call and How I Fixed It]]></title>
            <link>https://medium.com/@srinumajji_45317/the-real-cost-of-ai-agents-my-20-day-wake-up-call-and-how-i-fixed-it-aeaf51ea4388?source=rss-cbee9251b075------2</link>
            <guid isPermaLink="false">https://medium.com/p/aeaf51ea4388</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[finops]]></category>
            <category><![CDATA[hermes-agent]]></category>
            <category><![CDATA[ai-agents-in-action]]></category>
            <category><![CDATA[cost-optimization]]></category>
            <dc:creator><![CDATA[Srini Majji]]></dc:creator>
            <pubDate>Mon, 27 Apr 2026 20:40:52 GMT</pubDate>
            <atom:updated>2026-04-27T20:40:52.380Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>What nobody tells you about running AI agents in production — and the FinOps lessons I learned the hard way</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MxGkXQXTVjGDzG-0QdSdZg.png" /></figure><p>A few weeks ago I published an article about building 60 hands-on lessons across 5 agentic AI frameworks, LangGraph, CrewAI, Semantic Kernel, Google ADK, and the OpenAI Agents SDK. The response was incredible. Thousands of developers found it useful. You can find the full open-source repository here: <a href="https://github.com/vasumai/agentic-learnings"><strong>https://github.com/vasumai/agentic-learnings</strong></a></p><p>That article was about <em>learning</em> agent frameworks. This one is about the part nobody writes about: <strong>what happens when you actually run them.</strong></p><p>Specifically, how I went from a $0 experiment to a shocking bill in under 48 hours, what caused it, what I tried to fix it (including a failed attempt at going fully local), and what actually worked.</p><p>If you are a technical leader evaluating AI agents for your organization, or a developer moving from experimentation to real workloads, this article is for you.</p><h4><strong>My Journey Into Personal AI Assistants</strong></h4><p>Before Hermes, I started with <strong>OpenClaw, </strong>another powerful open-source personal AI assistant. I set it up on a Railway VPS, connected it to Telegram, and automated my morning briefing, email alerts, and stock watchlist. I even published a short article about it, promising a detailed follow-up.</p><p>Then Hermes Agent appeared with100,000+ GitHub stars in weeks. The community was electric. Having already spent 100+ hours with OpenClaw, I wanted to understand this new contender firsthand. My eventual goal is a full comparison article: OpenClaw vs Hermes Agent: two different philosophies for the same problem.</p><p>But before that comparison can be written honestly, I had to understand Hermes deeply. Including its costs. This article is that honest account.</p><h4><strong>The Setup: Hermes Agent as My Personal AI Assistant</strong></h4><p>After completing my framework curriculum, I wanted a personal AI assistant that could:</p><ul><li>Check my email and send me a morning brief</li><li>Monitor system health</li><li>Remember my preferences across sessions</li><li>Run scheduled tasks automatically</li></ul><p>I chose <strong>Hermes Agent</strong> by NousResearch, an open-source self-hosted agent framework that recently crossed 116,000 GitHub stars. It supports multi-platform integrations (Telegram, WhatsApp, Discord), persistent memory, web browsing, file access, and cron job scheduling. Essentially a personal AI operating system.</p><p>I set it up on a MacBook Air, configured it with <strong>Claude Sonnet</strong> as the backend, and started testing.</p><p>The results were impressive. The experience was smooth. The bill was not.</p><h4><strong>The Wake-Up Call</strong></h4><p>Here is my exact cost timeline — every number real, nothing rounded:</p><pre>March 2026 (full month): $0.00 - not using Hermes yet<br>April 1–22, 2026: $0.00 - still not active<br>April 23 evening (after 6pm): First session with Gemini Flash<br>April 24 (full day): Peaked - 3 cron jobs + active sessions running<br>April 25 (partial day): ~$1.30 - stopped when I saw the trend<br>Total across 3 active days: $12.59 - approximately $5–6/day at peak</pre><p>I started on the evening of April 23rd. By April 24th, one full day of active use with three cron jobs running and the bill had peaked. I stopped on April 25th when I realized what was happening.</p><p><strong>$5–6/day for personal use. $150–180/month. For a personal assistant.</strong></p><p>My first reaction was that I had misconfigured something. My second reaction, after digging in, was that I had completely misunderstood how AI agents consume tokens.</p><p>For context, I had previously tested with Claude Sonnet, which hit over $20 in a single day before I switched to Gemini Flash. Gemini Flash was cheaper per token but the underlying problem remained the same.</p><h4><strong>Why AI Agents Are Expensive: The Context Bloat Problem</strong></h4><p>With a regular ChatGPT conversation, you send a message and get a reply. The cost is roughly proportional to the length of your conversation.</p><p>AI agents work completely differently. <strong>Every single turn sends the entire accumulated context to the model.</strong> This includes:</p><ul><li>The full system prompt (often 2,000–5,000 tokens)</li><li>All memory and user preferences</li><li>The complete conversation history</li><li>All available tool schemas</li><li>Any background task results</li></ul><p>Now add cron jobs. My setup was checking email every hour, running a morning brief, and sending system health alerts. That is 24+ agent invocations per day, each one loading the full context. Even during the night when I was sleeping.</p><p>Here is the math:</p><pre><em>24 cron invocations/day<br>× 10,000 tokens per invocation (context + response)<br>= 240,000 tokens/day from cron alone<br>Plus active conversations: another 100,000+ tokens<br>Total: 340,000+ tokens/day</em></pre><p>My actual Gemini billing breakdown confirmed this precisely:</p><pre><em>Input tokens (uncached): 18.3 million — $9.16<br>Input tokens (cached): 43.3 million — $2.17<br>Output tokens: 420,000 — $1.26<br>Total: 62 million tokens — $12.59</em></pre><p>Notice the output: only 420K tokens vs 62M input tokens. <strong>Agents are almost entirely an input cost problem.</strong> And the uncached input at $9.16 is where the money goes, that is the accumulated conversation history resent on every turn.</p><p>The per-token cost was not the problem. The <strong>volume</strong> was the problem.</p><h4><strong>My Attempts to Fix It: An Honest Account</strong></h4><p><strong>Attempt 1: Switch to a Cheaper Model</strong></p><p>Before Gemini, I tried <strong>Claude Sonnet, </strong>excellent tool calling, smooth experience, over $20 in a single day. Then <strong>OpenAI GPT-4o-mini, </strong>cost dropped but I hit the 30,000 TPM (tokens per minute) rate limit. Cron jobs started failing. Active conversations were throttled.</p><p><strong>Result:</strong> Rate limits made it unreliable for agent workloads.</p><p><strong>Attempt 2: Gemini Flash</strong></p><p>On community recommendation I switched to Gemini 2.0 Flash, one of the cheapest capable models at $0.075 per million input tokens. The cost dropped. But still $5–6/day on active days.</p><p><strong>The problem was still context bloat, not model pricing.</strong></p><p><strong>Attempt 3: Go Fully Local (The Expensive Lesson)</strong></p><p>This is where it gets interesting and where I learned something the community rarely discusses honestly.</p><p>My thinking was simple: if I run the model locally on my M1 Max 64GB MacBook, the cost is literally zero. No API. No billing. No surprise charges.</p><p>I set up Hermes Agent in Docker, pointed it at Ollama running locally, and tested every model I could find:</p><p><strong>llama3.1:8b: </strong>Fast. Good for Q&amp;A. But when Hermes Agent tried to call memory tools, it output raw JSON text describing what it would do rather than actually executing the tool call. Memory was never saved.</p><p><strong>qwen2.5:7b: </strong>Same problem. The model acknowledged instructions but could not reliably execute structured function calls.</p><p><strong>qwen2.5:14b: </strong>Better quality responses, but 1 minute 21 seconds to answer “How are you?” Unusable for an assistant.</p><p><strong>hermes3: </strong>NousResearch makes both the Hermes Agent framework AND a model called hermes3. I assumed they were designed to work together. I was wrong.</p><p>The framework itself displayed this warning at startup:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*DQ1EdPxGQUAkJLfwe6Qpbg.png" /><figcaption><em>(Screenshot of this warning is included above)</em></figcaption></figure><p>&gt; <em>”Nous Research Hermes 3 &amp; 4 models are NOT agentic and are not designed for use with Hermes Agent. They lack tool-calling capabilities required for agent workflows. Consider using an agentic model (Claude, GPT, Gemini, DeepSeek, etc.)”</em></p><p>That warning is the most honest sentence I have read from any AI tool.</p><p><strong>The hard truth:</strong> Hermes Agent requires cloud models with proper function calling APIs. Local models regardless of size do not reliably execute the complex multi-step tool orchestration that agent frameworks depend on. This is a fundamental limitation of current open-weight models, not a configuration problem.</p><p>The community is not talking about this clearly enough.</p><h4><strong>What Actually Fixed It: Three Config Changes</strong></h4><p>After accepting that I needed a cloud model, I went back to Gemini Flash and fixed the real problem: token volume. Three changes will cut my daily cost by over 80%. I am applying them now, but the root causes are clear from the data.</p><p><strong>Fix 1: Session Reset (The Biggest Win)</strong></p><p>My Hermes config had this setting:</p><pre>session_reset:<br>idle_minutes: 1440 # 24 hours!</pre><p>This meant the context window accumulated for an entire day without ever resetting. Every single message including every cron job invocation sent 24 hours of accumulated conversation history to the model.</p><p>Change it to:</p><pre>session_reset:<br>idle_minutes: 30 # reset after 30 minutes of inactivity<br>at_hour: 4 # full daily reset at 4am</pre><p><strong>Estimated impact: 60–70% cost reduction on its own.</strong></p><p><strong>Fix 2: Aggressive Compression</strong></p><pre>compression:<br>  enabled: true<br>  threshold: 0.3 # was 0.5 - compress earlier<br>  target_ratio: 0.1 # was 0.2 - compress more aggressively<br>  protect_last_n: 5 # was 20 - keep fewer recent messages uncompressed</pre><p><strong>Fix 3: Cron Job Frequency</strong></p><p>Audit every scheduled task ruthlessly:</p><ul><li>Email check: hourly → 3 times per day</li><li>Morning brief: once daily (keep)</li><li>System health: every 2 hours → twice daily</li><li>Remove any cron job you do not actively use</li></ul><h4><strong>Three Operational Discoveries Nobody Writes About</strong></h4><p>After the config fixes, I kept monitoring closely. The next 24 hours taught me three things that no article or YouTube video had prepared me for.</p><p><strong>Discovery 1: “Sure, go ahead” cost me 23 API calls</strong></p><p>I named my Hermes agent <strong>Hanuman</strong> after the devoted, capable assistant from Hindu mythology. Fitting for a personal AI that remembers everything and works tirelessly.</p><p>One evening, Hanuman proposed a plan: run a billing diagnostic and update memory to reflect my cost-monitoring mission. I replied: <em>”Sure, do the check and let me know.”</em></p><p>The log showed 23 API calls and 60 seconds of processing for that one message.</p><p>Here is what Hanuman actually did:</p><ul><li>Looked up the billing-diagnostics skill (2 calls)</li><li>Ran 3 Python diagnostic scripts (3 calls)</li><li>Added a new memory entry (1 call)</li><li>Deleted an old memory entry (1 call)</li><li>Updated 3 existing memory entries (3 calls)</li><li>Re-added the same entry 3 more times in a consolidation loop (9 calls)</li><li>Ran auxiliary auto-detect and vision checks (2 calls)</li></ul><p><strong>Total: 23 API calls. Approximately $0.07 for one casual approval.</strong></p><p>The lesson: vague approvals trigger broad autonomous action. <em>”Sure, go ahead”</em> to an AI agent means something very different than it does to a colleague. Always scope your approvals explicitly: <em>”Do step 1 only. Nothing else.”</em></p><p><strong>Discovery 2: The agent cannot accurately estimate its own costs</strong></p><p>After the diagnostic, Hanuman reported:</p><p>&gt; <em>”At Gemini 1.5 Flash rates, $0.60 covers roughly 6 million input tokens”</em></p><p>Two problems with this statement:</p><p>1. It referenced <strong>Gemini 1.5 Flash</strong> pricing, but I was running <strong>Gemini Flash Latest</strong> — different model, different pricing</p><p>2. Its internal `estimated_cost_usd` field showed <strong>$0 </strong>the cost tracking module had no valid pricing data for the current model</p><p>My actual bill showed 62 million tokens for $12.59. Hanuman’s estimate was off by an order of magnitude.</p><p><strong>Never trust the agent’s self-reported cost estimates. Always verify in your cloud provider’s billing console.</strong> The agent is blind to its own true costs.</p><p><strong>Discovery 3: Asking the agent to monitor costs makes it cost more</strong></p><p>I told Hanuman to <em>”note the estimated spend impact of significant operations”</em> and keep it in memory as a policy.</p><p>Hanuman dutifully added this as a core Action Policy. From that point, every single response included a cost estimate paragraph adding output tokens to every turn. The monitoring itself was increasing the cost it was monitoring.</p><p>I had created a feedback loop. The fix: remove the policy and monitor costs exclusively in the cloud console.</p><h4><strong>The FinOps Framework for AI Agents</strong></h4><p>This experience taught me that AI agent cost optimization is an emerging discipline — and the principles map directly to cloud FinOps:</p><p><strong>1. Measure before you optimize</strong></p><p>I did not know my token consumption until I saw the bill climbing. Set up daily spend alerts at a low threshold ($1/day) before you configure cron jobs or long-running sessions. In Google AI Studio: Billing → Budgets &amp; Alerts → set $2/day hard limit.</p><p><strong>2. Context is your biggest cost driver — not model pricing</strong></p><p>Everyone compares model prices per million tokens. Almost nobody measures how many tokens their agent actually sends per turn. My bill showed 62M tokens in 3 days from a personal assistant with 3 cron jobs. Instrument this first.</p><p><strong>3. Background tasks multiply costs invisibly</strong></p><p>Cron jobs run while you sleep. Each one loads the full context. A task running 24 times per day at 10K tokens each costs as much as a long active conversation every single day.</p><p><strong>4. Session boundaries matter</strong></p><p>Letting context accumulate for 24 hours is the equivalent of leaving a cloud instance running when it is not needed. The default “<em>idle_minutes: 1440</em>” in Hermes is a cost trap for anyone who does not know to change it. Reset sessions aggressively.</p><p><strong>5. Local models are not free — they have a different cost</strong></p><p>The compute cost is zero but the reliability cost is real. If your agent cannot execute tool calls reliably, it is not actually doing its job. For complex agent workloads today, local models introduce a reliability debt that often exceeds the financial savings.</p><p><strong>6. Output tokens are almost irrelevant for agents</strong></p><p>My bill: 62M input tokens vs 420K output tokens. Optimizing output is pointless. Every agent cost conversation should be about input volume.</p><p><strong>7. Agent autonomy has a direct price tag</strong></p><p>The more capable and proactive your agent, the more it spends on its own initiative. Every autonomous action checking logs, updating memory, running diagnostics generates tool calls that cost money. Design your approval protocols carefully. Scope every instruction explicitly.</p><h4><strong>Current State: What Works</strong></h4><p>After all the experimentation, here is my working setup:</p><p><strong>Local Mac — M1 Max 64GB (zero cost, limited capability):</strong></p><ul><li>Ollama running qwen2.5:7b</li><li>Open WebUI for local Q&amp;A and file chat</li><li>Great for quick questions, file summarization, code help</li><li>Does NOT run Hermes Agent reliably, local models cannot handle complex tool calling</li></ul><p><strong>Cloud laptop — MacBook Air 8GB (optimized cost):</strong></p><ul><li>Hermes Agent with Gemini 2.0 Flash</li><li>Config fixes applied: 30-minute session reset, aggressive compression</li><li>Cron jobs reduced to 3 meaningful tasks per day, max 3x/day each</li><li><strong>Target: $0.20–0.50/day</strong> vs $5–6/day before</li><li>$2/day hard limit set in Google Cloud billing</li></ul><p><strong>For my agentic AI learning (5 framework repo):</strong></p><ul><li>Cloud API with real models — small, justified cost</li><li>Local models for lesson reruns where tool calling is not needed</li></ul><h4><strong>The Broader Lesson for Technical Leaders</strong></h4><p>We are at an early and exciting stage with AI agents. The frameworks are maturing rapidly. The models are improving every few months. The tooling is getting better.</p><p>But the economics are not yet what the demos suggest.</p><p>If you are evaluating AI agents for your organization:</p><p>- <strong>Do not benchmark with a chatbot mindset.</strong> Agents consume tokens differently. Run a 48-hour cost simulation with real cron jobs before committing.</p><p>- <strong>Context management is an engineering problem.</strong> It belongs in your architecture review, not as an afterthought.</p><p>- <strong>Local models are coming.</strong> The gap is closing fast. But for production agent workloads requiring reliable tool calling today, you need cloud APIs.</p><p>- <strong>FinOps for AI is not optional.</strong> Treat LLM API costs like cloud compute — with budgets, alerts, rightsizing, and regular audits.</p><p>- <strong>Set spend limits before you start.</strong> Not after the first bill arrives.</p><p>The good news: once you understand these dynamics, the costs are very manageable. The fixes are simple config changes. The knowledge is what is expensive to acquire which is why I wrote this.</p><h4><strong>Coming Next</strong></h4><p>This article focused on Hermes Agent. I also spent significant time with <strong>OpenClaw</strong> a different approach to the personal AI assistant problem, with stronger chat platform integrations and a different architecture philosophy.</p><p>My next article will be a full honest comparison: <strong>OpenClaw vs Hermes Agent</strong>. Same use cases, same evaluation criteria, real numbers from both. If you found this article useful, follow me here on Medium so you do not miss it.</p><h4><strong>Resources</strong></h4><p>- <a href="https://github.com/vasumai/agentic-learnings"><strong>My 5-framework agentic AI repository (60 lessons, open source)</strong></a></p><p>- <a href="https://github.com/NousResearch/hermes-agent"><strong>Hermes Agent by NousResearch</strong></a></p><p><strong>-</strong><a href="https://openclaw.ai/"><strong>OpenClaw</strong></a></p><p>- <a href="https://ollama.com/"><strong>Ollama</strong></a><strong> (local model runtime)</strong></p><p>- <a href="https://openwebui.com/"><strong>Open WebUI</strong></a><strong> (local ChatGPT alternative)</strong></p><p><em>Srinivas Majji is a technical executive and hands-on architect with experience across agentic AI frameworks, cloud architecture, and enterprise systems. He built 60 working lessons across 5 AI agent frameworks all open source at github.com/vasumai/agentic-learnings.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aeaf51ea4388" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting Up My Personal AI Assistant with OpenClaw]]></title>
            <link>https://medium.com/@srinumajji_45317/setting-up-my-personal-ai-assistant-with-openclaw-f370cd39066e?source=rss-cbee9251b075------2</link>
            <guid isPermaLink="false">https://medium.com/p/f370cd39066e</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[personal-assistant]]></category>
            <category><![CDATA[openclaw]]></category>
            <dc:creator><![CDATA[Srini Majji]]></dc:creator>
            <pubDate>Sun, 19 Apr 2026 01:10:25 GMT</pubDate>
            <atom:updated>2026-04-19T01:10:25.862Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pjfU69KUK7aWMGBLbT_Usg.png" /></figure><p>I wanted a way to automate daily tasks without juggling too many tools, so I set up a personal AI assistant with OpenClaw. OpenClaw is open source and packed with skills like sending me a morning briefing to my Telegram at 7am, alerting me instantly about urgent emails, creating Notion notes straight from Telegram, and even tracking my stock watchlist with fresh web data.</p><p>It feels natural to engage with this assistant, whether by voice or chat, on my phone or desktop. It’s not flawless — Slack setup needed some troubleshooting — but every day it gets more capable thanks to new skills and my ongoing tweaks.</p><p>OpenClaw fits perfectly with my hands-on approach as an AI automation enthusiast who learns by building personal tools. If you want a practical AI helper that evolves with you, give OpenClaw a try.</p><p>Curious how I set all this up? Stay tuned for my next post where I walk through the full setup, what broke, and what I learned building a 24/7 personal AI assistant on the cloud.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f370cd39066e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Learned 5 Agentic AI Frameworks as a Solution Architect — Here’s the Order That Actually Works]]></title>
            <link>https://medium.com/@srinumajji_45317/i-learned-5-agentic-ai-frameworks-as-a-solution-architect-heres-the-order-that-actually-works-8088b0b0305e?source=rss-cbee9251b075------2</link>
            <guid isPermaLink="false">https://medium.com/p/8088b0b0305e</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[langgraph]]></category>
            <dc:creator><![CDATA[Srini Majji]]></dc:creator>
            <pubDate>Mon, 06 Apr 2026 06:30:19 GMT</pubDate>
            <atom:updated>2026-04-06T06:51:16.038Z</atom:updated>
            <content:encoded><![CDATA[<p><em>By Srinivas Majji — Distinguished Architect | AI &amp; Consumer Platform Leader</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ehyiRug32lJWhWKtC7y1yg.png" /></figure><p>After 20+ years architecting large-scale platforms at various engineering organizations including Walmart and Kroger, I decided to go hands-on with Agentic AI — not just read about it, not just watch demos, but actually build with it.</p><p>The result: 60 lessons across 5 frameworks, 12 use cases each, all from scratch.</p><p>This post shares what I learned, the order I’d recommend, and the one comparison table that will save you weeks of confusion.</p><h4>Why I Did This</h4><p>At Kroger, I took the initiative to identify a couple of talented Solution Architects on my team who shared the same curiosity and drive. Together, we built an early prototype of a shopping agent using LangChain and CrewAI with an MCP server — one of the first working agentic AI models in our space. While other teams across the organization were exploring AI in their own ways, our initiative stood out for moving quickly from idea to a working prototype. That experience laid the foundation for what grew into a dedicated Agentic AI Engineering team focused on customer and associate experiences.</p><p>I wanted to go deeper personally — to understand each framework hands-on, not just lead from a distance. As an architect, I believe you cannot make sound technology decisions about tools you have not touched yourself.</p><p>So I built a public learning repository: <a href="https://github.com/vasumai/agentic-learnings"><strong><em>github.com/vasumai/agentic-learnings</em></strong></a></p><p>Five frameworks. 12 lessons each. Simple to Advanced to Capstone. Every concept in its own file.</p><h4>The Learning Sequence That Changed How I Think About Agents</h4><p>Most tutorials throw you into a framework without context. Here’s the sequence I discovered actually works — each framework builds a mental model you need for the next one:</p><pre>LangGraph → CrewAI → Semantic Kernel → Google ADK → OpenAI Agents SDK<br>(how)        (who)    (enterprise)   (Gemini-native) (handoff-native)</pre><p>This isn’t arbitrary. Let me explain why.</p><h4>Framework 1: LangGraph — Learn the Mechanics First</h4><p><strong>Mental model: HOW agents work</strong></p><p>LangGraph forces you to build agents from first principles — state machines, edges, routing, checkpointing. There is no magic here. You define every node, every transition.</p><p>This is exactly where you should start. Once you understand that an agent is fundamentally a loop with state and conditional routing, every other framework makes sense.</p><h4>Key lessons that changed my thinking:</h4><p>Lesson 4: Human-in-the-loop — pause, approve, reject. This is critical for enterprise use.<br>Lesson 8: Parallel execution — the Send API unlocks real performance patterns.<br>Lesson 11: End-to-end production agent capstone — where it all comes together.</p><p><strong>Best for</strong>: Stateful graph pipelines, when you need full control over agent behavior.</p><h4>Framework 2: CrewAI — The Team Metaphor</h4><p><strong>Mental model: WHO does what</strong></p><p>After LangGraph, CrewAI feels like a breath of fresh air. Instead of building state machines, you define agents with roles, goals, and backstories — like assembling a team.</p><p>The role-based metaphor is powerful for non-technical stakeholders too. “We have a Researcher agent, a Writer agent, and an Editor agent” is something a business leader understands immediately.</p><h4>Key lessons that changed my thinking:</h4><p>Lesson 5: Hierarchical crew — a Manager agent that dynamically delegates.<br>Lesson 8: Memory across runs — agents that actually remember.<br>Lesson 12: Real-world pipeline capstone — live APIs, structured output, memory, all together.</p><p><strong>Best for</strong>: Role-based agent teams, content pipelines, research workflows.</p><h4>Framework 3: Semantic Kernel — The Enterprise Standard</h4><p><strong>Mental model: WHAT enterprise AI architecture looks like</strong></p><p>Microsoft’s Semantic Kernel is the most structured framework in this list. Plugin architecture, prompt templates, memory stores, filters as middleware. If you’ve worked in enterprise software, this feels familiar — and intentionally so.</p><p>The plugin model is brilliant for enterprise contexts where different teams own different capabilities. Each team builds a plugin; the kernel orchestrates them.</p><h4>Key lessons that changed my thinking:</h4><p>Lesson 7: Filters and Middleware — the closest thing to proper middleware I’ve seen in AI frameworks.<br>Lesson 10: Human-in-the-Loop with risk tiers and audit log — this is production-grade.<br>Lesson 11: MCP Integration — the future of tool connectivity.</p><p><strong>Best for</strong>: Enterprise production applications, Microsoft and Azure stack, teams that need governance and structure.</p><h4>Framework 4: Google ADK — Orchestration Primitives Done Right</h4><p><strong>Mental model: Gemini-native structured orchestration</strong></p><p>Google ADK introduced something I hadn’t seen cleanly expressed elsewhere — first-class orchestration primitives: SequentialAgent, ParallelAgent, LoopAgent. Instead of building these patterns yourself, ADK gives them to you.</p><p>The callback system is ADK’s middleware layer — hooks before and after every agent, model call, and tool execution. For an architect who thinks in observability and control planes, this is exactly right.</p><h4>Key lessons that changed my thinking:</h4><p>Lesson 7: SequentialAgent — Research to Analysis to Summary pipeline in minutes.<br>Lesson 8: ParallelAgent — concurrent fan-out with a merger agent.<br>Lesson 12: Capstone — MCP, parallel analysis, structured output, and HITL combined.</p><p>Note: Enable billing on Google Cloud before starting — the free tier has a 20 requests per day hard cap that will stop you mid-lesson.</p><p><strong>Best for</strong>: Gemini-native pipelines, structured multi-agent orchestration, teams already in Google Cloud.</p><h4>Framework 5: OpenAI Agents SDK — The Clean Architecture</h4><p><strong>Mental model: Handoff-native, minimal boilerplate</strong></p><p>After building with four frameworks, OpenAI Agents SDK feels refreshingly minimal. The core concept — handoffs — is first-class, not an afterthought. One agent hands off to another with a single function call. That’s it.</p><p>Built-in guardrails (input and output) are the standout feature here. In every other framework, guardrails are something you build yourself. Here they’re native decorators.</p><h4>Key lessons that changed my thinking:</h4><p>Lesson 3: Handoffs — the cleanest agent-to-agent delegation I’ve seen.<br>Lesson 7: Guardrails — input and output guardrails as first-class citizens.<br>Lesson 12: Capstone — AI customer support platform with triage, HITL, guardrails, MCP, and streaming.</p><p><strong>Best for</strong>: Clean multi-agent pipelines, when you want minimal boilerplate and first-class handoffs.</p><h4>My Honest Take as an Architect</h4><p>Start with LangGraph and CrewAI — no debate. If you are a developer-minded engineer new to agentic AI, these two are your entry point. LangGraph teaches you the mechanics with no abstraction hiding what is happening. CrewAI immediately makes you productive with the role-based team metaphor. Between the two, you will go from zero to genuinely understanding how agents work in a weekend.</p><p>For enterprise production: Semantic Kernel wins. This is not even close if you are building for a large organization. The plugin architecture, middleware filters, memory stores, and structured prompt templates map directly to how enterprise engineering teams operate. If you are building AI capabilities that need governance, auditability, and team ownership boundaries, Semantic Kernel is the right foundation.</p><p>Google ADK is the right choice if you are already on Google Cloud or building Gemini-native pipelines. The orchestration primitives are the most elegant I have used. Just enable billing before you start.</p><p>OpenAI Agents SDK is for when you want the cleanest, most minimal code. The handoff-native design and built-in guardrails are genuinely impressive. Great for rapid prototyping and clean multi-agent pipelines.</p><h4>The Repo Is Public — Use It</h4><p>Every lesson is in its own Python file. Each framework has its own README, requirements.txt, and environment setup. You can start with Lesson 1 and run it in minutes.</p><p><a href="https://github.com/vasumai/agentic-learnings">github.com/vasumai/agentic-learnings</a></p><p>I will be adding more frameworks and use cases over time. If you find it useful, star it, share it, or join the discussions.</p><h4>About the Author</h4><p>Srinivas Majji is a Senior Technology Executive and Distinguished Architect with 20+ years building large-scale consumer platforms at Fortune 50 companies. At Kroger, he championed the vision and created the organizational readiness to embrace Agentic AI — assembling a team of architects to evaluate, prototype, and operationalize emerging AI technologies ahead of the curve. He is MIT Professional Education certified in AI/ML (2026).</p><p>Portfolio: <a href="http://srinimajji.com/">srinimajji.com</a> | LinkedIn: <a href="https://www.linkedin.com/in/srinimajji/">linkedin.com/in/srinimajji</a> | GitHub: <a href="https://github.com/vasumai/agentic-learnings">github.com/vasumai</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8088b0b0305e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>