<?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: Uma Baleboyina</title>
    <description>The latest articles on DEV Community by Uma Baleboyina (@uma_baleboyina_1cb374cc73).</description>
    <link>https://dev.to/uma_baleboyina_1cb374cc73</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%2F3919275%2F7117ecd5-2284-47fd-a72b-18c6039117e7.png</url>
      <title>DEV Community: Uma Baleboyina</title>
      <link>https://dev.to/uma_baleboyina_1cb374cc73</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/uma_baleboyina_1cb374cc73"/>
    <language>en</language>
    <item>
      <title>Understanding Retrieval-Augmented Generation (RAG): My Learning Journey</title>
      <dc:creator>Uma Baleboyina</dc:creator>
      <pubDate>Fri, 10 Jul 2026 10:12:17 +0000</pubDate>
      <link>https://dev.to/uma_baleboyina_1cb374cc73/understanding-retrieval-augmented-generation-rag-my-learning-journey-1m4p</link>
      <guid>https://dev.to/uma_baleboyina_1cb374cc73/understanding-retrieval-augmented-generation-rag-my-learning-journey-1m4p</guid>
      <description>&lt;p&gt;Artificial Intelligence has made it possible for Large Language Models (LLMs) to answer a wide range of questions. However, one major limitation of LLMs is that they only know the information they were trained on. They cannot automatically access the latest documents or organization-specific knowledge. This is where &lt;strong&gt;Retrieval-Augmented Generation (RAG)&lt;/strong&gt; becomes valuable.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Retrieval-Augmented Generation (RAG)&lt;/strong&gt; is a technique that allows an LLM to retrieve relevant information from external knowledge sources before generating a response. Instead of relying only on its pre-trained knowledge, the model first searches for relevant information and then uses it to produce a more accurate and context-aware answer.&lt;/p&gt;

&lt;p&gt;In simple terms:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;RAG = Retrieval + Generation&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Retrieval:&lt;/strong&gt; Find the most relevant information.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Generation:&lt;/strong&gt; Generate an answer using the retrieved information.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  The RAG Pipeline
&lt;/h1&gt;

&lt;h2&gt;
  
  
  1. Document Loading
&lt;/h2&gt;

&lt;p&gt;The first step in the RAG pipeline is loading the documents. These documents can come from different sources such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PDF files&lt;/li&gt;
&lt;li&gt;Word documents&lt;/li&gt;
&lt;li&gt;Text files&lt;/li&gt;
&lt;li&gt;Websites&lt;/li&gt;
&lt;li&gt;Images (after OCR)&lt;/li&gt;
&lt;li&gt;Audio transcripts&lt;/li&gt;
&lt;li&gt;Databases&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In frameworks like LangChain, a document loader converts these sources into &lt;strong&gt;Document objects&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Each document contains two important attributes:&lt;/p&gt;

&lt;h3&gt;
  
  
  page_content
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;page_content&lt;/code&gt; contains the actual textual content of the document.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Python is a high-level programming language.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  metadata
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;metadata&lt;/code&gt; stores additional information about the document.&lt;/p&gt;

&lt;p&gt;For example:&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="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;source&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;python_notes.pdf&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;page&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;author&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;John&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Metadata helps identify where the retrieved information came from, making the responses more reliable and traceable.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Chunking
&lt;/h2&gt;

&lt;p&gt;Large documents are difficult for embedding models and LLMs to process directly. Therefore, the documents are divided into smaller pieces called &lt;strong&gt;chunks&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This process is known as &lt;strong&gt;chunking&lt;/strong&gt; or &lt;strong&gt;text splitting&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Different chunking strategies include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fixed-size chunking&lt;/li&gt;
&lt;li&gt;Recursive chunking&lt;/li&gt;
&lt;li&gt;Sentence-based chunking&lt;/li&gt;
&lt;li&gt;Paragraph-based chunking&lt;/li&gt;
&lt;li&gt;Semantic chunking&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Two important parameters during chunking are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Chunk Size:&lt;/strong&gt; The amount of text contained in each chunk.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Chunk Overlap:&lt;/strong&gt; The shared text between consecutive chunks, which helps preserve context.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Choosing the right chunk size and overlap significantly improves retrieval quality.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Embedding
&lt;/h2&gt;

