<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sri Deevi</title>
    <description>The latest articles on DEV Community by Sri Deevi (@sri_d_6dfd4d31319a6389eaa).</description>
    <link>https://dev.to/sri_d_6dfd4d31319a6389eaa</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4029182%2Fcfb1a728-2796-48d4-8f9e-508273dc7623.jpg</url>
      <title>DEV Community: Sri Deevi</title>
      <link>https://dev.to/sri_d_6dfd4d31319a6389eaa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sri_d_6dfd4d31319a6389eaa"/>
    <language>en</language>
    <item>
      <title>Beyond RAG: Building an AI Coding Agent with Planning, Tool Execution, and ReAct Reasoning</title>
      <dc:creator>Sri Deevi</dc:creator>
      <pubDate>Wed, 05 Aug 2026 02:23:22 +0000</pubDate>
      <link>https://dev.to/sri_d_6dfd4d31319a6389eaa/beyond-rag-building-an-ai-coding-agent-with-planning-tool-execution-and-react-reasoning-53ko</link>
      <guid>https://dev.to/sri_d_6dfd4d31319a6389eaa/beyond-rag-building-an-ai-coding-agent-with-planning-tool-execution-and-react-reasoning-53ko</guid>
      <description>&lt;p&gt;In my previous article, I explored how I wrapped a RAG agent inside an MCP server to make enterprise knowledge accessible through standardized tools.&lt;/p&gt;

&lt;p&gt;However, while RAG improves retrieval, software engineering tasks require something more.&lt;/p&gt;

&lt;p&gt;A developer assistant should not only retrieve information. It should investigate.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Where is authentication implemented?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A useful coding assistant should be able to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;search the repository&lt;/li&gt;
&lt;li&gt;identify relevant files&lt;/li&gt;
&lt;li&gt;inspect source code&lt;/li&gt;
&lt;li&gt;understand classes and functions&lt;/li&gt;
&lt;li&gt;explain the implementation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This led me to build an AI coding agent that can reason, select tools, and analyze a codebase step-by-step. This one doesn't use RAG yet — it works directly against the repository — but that's a deliberate next step, more on that at the end.&lt;/p&gt;

&lt;h2&gt;
  
  
  From Chatbot to Agent
&lt;/h2&gt;

&lt;p&gt;A traditional chatbot follows a simple pattern:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User Question
       |
       v
      LLM
       |
       v
    Response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This works well for general questions, but software repositories contain thousands of files and relationships.&lt;/p&gt;

&lt;p&gt;A coding assistant needs additional capabilities:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;repository awareness&lt;/li&gt;
&lt;li&gt;search capability&lt;/li&gt;
&lt;li&gt;code understanding&lt;/li&gt;
&lt;li&gt;multi-step reasoning&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An agent introduces a decision-making layer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User Question
      |
      v
    Planner
      |
      v
 Choose Tool
      |
      v
 Execute Tool
      |
      v
 Observe Result
      |
      v
 Generate Answer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Architecture Overview
&lt;/h2&gt;

&lt;p&gt;The agent consists of several components.&lt;/p&gt;

&lt;h3&gt;
  
  
  Planner
&lt;/h3&gt;