&lt;p&gt;After chunking, each chunk is converted into an &lt;strong&gt;embedding&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;An embedding is a numerical representation of text in a high-dimensional vector space. Instead of storing text directly, the embedding model converts each chunk into a vector that captures its semantic meaning.&lt;/p&gt;

&lt;p&gt;For example,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Chunk:
"Python is widely used for Artificial Intelligence."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;may become&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="mf"&gt;0.12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;-0.45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.78&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.91&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;-0.23&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&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;It is important to understand that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;One chunk produces one embedding vector.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;One embedding vector contains hundreds or thousands of numerical values (dimensions).&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Depending on the embedding model, the vector may contain:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;384 dimensions&lt;/li&gt;
&lt;li&gt;768 dimensions&lt;/li&gt;
&lt;li&gt;1536 dimensions&lt;/li&gt;
&lt;li&gt;3072 dimensions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These vectors allow the system to compare the meanings of different pieces of text rather than simply matching keywords.&lt;/p&gt;

&lt;p&gt;Different embedding models have different token limits and performance characteristics, so selecting the appropriate model depends on the application's requirements.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Vector Database
&lt;/h2&gt;

&lt;p&gt;The generated embeddings are stored in a &lt;strong&gt;vector database&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Unlike traditional databases, a vector database stores vector embeddings and performs semantic similarity searches.&lt;/p&gt;

&lt;p&gt;Popular vector databases include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ChromaDB&lt;/li&gt;
&lt;li&gt;FAISS&lt;/li&gt;
&lt;li&gt;Pinecone&lt;/li&gt;
&lt;li&gt;Milvus&lt;/li&gt;
&lt;li&gt;Weaviate&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The vector database stores the embeddings of the document chunks so they can be retrieved efficiently when a user asks a question.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. User Query
&lt;/h2&gt;

&lt;p&gt;When a user asks a question, the same embedding model converts the user's query into an embedding vector.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;User Question&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;How is Python used in Artificial Intelligence?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The question is converted into a vector representation similar to:&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="mf"&gt;0.91&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;-0.20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.28&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.62&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.80&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&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;This query vector is &lt;strong&gt;not permanently stored&lt;/strong&gt; in the vector database. It is generated temporarily to search for similar document embeddings.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Similarity Search
&lt;/h2&gt;

&lt;p&gt;The vector database compares the query embedding with every stored document embedding.&lt;/p&gt;

&lt;p&gt;It calculates how similar the vectors are using similarity measures such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cosine Similarity (most commonly used)&lt;/li&gt;
&lt;li&gt;Dot Product&lt;/li&gt;
&lt;li&gt;Euclidean Distance&lt;/li&gt;
&lt;/ul&gt;

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

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Stored Chunk&lt;/th&gt;
&lt;th&gt;Similarity Score&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Chunk 1&lt;/td&gt;
&lt;td&gt;0.45&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Chunk 2&lt;/td&gt;
&lt;td&gt;0.30&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Chunk 3&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.98 ✅&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Chunk 4&lt;/td&gt;
&lt;td&gt;0.40&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A higher similarity score indicates that the chunk's meaning is closer to the user's question.&lt;/p&gt;

&lt;p&gt;In this example, &lt;strong&gt;Chunk 3&lt;/strong&gt; has the highest similarity score because it is semantically most similar to the user's query.&lt;/p&gt;

&lt;p&gt;The vector database retrieves this chunk and sends it to the application.&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Context Augmentation
&lt;/h2&gt;

&lt;p&gt;The retrieved chunks are combined with the user's original question to form an &lt;strong&gt;augmented prompt&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Instead of sending only the user's question to the LLM, the application sends both the retrieved context and the question.&lt;/p&gt;

&lt;p&gt;For example,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Context:
Python is widely used for Artificial Intelligence.

Question:
How is Python used in AI?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This additional context enables the LLM to generate more accurate and grounded responses.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. Response Generation
&lt;/h2&gt;

&lt;p&gt;Finally, the augmented prompt is sent to the LLM.&lt;/p&gt;

&lt;p&gt;The LLM reads both:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The user's question&lt;/li&gt;
&lt;li&gt;The retrieved context&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It then generates the final response based on both pieces of information.&lt;/p&gt;




&lt;h1&gt;
  
  
  RAG with Different Types of Data
&lt;/h1&gt;

&lt;p&gt;One interesting aspect of RAG is that it can work with both &lt;strong&gt;structured&lt;/strong&gt; and &lt;strong&gt;unstructured&lt;/strong&gt; data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Unstructured Data
&lt;/h2&gt;

&lt;p&gt;Examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PDFs&lt;/li&gt;
&lt;li&gt;Word documents&lt;/li&gt;
&lt;li&gt;Text files&lt;/li&gt;
&lt;li&gt;Images&lt;/li&gt;
&lt;li&gt;Audio transcripts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The typical pipeline is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Load → Chunk → Embed → Store in Vector Database&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Structured Data
&lt;/h2&gt;

&lt;p&gt;Structured data is stored in relational databases such as MySQL, PostgreSQL, or SQLite, where the data is organized into rows and columns.&lt;/p&gt;

&lt;p&gt;Unlike unstructured data, structured data does not require chunking, embeddings, or a vector database. Instead, AI frameworks such as LangChain use a &lt;strong&gt;SQL Toolkit&lt;/strong&gt; to retrieve information from the database.&lt;/p&gt;

&lt;p&gt;The process works as follows:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The user asks a question in natural language.&lt;/li&gt;
&lt;li&gt;LangChain sends the user's question to the LLM.&lt;/li&gt;
&lt;li&gt;The LLM analyzes the question and decides whether a tool is required.&lt;/li&gt;
&lt;li&gt;If database access is needed, the LLM requests the &lt;strong&gt;SQL Toolkit&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;LangChain executes the SQL Toolkit.&lt;/li&gt;
&lt;li&gt;The SQL Toolkit generates and executes the appropriate SQL query on the relational database.&lt;/li&gt;
&lt;li&gt;The database returns the query results to the SQL Toolkit.&lt;/li&gt;
&lt;li&gt;LangChain passes these results back to the LLM.&lt;/li&gt;
&lt;li&gt;Finally, the LLM generates a natural-language response, which is returned to the user.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The overall flow is:&lt;/p&gt;

&lt;p&gt;User → LangChain → LLM → SQL Toolkit → Database → SQL Toolkit → LangChain → LLM → User&lt;/p&gt;




&lt;h1&gt;
  
  
  Why Do We Need RAG?
&lt;/h1&gt;

&lt;p&gt;Without RAG, an LLM answers questions using only the knowledge it learned during training.&lt;/p&gt;

&lt;p&gt;With RAG:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It can access up-to-date information.&lt;/li&gt;
&lt;li&gt;It can answer questions about private documents.&lt;/li&gt;
&lt;li&gt;It reduces hallucinations.&lt;/li&gt;
&lt;li&gt;It improves the accuracy and reliability of AI applications.&lt;/li&gt;
&lt;li&gt;It provides answers grounded in external knowledge.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  My Key Takeaways
&lt;/h1&gt;

&lt;p&gt;While learning RAG, I realized that building a RAG application involves much more than connecting an LLM to a database. Every stage of the pipeline contributes to the quality of the final answer.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Document loaders prepare documents with both content and metadata.&lt;/li&gt;
&lt;li&gt;Chunking divides large documents into meaningful sections.&lt;/li&gt;
&lt;li&gt;Embeddings convert each chunk into a high-dimensional vector representing its semantic meaning.&lt;/li&gt;
&lt;li&gt;Vector databases store these vectors and perform efficient similarity searches.&lt;/li&gt;
&lt;li&gt;The user's query is also converted into an embedding vector.&lt;/li&gt;
&lt;li&gt;Similarity search retrieves the chunks whose meanings are closest to the user's question.&lt;/li&gt;
&lt;li&gt;The retrieved context is combined with the user's query before being sent to the LLM.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Overall, RAG extends the capabilities of Large Language Models by allowing them to retrieve and use external knowledge, making AI applications more accurate, reliable, and useful for real-world scenarios.&lt;/p&gt;

</description>
      <category>rag</category>
      <category>langchain</category>
      <category>vectordatabase</category>
      <category>generativeai</category>
    </item>
    <item>
      <title>Middleware in DeepAgents</title>
      <dc:creator>Uma Baleboyina</dc:creator>
      <pubDate>Wed, 10 Jun 2026 03:55:00 +0000</pubDate>
      <link>https://dev.to/uma_baleboyina_1cb374cc73/middleware-in-deepagents-3la0</link>
      <guid>https://dev.to/uma_baleboyina_1cb374cc73/middleware-in-deepagents-3la0</guid>
      <description>&lt;p&gt;Middleware is a component that sits between different parts of an agent system and can observe, manage, modify, or track the flow of information during execution.&lt;/p&gt;