&lt;p&gt;The planner decides the next action. It tries a rule-based plan first (keyword matching on the question), and falls back to an LLM (via Ollama's &lt;code&gt;tinyllama&lt;/code&gt;) for JSON-structured tool selection when no rule matches.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;User question:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Where is authentication implemented?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Planner response:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"tool"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"search_code"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"input"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"authentication"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The planner does not execute the action. It only decides what should happen next.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tool Registry
&lt;/h3&gt;

&lt;p&gt;The agent exposes capabilities through tools. Currently:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;search_code&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;read_file&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;analyze_file&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each tool has a specific responsibility.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Search Tool&lt;/strong&gt; — finds files containing a keyword.&lt;/p&gt;

&lt;p&gt;Input: &lt;code&gt;authentication&lt;/code&gt;&lt;br&gt;
Output: &lt;code&gt;auth.py&lt;/code&gt;, &lt;code&gt;app.py&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Read File Tool&lt;/strong&gt; — retrieves source code.&lt;/p&gt;

&lt;p&gt;Input: &lt;code&gt;auth.py&lt;/code&gt;&lt;br&gt;
Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;AuthenticationService&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;login&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;authenticate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Login successful&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Analyze Tool&lt;/strong&gt; — understands code structure using Python's &lt;code&gt;ast&lt;/code&gt; module.&lt;/p&gt;

&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"classes"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"AuthenticationService"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"functions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"login"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"authenticate"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Agent Execution Loop
&lt;/h2&gt;

&lt;p&gt;The core of the system is the agent loop, following a ReAct-style pattern:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Reason
  ↓
Action
  ↓
Observation
  ↓
Reason Again
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt; — The agent determines it needs to locate authentication code.&lt;/p&gt;

&lt;p&gt;Action: &lt;code&gt;search_code("authentication")&lt;/code&gt;&lt;br&gt;
Observation: &lt;code&gt;auth.py&lt;/code&gt;, &lt;code&gt;app.py&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt; — The agent identifies that &lt;code&gt;auth.py&lt;/code&gt; is likely the implementation.&lt;/p&gt;

&lt;p&gt;Action: &lt;code&gt;read_file("auth.py")&lt;/code&gt;&lt;br&gt;
Observation: &lt;code&gt;AuthenticationService&lt;/code&gt; class found&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt; — The agent needs more understanding.&lt;/p&gt;

&lt;p&gt;Action: &lt;code&gt;analyze_file()&lt;/code&gt;&lt;br&gt;
Observation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nl"&gt;Class:&lt;/span&gt; &lt;span class="nc"&gt;AuthenticationService&lt;/span&gt;
&lt;span class="nl"&gt;Functions:&lt;/span&gt; &lt;span class="n"&gt;login&lt;/span&gt;&lt;span class="o"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;authenticate&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The agent now has enough information to answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges During Implementation
&lt;/h2&gt;

&lt;p&gt;Building the agent introduced several interesting engineering challenges.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Challenge 1: Reliable tool selection.&lt;/strong&gt; Initially, the LLM sometimes selected incorrect tools or returned invalid responses. To improve reliability, I restricted tool choices, added JSON validation, and enforced structured outputs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Challenge 2: Avoiding repeated actions.&lt;/strong&gt; An early version of the agent could repeat &lt;code&gt;search_code&lt;/code&gt; indefinitely, because every decision was independent. The fix was maintaining previous observations as context, so the planner can see "auth.py contains authentication" and move to reading the file instead of searching again.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Challenge 3: Separating implementation from references.&lt;/strong&gt; A search result may return both &lt;code&gt;auth.py&lt;/code&gt; (which defines &lt;code&gt;AuthenticationService&lt;/code&gt;) and &lt;code&gt;app.py&lt;/code&gt; (which just imports it). The agent needs code analysis, not simple keyword matching, to tell the two apart.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Result — and a Current Limitation
&lt;/h2&gt;

&lt;p&gt;For this specific demo question, the agent produces:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"answer"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Authentication is implemented in auth.py"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"classes"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"AuthenticationService"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="nl"&gt;"functions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"login"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"authenticate"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I want to be upfront about where this stands today: the search, read, and analyze steps are genuinely general-purpose — they work against any Python codebase. The final answer-generation step, however, is currently scoped to authentication-style questions specifically; it doesn't yet generalize its explanation to arbitrary questions the way the reasoning steps before it do. Making that synthesis step question-agnostic is next on my list.&lt;/p&gt;

&lt;h2&gt;
  
  
  Future Improvements
&lt;/h2&gt;

&lt;p&gt;Some areas I want to explore next:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Generalize the answer-generation step beyond authentication-style questions&lt;/li&gt;
&lt;li&gt;Integrate Git repositories directly&lt;/li&gt;
&lt;li&gt;Generate dependency graphs&lt;/li&gt;
&lt;li&gt;Understand application architecture&lt;/li&gt;
&lt;li&gt;Connect Jira and documentation systems&lt;/li&gt;
&lt;li&gt;Automated pull request reviews&lt;/li&gt;
&lt;li&gt;Code migration assistants&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Building an AI coding agent showed me that the biggest difference between a chatbot and an agent is not the language model itself.&lt;/p&gt;

&lt;p&gt;The difference is the ability to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;plan&lt;/li&gt;
&lt;li&gt;use tools&lt;/li&gt;
&lt;li&gt;gather evidence&lt;/li&gt;
&lt;li&gt;reason over observations&lt;/li&gt;
&lt;li&gt;decide when enough information is available&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;RAG helps an AI find information. Agents help an AI perform tasks. The next generation of developer assistants will combine both — and connecting this agent to real enterprise knowledge retrieval is exactly where I'm headed next.&lt;/p&gt;

&lt;p&gt;Github: &lt;a href="https://github.com/srirdeevi/ai-coding-agent" rel="noopener noreferrer"&gt;https://github.com/srirdeevi/ai-coding-agent&lt;/a&gt;&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>coding</category>
      <category>llm</category>
    </item>
    <item>
      <title>Beyond Chatbots: Wrapping My RAG Agent in an MCP Server</title>
      <dc:creator>Sri Deevi</dc:creator>
      <pubDate>Fri, 17 Jul 2026 00:35:55 +0000</pubDate>
      <link>https://dev.to/sri_d_6dfd4d31319a6389eaa/beyond-chatbots-wrapping-my-rag-agent-in-an-mcp-server-2m0n</link>
      <guid>https://dev.to/sri_d_6dfd4d31319a6389eaa/beyond-chatbots-wrapping-my-rag-agent-in-an-mcp-server-2m0n</guid>
      <description>&lt;p&gt;In my last post, I walked through a RAG pipeline that answers questions from a company policy document. The next question I wanted to answer: what happens when I want other AI systems to use that same capability, without hardcoding a Python import?&lt;/p&gt;

&lt;p&gt;That's what pulled me into building an MCP server. In this article, I will explain how I built a custom MCP server that exposes tools to AI agents and how this architecture enables more powerful enterprise AI applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is MCP?
&lt;/h2&gt;

&lt;p&gt;Model Context Protocol is an open protocol that standardizes how AI applications communicate with external tools and data sources.&lt;/p&gt;

&lt;p&gt;Instead of creating custom integrations for every AI application, MCP provides a common interface where servers expose tools that AI clients can discover and invoke.&lt;/p&gt;

&lt;h2&gt;
  
  
  Technology Stack
&lt;/h2&gt;

&lt;p&gt;Python, MCP SDK, Ollama / Local LLM, AI Agent Client, FastAPI (optional integration).&lt;/p&gt;

&lt;h2&gt;
  
  
  What's actually in the server
&lt;/h2&gt;

&lt;p&gt;I built this with FastMCP, and it currently exposes four tool categories:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Calculator tools — calculator_add and calculator_multiply.&lt;/li&gt;
&lt;li&gt;search_company_documents — the RAG agent from my last project, but now reached over HTTP instead of a direct function call. The MCP tool sends a request to the RAG agent's FastAPI /search endpoint and returns the answer. This one requires an api_key parameter.&lt;/li&gt;
&lt;li&gt;get_employee_leave — looks up an employee's remaining PTO from an in-memory store. Simple lookup, no external calls.&lt;/li&gt;
&lt;li&gt;get_ticket_information — same pattern, returning ticket status, assigned team, and priority.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each tool is registered with a &lt;a class="mentioned-user" href="https://dev.to/mcp"&gt;@mcp&lt;/a&gt;.tool() decorator, which is what makes FastMCP genuinely pleasant to work with.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges I Encountered
&lt;/h2&gt;

&lt;p&gt;The calculator, employee, and ticket tools were straightforward pure functions with no external dependencies. The RAG search tool was a different problem entirely, and it was the hardest part of this whole project.&lt;/p&gt;

&lt;p&gt;My RAG agent runs as its own FastAPI service, on its own process, with its own vector store loaded into memory. The MCP server doesn't share any of that — it has to reach across a real network boundary with a plain requests.get() call to &lt;a href="http://127.0.0.1:8000/search" rel="noopener noreferrer"&gt;http://127.0.0.1:8000/search&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Handling real failure modes like connection refused if the RAG service isn't up, timeouts, a response shape that has to be parsed correctly on the other side.&lt;/p&gt;

&lt;h2&gt;
  
  
  Future Enhancements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Extend authentication to the employee and ticket tools, so the protection is uniform rather than partial&lt;/li&gt;
&lt;li&gt;Replace the in-memory employee/ticket dictionaries with a real data source.&lt;/li&gt;
&lt;li&gt;Eventually, wire this MCP server in as the tool layer for a multi-agent workflow — letting a research agent and a writer agent share the same discoverable tool set instead of each having their own direct integrations&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;p&gt;Building an MCP server changed my perspective on AI applications. The future of enterprise AI is not only about generating better responses. It is about creating systems where AI agents can safely interact with real-world tools and business capabilities.&lt;/p&gt;

&lt;p&gt;MCP provides an important foundation for building these next-generation AI applications.&lt;/p&gt;

&lt;p&gt;Github: &lt;a href="https://github.com/srirdeevi/mcp-server" rel="noopener noreferrer"&gt;https://github.com/srirdeevi/mcp-server&lt;/a&gt;&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>mcp</category>
      <category>rag</category>
    </item>
    <item>
      <title>From Documents to Intelligent Answers: Building a RAG Agent from Scratch &amp; Lessons Learned</title>
      <dc:creator>Sri Deevi</dc:creator>
      <pubDate>Tue, 14 Jul 2026 20:16:45 +0000</pubDate>
      <link>https://dev.to/sri_d_6dfd4d31319a6389eaa/from-documents-to-intelligent-answers-building-a-rag-agent-from-scratch-lessons-learned-4e4i</link>
      <guid>https://dev.to/sri_d_6dfd4d31319a6389eaa/from-documents-to-intelligent-answers-building-a-rag-agent-from-scratch-lessons-learned-4e4i</guid>
      <description>&lt;p&gt;Artificial Intelligence applications are rapidly moving beyond simple question-answering systems. Modern enterprise AI assistants need to understand internal documents, retrieve accurate information, and provide reliable answers based on company knowledge.&lt;/p&gt;

&lt;p&gt;I started building agentic AI systems from scratch — not to theorize about them, but to actually write the code, break it, and understand it from the inside out. This post walks through the second project in that journey: a Retrieval-Augmented Generation (RAG) system, what I built, what tripped me up, and where I'm taking it next.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is RAG?
&lt;/h2&gt;

&lt;p&gt;Retrieval-Augmented Generation combines two capabilities:&lt;/p&gt;

&lt;p&gt;Retrieval: The system searches a knowledge base and finds relevant information related to the user's question.&lt;/p&gt;

&lt;p&gt;Generation: The retrieved information is provided as context to an LLM, which generates a response based on that knowledge.&lt;/p&gt;

&lt;p&gt;Instead of asking an LLM to remember everything, RAG allows the model to access external knowledge dynamically.&lt;/p&gt;

&lt;p&gt;Technologies Used&lt;br&gt;
Python, LangChain, Ollama (Local LLM), Embeddings, Vector Database, FastAPI.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;The core idea is to build a system that answers questions using only the content of a document, rather than whatever the underlying model already "knows."&lt;/p&gt;

&lt;p&gt;Documents → Text Splitter → Embeddings → Vector Store → Retriever → LLM → Answer&lt;/p&gt;

&lt;p&gt;Document loading — a company policy document, loaded with LangChain's TextLoader&lt;/p&gt;

&lt;p&gt;Text Splitting — split into 200-character chunks with 50-character overlap, using RecursiveCharacterTextSplitter&lt;/p&gt;

&lt;p&gt;Create Embeddings — generated with sentence-transformers/all-MiniLM-L6-v2 via HuggingFaceEmbeddings&lt;/p&gt;

&lt;p&gt;Vector store — persisted in Chroma&lt;/p&gt;

&lt;p&gt;Retrieval — top-2 most relevant chunks pulled per question&lt;/p&gt;

&lt;p&gt;Generation — a strict prompt template that instructs the model to answer only from the retrieved context, run through Ollama's tinyllama.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lessons Learned
&lt;/h2&gt;

&lt;p&gt;Building a RAG system taught me that successful AI applications are not only about selecting a powerful LLM. The quality of the final answer depends heavily on:&lt;/p&gt;

&lt;p&gt;Document quality&lt;/p&gt;

&lt;p&gt;Chunking strategy&lt;/p&gt;

&lt;p&gt;Retrieval accuracy&lt;/p&gt;

&lt;p&gt;Prompt design&lt;/p&gt;

&lt;p&gt;Evaluation methods&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;RAG provides a practical foundation for building enterprise AI assistants that can use private knowledge while reducing hallucination risks. This project became the foundation for my next experiments with multi-agent workflows, MCP servers, and autonomous AI systems.&lt;/p&gt;

&lt;p&gt;Source Code: &lt;a href="https://github.com/srirdeevi/agentic-ai-portfolio" rel="noopener noreferrer"&gt;https://github.com/srirdeevi/agentic-ai-portfolio&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rag</category>
      <category>llm</category>
      <category>python</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