&lt;p&gt;In Deep Agents, middleware is part of the framework architecture. It operates between components such as the user request, the model, and tool execution. Middleware can perform different responsibilities depending on its purpose.&lt;/p&gt;

&lt;p&gt;There are different types of middleware. For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;TodoListMiddleware&lt;/strong&gt; – Creates and manages a task list (todos) for complex requests and tracks task completion.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PatchToolCallsMiddleware&lt;/strong&gt; – Helps manage and validate tool-calling behavior.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Logging Middleware&lt;/strong&gt; – Records execution details and events.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Summarization Middleware&lt;/strong&gt; – Can summarize conversation history or intermediate results.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6gmjv29etv3r2aym9hml.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6gmjv29etv3r2aym9hml.png" alt=" " width="616" height="454"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is important to note that not every middleware performs verification. Different middleware have different responsibilities. Some middleware may validate requests, some may track progress, some may summarize information, and some may simply log activity.&lt;/p&gt;

&lt;p&gt;In Deep Agents, certain middleware are added automatically by the framework. For example, when I created an agent using &lt;code&gt;create_deep_agent()&lt;/code&gt;, I observed middleware such as &lt;code&gt;TodoListMiddleware&lt;/code&gt; and &lt;code&gt;PatchToolCallsMiddleware&lt;/code&gt; appearing in the execution trace even though I did not explicitly add them.&lt;/p&gt;

&lt;p&gt;The TodoListMiddleware creates and maintains todos internally. These todos are typically based on the user's goal and the tools available to the agent. The middleware tracks which tasks are pending and which have been completed during execution.&lt;/p&gt;

&lt;p&gt;For example, if the user asks:&lt;/p&gt;

&lt;p&gt;"Get me the weather of the most popular city in India."&lt;/p&gt;

&lt;p&gt;The internal todo list might conceptually look like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Find the most popular city.&lt;/li&gt;
&lt;li&gt;Get the weather for that city.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As the agent completes each step, the middleware can update the status of the corresponding task.&lt;/p&gt;

&lt;p&gt;The actual tool outputs are stored in the agent's state and used by the model for reasoning, while the TodoListMiddleware primarily focuses on planning and tracking task progress.&lt;/p&gt;

&lt;p&gt;Some middleware are automatically included by the framework, while other middleware may need to be explicitly added by the developer depending on the application's requirements.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>langchain</category>
      <category>langgraph</category>
    </item>
    <item>
      <title>From Simple LLMs to Intelligent AI Agents</title>
      <dc:creator>Uma Baleboyina</dc:creator>
      <pubDate>Tue, 26 May 2026 16:12:40 +0000</pubDate>
      <link>https://dev.to/uma_baleboyina_1cb374cc73/from-simple-llms-to-intelligent-ai-agents-32gi</link>
      <guid>https://dev.to/uma_baleboyina_1cb374cc73/from-simple-llms-to-intelligent-ai-agents-32gi</guid>
      <description>&lt;p&gt;&lt;strong&gt;Understanding Deep Agents and Agentic AI&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Artificial Intelligence has evolved from simple text generation models to intelligent systems called AI Agents. Before understanding agents, we first need to understand how Large Language Models (LLMs) work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are LLMs?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;LLMs (Large Language Models) are AI models trained on massive amounts of data. Their main job is to predict the next token based on previous tokens.&lt;/p&gt;

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

&lt;p&gt;Input: "India is a"&lt;br&gt;
Output: "country"&lt;/p&gt;

&lt;p&gt;The model continuously predicts the next token to generate complete responses.&lt;/p&gt;

&lt;p&gt;Modern AI models can generate different types of outputs, also called modalities.&lt;/p&gt;

&lt;p&gt;Some common modalities are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Text generation&lt;/li&gt;
&lt;li&gt;Code generation&lt;/li&gt;
&lt;li&gt;Image generation&lt;/li&gt;
&lt;li&gt;Audio generation&lt;/li&gt;
&lt;li&gt;Video generation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Examples:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chatbots generate text&lt;/li&gt;
&lt;li&gt;Code assistants generate code&lt;/li&gt;
&lt;li&gt;AI art tools generate images&lt;/li&gt;
&lt;li&gt;Video models generate videos&lt;/li&gt;
&lt;li&gt;Problem with Using Different LLM APIs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Different AI companies provide different APIs.&lt;/strong&gt;&lt;/p&gt;

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

&lt;ol&gt;
&lt;li&gt;OpenAI API&lt;/li&gt;
&lt;li&gt;Gemini API&lt;/li&gt;
&lt;li&gt;Claude API&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Each API has:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;different syntax&lt;/li&gt;
&lt;li&gt;different configurations&lt;/li&gt;
&lt;li&gt;different SDKs&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So developers had to write separate code for every model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How LangChain Helped&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;LangChain introduced a common framework for working with multiple LLMs.&lt;/p&gt;

&lt;p&gt;Instead of rewriting the entire codebase for each model, developers can use a common interface.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Without LangChain:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;openai.chat()&lt;/li&gt;
&lt;li&gt;gemini.generate()&lt;/li&gt;
&lt;li&gt;claude.messages()&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;With LangChain:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;llm.invoke()&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Only the configuration changes slightly.&lt;/li&gt;
&lt;li&gt; This made AI application development much easier.&lt;/li&gt;
&lt;li&gt; From Simple LLMs to Intelligent Agents&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Simple LLMs can generate:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;text&lt;/li&gt;
&lt;li&gt;code&lt;/li&gt;
&lt;li&gt;images&lt;/li&gt;
&lt;li&gt;videos&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But they cannot directly perform real-world tasks like:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;booking train tickets&lt;/li&gt;
&lt;li&gt;reserving hotels&lt;/li&gt;
&lt;li&gt;sending emails&lt;/li&gt;
&lt;li&gt;searching live data&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Initially, developers combined LLMs and traditional programming logic to perform such actions.&lt;/p&gt;

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

&lt;p&gt;User Request&lt;br&gt;
    ↓&lt;br&gt;
LLM understands request&lt;br&gt;
    ↓&lt;br&gt;
Python code calls APIs&lt;br&gt;
    ↓&lt;br&gt;
Action gets completed&lt;br&gt;
&lt;strong&gt;Tool Calling in AI Agents&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Later, AI systems evolved into tool-using agents.&lt;/p&gt;

&lt;p&gt;Now the LLM itself can decide:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;which tool to use&lt;/li&gt;
&lt;li&gt;when to use it&lt;/li&gt;
&lt;li&gt;what parameters to pass&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Examples of tools:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;search engines&lt;/li&gt;
&lt;li&gt;calculators&lt;/li&gt;
&lt;li&gt;booking APIs&lt;/li&gt;
&lt;li&gt;databases&lt;/li&gt;
&lt;li&gt;browsers
This made AI systems appear more intelligent and autonomous.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;ReAct Agents&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One important concept in Agentic AI is the ReAct Agent.&lt;/p&gt;

&lt;p&gt;ReAct stands for: Reason + Act&lt;/p&gt;

&lt;p&gt;The agent:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reasons about the problem&lt;/li&gt;
&lt;li&gt;Chooses an action/tool&lt;/li&gt;
&lt;li&gt;Observes the result&lt;/li&gt;
&lt;li&gt;Continues reasoning&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Flow:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Thought → Action → Observation → Thought&lt;/p&gt;

&lt;p&gt;This allows the AI agent to solve complex tasks step-by-step.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Challenges in AI Agents&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Even though agents are powerful, they still face many challenges.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Garbage In, Garbage Out (Prompt Quality)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;LLMs highly depend on prompts.&lt;/p&gt;

&lt;p&gt;If the input prompt is poor or unclear, the output quality also becomes poor.&lt;/p&gt;

&lt;p&gt;This is called:&lt;/p&gt;

&lt;p&gt;Garbage In → Garbage Out&lt;/p&gt;

&lt;p&gt;Better prompts usually produce better results.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Guardrails&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Guardrails are safety mechanisms added to AI systems.&lt;/p&gt;

&lt;p&gt;Their purpose is to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;prevent harmful outputs&lt;/li&gt;
&lt;li&gt;protect sensitive information&lt;/li&gt;
&lt;li&gt;restrict unsafe actions&lt;/li&gt;
&lt;li&gt;ensure ethical behavior
Example:
An AI agent should not reveal private user data or perform dangerous actions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Grounding&lt;/strong&gt;&lt;br&gt;
Grounding means the AI should provide information based on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;real facts&lt;/li&gt;
&lt;li&gt;reliable sources&lt;/li&gt;
&lt;li&gt;actual context
If the model does not know something, it should honestly say:
“I do not have enough information.”
instead of generating false information.
This helps reduce hallucinations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AI systems are evolving from simple text generators into intelligent autonomous agents. Frameworks like LangChain and ReAct-based architectures are helping developers build more capable AI applications.&lt;/p&gt;

&lt;p&gt;However, challenges such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;prompt quality&lt;/li&gt;
&lt;li&gt;safety&lt;/li&gt;
&lt;li&gt;hallucinations&lt;/li&gt;
&lt;li&gt;grounding&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>langchain</category>
      <category>agentaichallenge</category>
    </item>
    <item>
      <title>What is MCP? My Beginner's Guide to Model Context Protocol</title>
      <dc:creator>Uma Baleboyina</dc:creator>
      <pubDate>Fri, 08 May 2026 07:51:19 +0000</pubDate>
      <link>https://dev.to/uma_baleboyina_1cb374cc73/what-is-mcp-my-beginners-guide-to-model-context-protocol-15bk</link>
      <guid>https://dev.to/uma_baleboyina_1cb374cc73/what-is-mcp-my-beginners-guide-to-model-context-protocol-15bk</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When I started learning Generative AI, one of the first things I came across was something called MCP. At first it sounded complex, but once I understood it, everything clicked. In this blog, I want to share my understanding in the simplest way possible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is MCP?&lt;/strong&gt;&lt;br&gt;
MCP stands for Model Context Protocol. It is a lightweight protocol developed by Anthropic — the company that also created Claude AI. In simple terms, MCP acts as a bridge between an AI assistant and the outside world — connecting it to functions, tools, and external environments so the AI can actually do things, not just talk.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where did the idea come from?&lt;/strong&gt;&lt;br&gt;
MCP was inspired by LSP — the Language Server Protocol. If you have used VS Code, you already benefited from LSP without knowing it. LSP is the reason VS Code can support multiple programming languages like Python, JavaScript, Java and more — all through one common standard.&lt;br&gt;
MCP follows the same idea. Instead of building a separate integration for every AI model, MCP provides one common standard that works across multiple models. You build the server once, and any MCP-compatible AI model can use it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How do you build an MCP server?&lt;/strong&gt;&lt;br&gt;
Building your first MCP server is simpler than it sounds. You start by importing MCP from the FastMCP library. Then you define your tools using the &lt;a class="mentioned-user" href="https://dev.to/mcp"&gt;@mcp&lt;/a&gt;.tool decorator and write the logic — the actual code that performs the action. Finally, you connect it to Claude and your server is ready.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The two main components of MCP&lt;/strong&gt;&lt;br&gt;
MCP has two core components:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MCP Client —&lt;/strong&gt;  This is the intelligent side, like Claude. It understands the user's request and decides what needs to be done.&lt;br&gt;
&lt;strong&gt;MCP Server —&lt;/strong&gt; This is the action side. It actually performs the tasks that the client requests.&lt;/p&gt;

&lt;p&gt;Think of the client as the brain and the server as the hands.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How does the workflow work?&lt;/strong&gt;&lt;br&gt;
Here is the step-by-step flow of how MCP works in action:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjffb3vzmt6veaev2rq50.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjffb3vzmt6veaev2rq50.png" alt="MCP Workflow Diagram" width="434" height="567"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tools vs Resources vs Prompts — what is the difference?&lt;/strong&gt;&lt;br&gt;
This is one of the most important concepts in MCP:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tools —&lt;/strong&gt; These are used to perform actions. When a user wants something done — like fetching weather data or saving a file — a tool does it.&lt;br&gt;
&lt;strong&gt;Resources —&lt;/strong&gt; These are used to feed data to the agent. They are read-only information sources the AI can access when it needs context or data.&lt;br&gt;
&lt;strong&gt;Prompts —&lt;/strong&gt; These are reusable question templates. They represent the general questions or instructions a user commonly asks the AI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
MCP is a powerful and elegant idea — one standard protocol that connects any AI model to any tool or data source. It removes the need to build custom integrations for every model and makes AI agents truly useful in the real world. I am just getting started with MCP, and I am excited to build more servers and share what I learn along the way.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>beginners</category>
      <category>python</category>
    </item>
  </channel>
</rss>
