{
  "source_file": "0930",
  "source_platform": "Medium",
  "author": "Julian Yip",
  "title_listed": "Supercharge Your RAG with Multi-Agent Self-RAG",
  "keywords": "",
  "domain": "大模型算法",
  "content_type": "深度技术解析",
  "is_paid_flag": "否",
  "url": "https://towardsdatascience.com/supercharge-your-rag-with-multi-agent-self-rag/",
  "publish_date": "2025-02-05",
  "corpus_stage": "",
  "notes": "",
  "id": "a500d0643183",
  "collected_at": "2026-10-02T06:41:38",
  "title": "Supercharge Your RAG with Multi-Agent Self-RAG | Towards Data Science",
  "body_markdown": "![Revisit consent button](../images/body-df29beacd7496220cc94.svg)\nWe value your privacy\nWe use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking \"Accept All\", you consent to our use of cookies.\nCustomise Reject All Accept All\nCustomise Consent Preferences ![](../images/body-2159bb67f3de8ad870eb.svg)\nWe use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.\nThe cookies that are categorised as \"Necessary\" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more\nNecessaryAlways Active\nNecessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.\n  * Cookie\nBCTempID\n  * Duration\n10 minutes\n  * Description\nNo description available.\n\n\n  * Cookie\n__cf_bm\n  * Duration\n1 hour\n  * Description\nThis cookie, set by Cloudflare, is used to support Cloudflare Bot Management. \n\n\n  * Cookie\nAWSALBCORS\n  * Duration\n7 days\n  * Description\nAmazon Web Services set this cookie for load balancing.\n\n\n  * Cookie\n_cfuvid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services\n\n\n  * Cookie\nli_gc\n  * Duration\n6 months\n  * Description\nLinkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.\n\n\n  * Cookie\n__hssrc\n  * Duration\nsession\n  * Description\nThis cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.\n\n\n  * Cookie\n__hssc\n  * Duration\n1 hour\n  * Description\nHubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.\n\n\n  * Cookie\nwpEmojiSettingsSupports\n  * Duration\nsession\n  * Description\nWordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.\n\n\n  * Cookie\nBCSessionID\n  * Duration\n1 year 1 month 4 days\n  * Description\nBlueconic sets this cookie as a unique identifier for the BlueConic profile.\n\n\n  * Cookie\n_octo\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nlogged_in\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\n__Secure-YEC\n  * Duration\npast\n  * Description\nYouTube sets this cookie to stores the user's video player preferences using embedded YouTube video\n\n\n  * Cookie\n__eoi\n  * Duration\n6 months\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTGCORS\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\nlogin-status-p\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTG\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\ncsrf_token\n  * Duration\nsession\n  * Description\nNo description available.\n\n\n  * Cookie\ntoken_v2\n  * Duration\n1 day\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nD\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nPHPSESSID\n  * Duration\nsession\n  * Description\nThis cookie is native to PHP applications. The cookie stores and identifies a user's unique session ID to manage user sessions on the website. The cookie is a session cookie and will be deleted when all the browser windows are closed.\n\n\n  * Cookie\nVISITOR_PRIVACY_METADATA\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to store the user's cookie consent state for the current domain. \n\n\n  * Cookie\ncookietest\n  * Duration\nsession\n  * Description\nThe cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.\n\n\n  * Cookie\n__Host-airtable-session\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\n__Host-airtable-session.sig\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\nm\n  * Duration\n1 year 1 month 4 days\n  * Description\nStripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.\n\n\n  * Cookie\nBIGipServer*\n  * Duration\nsession\n  * Description\nMarketo sets this cookie to collect information about the user's online activity and build a profile about their interests to provide advertisements relevant to the user. \n\n\n  * Cookie\n__cfruid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to identify trusted web traffic.\n\n\n  * Cookie\n_GRECAPTCHA\n  * Duration\n6 months\n  * Description\nGoogle Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.\n\n\n  * Cookie\n__Secure-YNID\n  * Duration\n6 months\n  * Description\nGoogle cookie used to protect user security and prevent fraud, especially during the login process.\n\n\n  * Cookie\ncookieyes-consent\n  * Duration\n1 year\n  * Description\nCookieYes sets this cookie to remember users' consent preferences so that their preferences are respected on subsequent visits to this site. It does not collect or store any personal information about the site visitors.\n\n\nFunctional\nFunctional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.\n  * Cookie\nlidc\n  * Duration\n1 day\n  * Description\nLinkedIn sets the lidc cookie to facilitate data center selection.\n\n\n  * Cookie\nbrw\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nbrwConsent\n  * Duration\n5 minutes\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nWMF-Uniq\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nloom_anon_comment\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nloom_referral_video\n  * Duration\nsession\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nVISITOR_INFO1_LIVE\n  * Duration\n6 months\n  * Description\nA cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.\n\n\n  * Cookie\nyt-remote-connected-devices\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nytidb::LAST_RESULT_ENTRY_KEY\n  * Duration\nNever Expires\n  * Description\nThe cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.\n\n\n  * Cookie\nyt-remote-device-id\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-name\n  * Duration\nsession\n  * Description\nThe yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\nyt-remote-fast-check-period\n  * Duration\nsession\n  * Description\nThe yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-app\n  * Duration\nsession\n  * Description\nThe yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-available\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-installed\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\ncp_session\n  * Duration\n3 months\n  * Description\nCodepen sets this cookie for Help systems found in the website.\n\n\n  * Cookie\nloid\n  * Duration\n1 year 1 month 4 days\n  * Description\nThis cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.\n\n\nAnalytics\nAnalytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.\n  * Cookie\n__hstc\n  * Duration\n6 months\n  * Description\nHubspot set this main cookie for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).\n\n\n  * Cookie\nhubspotutk\n  * Duration\n6 months\n  * Description\nHubSpot sets this cookie to keep track of the visitors to the website. This cookie is passed to HubSpot on form submission and used when deduplicating contacts.\n\n\n  * Cookie\n_ga\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.\n\n\n  * Cookie\n_ga_*\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to store and count page views.\n\n\n  * Cookie\n__Host-psifi.analyticsTrace\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n__Host-psifi.analyticsTraceV2\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n_gh_sess\n  * Duration\nsession\n  * Description\nGitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.\n\n\n  * Cookie\nYSC\n  * Duration\nsession\n  * Description\nYSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.\n\n\n  * Cookie\najs_anonymous_id\n  * Duration\n1 year\n  * Description\nThis cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.\n\n\n  * Cookie\nvuid\n  * Duration\n1 year 1 month 4 days\n  * Description\nVimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. \n\n\nPerformance\nPerformance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.\n  * Cookie\nAWSALB\n  * Duration\n7 days\n  * Description\nAWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.\n\n\n  * Cookie\nacq\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nacq.sig\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nptc\n  * Duration\n2 years\n  * Description\nNo description available.\n\n\nAdvertisement\nAdvertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.\n  * Cookie\nmuc_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to collect user behaviour and interaction data to optimize the website.\n\n\n  * Cookie\nguest_id_marketing\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\nguest_id_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\npersonalization_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to integrate and share features for social media and also store information about how the user uses the website, for tracking and targeting.\n\n\n  * Cookie\nguest_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor. It registers if a user is signed in to the Twitter platform and collects information about ad preferences.\n\n\n  * Cookie\nbcookie\n  * Duration\n1 year\n  * Description\nLinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.\n\n\n  * Cookie\n__Secure-ROLLOUT_TOKEN\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.\n\n\n  * Cookie\nyt.innertube::nextId\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nyt.innertube::requests\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nsession_tracker\n  * Duration\nsession\n  * Description\nThis cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.\n\n\n  * Cookie\nedgebucket\n  * Duration\nsession\n  * Description\nReddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.\n\n\n  * Cookie\ndid\n  * Duration\n1 year\n  * Description\nArbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.\n\n\nUncategorised\nOther uncategorised cookies are those that are being analysed and have not been classified into a category as yet.\nNo cookies to display.\nReject All Save My Preferences Accept All\nToggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation\n[](https://towardsdatascience.com/)\nPublish AI, ML & data-science insights to a global community of data professionals.\nSign in[Submit an Article](https://write.insightmediagroup.io)\n[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)\n* * *\n[Write For TDS](https://towardsdatascience.com/submissions/)\n[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search\n[Large Language Models](https://towardsdatascience.com/category/artificial-intelligence/large-language-models/)\n# Supercharge Your RAG with Multi-Agent Self-RAG\nApply human reasoning to your RAG application\n[Julian Yip](https://towardsdatascience.com/author/jyipkl/)\nFebruary 5, 202513 min read\n![](../images/000.webp)\nDrawn by the author. Icons are attributed to Brain icons created by Smashicons — Flaticon \n## **Introduction**\nMany of us might have tried to build a RAG application and noticed it falls significantly short of addressing real-life needs. Why is that? It’s because many real-world problems require multiple steps of information retrieval and reasoning. We need our agent to perform those as humans normally do, yet most RAG applications fall short of this.\nThis article explores how to supercharge your RAG application by making its data retrieval and reasoning process similar to how a human would, under a multi-agent framework. The framework presented here is based on the [Self-RAG strategy](https://langchain-ai.github.io/langgraph/tutorials/rag/langgraph_self_rag/) but has been significantly modified to enhance its capabilities. Prior knowledge of the original strategy is not necessary for reading this article.\n## **Real-life Case**\nConsider this: I was going to fly from Delhi to Munich (let’s assume I am taking the flight from an EU airline), but I was denied boarding somehow. Now I want to know what the compensation should be.\nThese two webpages contain relevant information, I go ahead adding them to my vector store, trying to have my agent answer this for me by retrieving the right information.\nLearn this step by step with the interactive [AI Engineer](https://roadmap.sh/ai-engineer) roadmap.\n  * [Flight compensation policy](https://www.eu-startups.com/2024/04/comparative-analysis-eu-vs-us-flight-compensation-policies-sponsored/)\n  * [Distance between Munich and other major cities in the world](https://www.geodatos.net/en/distances/cities/germany/bavaria/munich) (note: it does not reflect the distance between airports, but it serves the purpose for our demonstration)\n\n\nNow, I pass this question to the vector store:  _**“how much can I receive if I am denied boarding, for flights from Delhi to Munich?”**_.\ntext\n\n```\n– – – – – – – – – – – – – – – – – – – – – – – – –\nOverview of US Flight Compensation Policies To get compensation for delayed flights, you should contact your airline via their customer service or go to the customer service desk. At the same time, you should bear in mind that you will only receive compensation if the delay is not weather-related and is within the carrier`s control. According to the US Department of Transportation, US airlines are not required to compensate you if a flight is cancelled or delayed. You can be compensated if you are bumped or moved from an overbooked flight. If your provider cancels your flight less than two weeks before departure and you decide to cancel your trip entirely, you can receive a refund of both pre-paid baggage fees and your plane ticket. There will be no refund if you choose to continue your journey. In the case of a delayed flight, the airline will rebook you on a different flight. According to federal law, you will not be provided with money or other compensation. Comparative Analysis of EU vs. US Flight Compensation Policies\n– – – – – – – – – – – – – – – – – – – – – – – – –\n(AUTHOR-ADDED NOTE: IMPORTANT, PAY ATTENTION TO THIS)\nShort-distance flight delays – if it is up to 1,500 km, you are due 250 Euro compensation.\nMedium distance flight delays – for all the flights between 1,500 and 3,500 km, the compensation should be 400 Euro.\nLong-distance flight delays – if it is over 3,500 km, you are due 600 Euro compensation. To receive this kind of compensation, the following conditions must be met; Your flight starts in a non-EU member state or in an EU member state and finishes in an EU member state and is organised by an EU airline. Your flight reaches the final destination with a delay that exceeds three hours. There is no force majeure.\n– – – – – – – – – – – – – – – – – – – – – – – – –\nCompensation policies in the EU and US are not the same, which implies that it is worth knowing more about them. While you can always count on Skycop flight cancellation compensation, you should still get acquainted with the information below.\n– – – – – – – – – – – – – – – – – – – – – – – – –\nCompensation for flight regulations EU: The EU does regulate flight delay compensation, which is known as EU261. US: According to the US Department of Transportation, every airline has its own policies about what should be done for delayed passengers. Compensation for flight delays EU: Just like in the United States, compensation is not provided when the flight is delayed due to uncontrollable reasons. However, there is a clear approach to compensation calculation based on distance. For example, if your flight was up to 1,500 km, you can receive 250 euros. US: There are no federal requirements. That is why every airline sets its own limits for compensation in terms of length. However, it is usually set at three hours. Overbooking EU: In the EU, they call for volunteers if the flight is overbooked. These people are entitled to a choice of: Re-routing to their final destination at the earliest opportunity. Refund of their ticket cost within a week if not travelling. Re-routing at a later date at the person`s convenience.\n```\n\nUnfortunately, they contain only generic flight compensation policies, without telling me how much I can expect when denied boarding from Delhi to Munich specifically. If the RAG agent takes these as the sole context, it can only provide a generic answer about flight compensation policy, without giving the answer we want.\nHowever, while the documents are not immediately useful, there is an important insight contained in the 2nd piece of context:  _**compensation varies according to flight distance**_. If the RAG agent thinks more like human, it should follow these steps to provide an answer:\n  1. Based on the retrieved context, reason that compensation varies with flight distance\n  2. Next, retrieve the flight distance between Delhi and Munich\n  3. Given the distance (which is around 5900km), classify the flight as a long-distance one\n  4. Combined with the previously retrieved context, figure out I am due 600 EUR, assuming other conditions are fulfilled\n\n\nThis example demonstrates how a simple RAG, in which a single retrieval is made, fall short for several reasons:\n  1. **Complex Queries** : Users often have questions that a simple search can’t fully address. For example, “What’s the best smartphone for gaming under $500?” requires consideration of multiple factors like performance, price, and features, which a single retrieval step might miss.\n  2. **Deep Information** : Some information lies across documents. For example, research papers, medical records, or legal documents often include references that need to be made sense of, before one can fully understand the content of a given article. Multiple retrieval steps help dig deeper into the content.\n\n\nMultiple retrievals supplemented with human-like reasoning allow for a more nuanced, comprehensive, and accurate response, adapting to the complexity and depth of user queries.\n## Multi-Agent Self-RAG\nHere I explain the reasoning process behind this strategy, afterwards I will provide the code to show you how to achieve this!\n> Note: For readers interested in knowing how my approach differs from the [original Self-RAG](https://langchain-ai.github.io/langgraph/tutorials/rag/langgraph_self_rag/), I will describe the discrepancies in quotation boxes like this. But general readers who are unfamiliar with the original Self-RAG can skip them.\nIn the below graphs, each circle represents a step (aka **Node**), which is performed by a dedicated agent working on the specific problem. We orchestrate them to form a multi-agent RAG application.\n### 1st iteration: Simple RAG\n![](../images/001.webp)\nA simple RAG chain\nThis is just the vanilla RAG approach I described in “Real-life Case”, represented as a graph. After `Retrieve documents`, the `new_documents` will be used as input for `Generate Answer`. Nothing special, but it serves as our starting point.\n### 2nd iteration: Digest documents with “Grade documents”\n![](../images/body-ab14973dafcb8bcd68d4.webp)\nReasoning like human do\nRemember I said in the “Real-life Case” section, that as a next step, the agent should  _**“reason that compensation varies with flight distance”**_? The `Grade documents` step is exactly for this purpose.\nGiven the `new_documents`, the agent will try to output two items:\n  1. `useful_documents`: Comparing the question asked, it determines if the documents are useful, and retain a memory for those deemed useful for future reference. As an example, since our question does not concern compensation policies for US, documents describing those are discarded, leaving only those for EU\n  2. `hypothesis`: Based on the documents, the agent forms a hypothesis about how the question can be answered, that is, flight distance needs to be identified\n\n\nNotice how the above reasoning resembles human thinking! But still, while these outputs are useful, we need to instruct the agent to use them as input for performing the next document retrieval. Without this, the answer provided in `Generate answer` is still not useful.\n> `useful_documents` are appended for each document retrieval loop, instead of being overwritten, to keep a memory of documents that are previously deemed useful. `hypothesis` is formed from `useful_documents` and `new_documents` to provide an “abstract reasoning” to inform how query is to be transformed subsequently.\n> The `hypothesis` is especially useful when no useful documents can be identified initially, as the agent can still form hypothesis from documents not immediately deemed as useful / only bearing indirect relationship to the question at hand, for informing what questions to ask next\n### 3rd iteration: Brainstorm new questions to ask\n![](../images/body-7ecdf6fa73ae2c30f8b2.webp)\nSuggest questions for additional information retrieval\nWe have the agent reflect upon whether the answer is useful and grounded in context. If not, it should proceed to `Transform query` to ask further questions.\nThe output `new_queries` will be a list of new questions that the agent consider useful for obtaining extra information. Given the `useful_documents` (compensation policies for EU), and `hypothesis` (need to identify flight distance between Delhi and Munich), it asks questions like **“What is the distance between Delhi and Munich?”**\nNow we are ready to use the `new_queries` for further retrieval!\n> The `transform_query` node will use `useful_documents` (which are accumulated per iteration, instead of being overwritten) and `hypothesis` as input for providing the agent directions to ask new questions.\n> The new questions will be a list of questions (instead of a single question) separated from the original `question`, so that the original question is kept in state, otherwise the agent could lose track of the original question after multiple iterations.\n### Final iteration: Further retrieval with new questions\n![](../images/body-dcd8551049221c019f68.webp)\nIssuing new queries to retrieve extra documents\nThe output `new_queries` from `Transform query` will be passed to the `Retrieve documents` step, forming a retrieval loop.\nSince the question  _**“What is the distance between Delhi and Munich?”**_ is asked, we can expect the flight distance is then retrieved as `new_documents`, and subsequently graded as `useful_documents`, further used as an input for `Generate answer`.\n> The ` _grade_documents_`node will compare the documents against both the original` _question_`and` _new_questions_`list, so that documents that are considered useful for` _new_questions_`, even if not so for the original` _question_`, are kept.\n> This is because those documents might help answer the original ` _question_`indirectly, by being relevant to` _new_questions_`_(like “_ What is the distance between Delhi and Munich?”)\n![](../images/body-3533686db5de5c7da20b.webp)\nFinal answer!\nEquipped with this new context about flight distance, the agent is now ready to provide the right answer: **600 EUR**!\nNext, let us now dive into the code to see how this multi-agent RAG application is created.\n## Implementation\nThe source code can be found [here](https://github.com/yip-kl/enhanced-self-rag). Our multi-agent RAG application involves iterations and loops, and LangGraph is a great library for building such complex multi-agent application. If you are not familiar with LangGraph, you are strongly suggested to have a look at [LangGraph’s Quickstart guide](https://langchain-ai.github.io/langgraph/tutorials/introduction/) to understand more about it!\nTo keep this article concise, I will focus on the key code snippets only.\n**Important note** : I am using OpenRouter as the [Llm](https://towardsdatascience.com/tag/llm/) interface, but the code can be easily adapted for other LLM interfaces. Also, while in my code I am using Claude 3.5 Sonnet as model, you can use any LLM as long as it support `tools` as parameter (check this list [here](https://openrouter.ai/models?fmt=cards&order=newest&supported_parameters=tools)), so you can also run this with other models, like DeepSeek V3 and OpenAI o1!\n### State definition\nIn the previous section, I have defined various elements e.g. `new_documents`, `hypothesis` that are to be passed to each step (aka **Nodes**), in LangGraph’s terminology these elements are called **State**.\nWe define the State formally with the following snippet.\npython\n\n```\nfrom typing import List, Annotated\nfrom typing_extensions import TypedDict\n\ndef append_to_list(original: list, new: list) -> list:\n    original.append(new)\n    return original\n\ndef combine_list(original: list, new: list) -> list:\n    return original + new\n\nclass GraphState(TypedDict):\n    \"\"\"\n    Represents the state of our graph.\n\n    Attributes:\n        question: question\n        generation: LLM generation\n        new_documents: newly retrieved documents for the current iteration\n        useful_documents: documents that are considered useful\n        graded_documents: documents that have been graded\n        new_queries: newly generated questions\n        hypothesis: hypothesis\n    \"\"\"\n\n    question: str\n    generation: str\n    new_documents: List[str]\n    useful_documents: Annotated[List[str], combine_list]\n    graded_documents: List[str]\n    new_queries: Annotated[List[str], append_to_list]\n    hypothesis: str\n```\n\n### Graph definition\nThis is where we combine the different steps to form a “**Graph** ”, which is a representation of our multi-agent application. The definitions of various steps (e.g. `grade_documents`) are represented by their respective functions.\npython\n\n```\nfrom langgraph.graph import END, StateGraph, START\nfrom langgraph.checkpoint.memory import MemorySaver\nfrom IPython.display import Image, display\n\nworkflow = StateGraph(GraphState)\n\n# Define the nodes\nworkflow.add_node(\"retrieve\", retrieve)  # retrieve\nworkflow.add_node(\"grade_documents\", grade_documents)  # grade documents\nworkflow.add_node(\"generate\", generate)  # generatae\nworkflow.add_node(\"transform_query\", transform_query)  # transform_query\n\n# Build graph\nworkflow.add_edge(START, \"retrieve\")\nworkflow.add_edge(\"retrieve\", \"grade_documents\")\nworkflow.add_conditional_edges(\n    \"grade_documents\",\n    decide_to_generate,\n    {\n        \"transform_query\": \"transform_query\",\n        \"generate\": \"generate\",\n    },\n)\nworkflow.add_edge(\"transform_query\", \"retrieve\")\nworkflow.add_conditional_edges(\n    \"generate\",\n    grade_generation_v_documents_and_question,\n    {\n        \"useful\": END,\n        \"not supported\": \"transform_query\",\n        \"not useful\": \"transform_query\",\n    },\n)\n\n# Compile\nmemory = MemorySaver()\napp = workflow.compile(checkpointer=memory)\ndisplay(Image(app.get_graph(xray=True).draw_mermaid_png()))\n```\n\nRunning the above code, you should see this graphical representation of our RAG application. Notice how it is essentially equivalent to the graph I have shown in the final iteration of “Enhanced Self-RAG Strategy”!\n![](../images/body-29a5b0cfb86d51940e74.webp)\nVisualizing the multi-agent RAG graph\n> After `generate`, if the answer is considered “not supported”, the agent will proceed to `transform_query` intead of to `generate` again, so that the agent will look for additional information rather than trying to regenerate answers based on existing context, which might not suffice for providing a “supported” answer\nNow we are ready to put the multi-agent application to test! With the below code snippet, we ask this question `how much can I receive if I am denied boarding, for flights from Delhi to Munich?`\npython\n\n```\nfrom pprint import pprint\nconfig = {\"configurable\": {\"thread_id\": str(uuid4())}}\n\n# Run\ninputs = {\n    \"question\": \"how much can I receive if I am denied boarding, for flights from Delhi to Munich?\",\n    }\nfor output in app.stream(inputs, config):\n    for key, value in output.items():\n        # Node\n        pprint(f\"Node '{key}':\")\n        # Optional: print full state at each node\n        # print(app.get_state(config).values)\n    pprint(\"\\n---\\n\")\n\n# Final generation\npprint(value[\"generation\"])\n```\n\nWhile output might vary (sometimes the application provides the answer without any iterations, because it “guessed” the distance between Delhi and Munich), it should look something like this, which shows the application went through multiple rounds of data retrieval for RAG.\npython\n\n```\n---RETRIEVE---\n\"Node 'retrieve':\"\n'\\n---\\n'\n---CHECK DOCUMENT RELEVANCE TO QUESTION---\n---GRADE: DOCUMENT NOT RELEVANT---\n---GRADE: DOCUMENT RELEVANT---\n---GRADE: DOCUMENT NOT RELEVANT---\n---GRADE: DOCUMENT NOT RELEVANT---\n---ASSESS GRADED DOCUMENTS---\n---DECISION: GENERATE---\n\"Node 'grade_documents':\"\n'\\n---\\n'\n---GENERATE---\n---CHECK HALLUCINATIONS---\n'---DECISION: GENERATION IS NOT GROUNDED IN DOCUMENTS, RE-TRY---'\n\"Node 'generate':\"\n'\\n---\\n'\n---TRANSFORM QUERY---\n\"Node 'transform_query':\"\n'\\n---\\n'\n---RETRIEVE---\n\"Node 'retrieve':\"\n'\\n---\\n'\n---CHECK DOCUMENT RELEVANCE TO QUESTION---\n---GRADE: DOCUMENT NOT RELEVANT---\n---GRADE: DOCUMENT NOT RELEVANT---\n---GRADE: DOCUMENT RELEVANT---\n---GRADE: DOCUMENT NOT RELEVANT---\n---GRADE: DOCUMENT NOT RELEVANT---\n---GRADE: DOCUMENT NOT RELEVANT---\n---GRADE: DOCUMENT NOT RELEVANT---\n---ASSESS GRADED DOCUMENTS---\n---DECISION: GENERATE---\n\"Node 'grade_documents':\"\n'\\n---\\n'\n---GENERATE---\n---CHECK HALLUCINATIONS---\n---DECISION: GENERATION IS GROUNDED IN DOCUMENTS---\n---GRADE GENERATION vs QUESTION---\n---DECISION: GENERATION ADDRESSES QUESTION---\n\"Node 'generate':\"\n'\\n---\\n'\n('Based on the context provided, the flight distance from Munich to Delhi is '\n '5,931 km, which falls into the long-distance category (over 3,500 km). '\n 'Therefore, if you are denied boarding on a flight from Delhi to Munich '\n 'operated by an EU airline, you would be eligible for 600 Euro compensation, '\n 'provided that:\\n'\n '1. The flight is operated by an EU airline\\n'\n '2. There is no force majeure\\n'\n '3. Other applicable conditions are met\\n'\n '\\n'\n \"However, it's important to note that this compensation amount is only valid \"\n 'if all the required conditions are met as specified in the regulations.')\n```\n\nAnd the final answer is what we aimed for!\ntext\n\n```\nBased on the context provided, the flight distance from Munich to Delhi is\n5,931 km, which falls into the long-distance category (over 3,500 km).\nTherefore, if you are denied boarding on a flight from Delhi to Munich\noperated by an EU airline, you would be eligible for 600 Euro compensation,\nprovided that:\n1. The flight is operated by an EU airline\n2. There is no force majeure\n3. Other applicable conditions are met\n\nHowever, it's important to note that this compensation amount is only valid\nif all the required conditions are met as specified in the regulations.\n```\n\nInspecting the State, we see how the `hypothesis` and `new_queries` enhance the effectiveness of our multi-agent RAG application by mimicking human thinking process.\n**Hypothesis**\npython\n\n```\nprint(app.get_state(config).values.get('hypothesis',\"\"))\n```\n\ntext\n\n```\n--- Output ---\nTo answer this question accurately, I need to determine:\n\n1. Is this flight operated by an EU airline? (Since Delhi is non-EU and Munich is EU)\n2. What is the flight distance between Delhi and Munich? (To determine compensation amount)\n3. Are we dealing with a denied boarding situation due to overbooking? (As opposed to delay/cancellation)\n\nFrom the context, I can find information about compensation amounts based on distance, but I need to verify:\n- If the flight meets EU compensation eligibility criteria\n- The exact distance between Delhi and Munich to determine which compensation tier applies (250€, 400€, or 600€)\n- If denied boarding compensation follows the same amounts as delay compensation\n\nThe context doesn't explicitly state compensation amounts specifically for denied boarding, though it mentions overbooking situations in the EU require offering volunteers re-routing or refund options.\n\nWould you like me to proceed with the information available, or would you need additional context about denied boarding compensation specifically?\n```\n\n**New Queries**\npython\n\n```\nfor questions_batch in app.get_state(config).values.get('new_queries',\"\"):\n    for q in questions_batch:\n        print(q)\n```\n\ntext\n\n```\n--- Output ---\nWhat is the flight distance between Delhi and Munich?\nDoes EU denied boarding compensation follow the same amounts as flight delay compensation?\nAre there specific compensation rules for denied boarding versus flight delays for flights from non-EU to EU destinations?\nWhat are the compensation rules when flying with non-EU airlines from Delhi to Munich?\nWhat are the specific conditions that qualify as denied boarding under EU regulations?\n```\n\n## Conclusion\nSimple RAG, while easy to build, might fall short in tackling real-life questions. By incorporating human thinking process into a multi-agent RAG framework, we are making RAG applications much more practical.\n_*Unless otherwise noted, all images are by the author_\n* * *\n## Register Now to Continue Reading\n### Unlock Towards Data Science with a Free Account\nAll articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more.\nRegister for freeSign in to your account\n* * *\n![](../images/body-d6f10b7f094af8ff005c.jpeg)\nWritten By\n## [Julian Yip](https://towardsdatascience.com/author/jyipkl/)\n[See all from Julian Yip](https://towardsdatascience.com/author/jyipkl/)\n[Agentic Ai](https://towardsdatascience.com/tag/agentic-ai/)[Llm](https://towardsdatascience.com/tag/llm/)[Llm Agent](https://towardsdatascience.com/tag/llm-agent/)[Multi Agent Systems](https://towardsdatascience.com/tag/multi-agent-systems/)[Retrieval Augmented](https://towardsdatascience.com/tag/retrieval-augmented/)\nShare This Article\n  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2Fsupercharge-your-rag-with-multi-agent-self-rag%2F&title=Supercharge%20Your%20RAG%20with%20Multi-Agent%20Self-RAG)\n  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2Fsupercharge-your-rag-with-multi-agent-self-rag%2F&title=Supercharge%20Your%20RAG%20with%20Multi-Agent%20Self-RAG)\n  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2Fsupercharge-your-rag-with-multi-agent-self-rag%2F&text=Supercharge%20Your%20RAG%20with%20Multi-Agent%20Self-RAG)\n\n\nTowards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.\n[Write for TDS](https://towardsdatascience.com/submissions/)\n## Related Articles\n  * [![](../images/002.jpeg)](https://towardsdatascience.com/here-is-what-using-an-llm-for-monsters-taught-me-about-programming-4ce44f5f4f14/)\n## [Here is what using an LLM for monsters taught me about programming](https://towardsdatascience.com/here-is-what-using-an-llm-for-monsters-taught-me-about-programming-4ce44f5f4f14/)\n[Programming](https://towardsdatascience.com/category/programming/)\nHow I learned to use AI as an alternative to generate amazing random data.\n[Kory Becker](https://towardsdatascience.com/author/korybecker/)\nJune 9, 20248 min read\n  * [![](../images/003.png)](https://towardsdatascience.com/domain-adaptation-of-a-large-language-model-2692ed59f180/)\n## [Domain Adaptation of A Large Language Model](https://towardsdatascience.com/domain-adaptation-of-a-large-language-model-2692ed59f180/)\n[Deep Learning](https://towardsdatascience.com/category/artificial-intelligence/deep-learning/)\nAdapt a pre-trained model to a new domain using HuggingFace\n[Mina Ghashami](https://towardsdatascience.com/author/mina.ghashami/)\nNovember 14, 202313 min read\n  * [![](../images/004.jpg)](https://towardsdatascience.com/4-new-techniques-to-maximize-claude-code/)\n## [4 New Techniques to Maximize Claude Code](https://towardsdatascience.com/4-new-techniques-to-maximize-claude-code/)\n[Agentic AI](https://towardsdatascience.com/category/artificial-intelligence/agentic-ai/)\nGet the most out of Claude Code with these four techniques\n[Eivind Kjosbakken](https://towardsdatascience.com/author/oieivind/)\nJune 8, 20269 min read\n  * [![](../images/005.png)](https://towardsdatascience.com/a-sanity-check-on-emergent-properties-in-large-language-models-46c1735e111c/)\n## [A Sanity Check on 'Emergent Properties' in Large Language Models](https://towardsdatascience.com/a-sanity-check-on-emergent-properties-in-large-language-models-46c1735e111c/)\n[Deep Learning](https://towardsdatascience.com/category/artificial-intelligence/deep-learning/)\nLLMs are often said to have 'emergent properties'. But what do we even mean by that, and what's the hard evidence?\n[Anna Rogers](https://towardsdatascience.com/author/anna.rogers/)\nJuly 15, 202412 min read\n  * [![](../images/006.jpg)](https://towardsdatascience.com/hands%e2%80%91on-with-agents-sdk-your-first-api%e2%80%91calling-agent/)\n## [Hands‑On with Agents SDK: Your First API‑Calling Agent](https://towardsdatascience.com/hands%e2%80%91on-with-agents-sdk-your-first-api%e2%80%91calling-agent/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nA practical, beginner‑friendly guide to building an AI weather assistant with Python, OpenAI Agents SDK, API tools, and Streamlit.\n[Iqbal Rahmadhan](https://towardsdatascience.com/author/miqbalrp/)\nJuly 21, 202513 min read\n  * [![](../images/007.jpg)](https://towardsdatascience.com/building-llm-apps-that-can-see-think-and-integrate-using-o3-with-multimodal-input-and-structured-output/)\n## [Building LLM Apps That Can See, Think, and Integrate: Using o3 with Multimodal Input and Structured Output](https://towardsdatascience.com/building-llm-apps-that-can-see-think-and-integrate-using-o3-with-multimodal-input-and-structured-output/)\n[Large Language Models](https://towardsdatascience.com/category/artificial-intelligence/large-language-models/)\nA hands-on example of building a time-series anomaly detection system entirely through visualization and prompting\n[Shuai Guo](https://towardsdatascience.com/author/shuaiguo/)\nSeptember 20, 202511 min read\n  * [![](../images/008.png)](https://towardsdatascience.com/building-a-smart-travel-itinerary-suggester-with-langchain-google-maps-api-and-gradio-part-2-86e9d2bcae5/)\n## [Building a Smart Travel Itinerary Suggester with LangChain, Google Maps API, and Gradio (Part 2)](https://towardsdatascience.com/building-a-smart-travel-itinerary-suggester-with-langchain-google-maps-api-and-gradio-part-2-86e9d2bcae5/)\n[Large Language Models](https://towardsdatascience.com/category/artificial-intelligence/large-language-models/)\nLearn how to build an application that might inspire your next road trip\n[Robert Martin-Short](https://towardsdatascience.com/author/rmartinshort/)\nSeptember 26, 202312 min read\n  * [![](../images/009.png)](https://towardsdatascience.com/the-business-guide-to-tailoring-language-ai-part-2-989a5e987f0c/)\n## [The Business Guide to Tailoring Language AI Part 2](https://towardsdatascience.com/the-business-guide-to-tailoring-language-ai-part-2-989a5e987f0c/)\n[Large Language Models](https://towardsdatascience.com/category/artificial-intelligence/large-language-models/)\nPrompting ChatGPT and other chatbased language AI - and why you should (not) care about it\n[Georg Ruile, Ph.D.](https://towardsdatascience.com/author/georg.ruile/)\nApril 19, 202413 min read\n  * [![](../images/010.jpeg)](https://towardsdatascience.com/behind-the-millions-estimating-the-scale-of-large-language-models-97bd7287fb6b/)\n## [Behind the Millions: Estimating the Scale of Large Language Models](https://towardsdatascience.com/behind-the-millions-estimating-the-scale-of-large-language-models-97bd7287fb6b/)\n[ChatGPT](https://towardsdatascience.com/category/artificial-intelligence/chatgpt/)\nDiscussing LLMs like ChatGPT, the underlying costs, and inference optimization approaches\n[Dmytro Nikolaiev (Dimid)](https://towardsdatascience.com/author/andimid/)\nMarch 31, 202313 min read\n\n\n  * [YouTube](https://www.youtube.com/c/TowardsDataScience)\n  * [X](https://x.com/TDataScience)\n  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)\n  * [Threads](https://www.threads.net/@towardsdatascience)\n  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)\n\n\n[](https://towardsdatascience.com/)\nYour home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.\nSubscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)\n© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)\n####  Recommended Articles \nClose\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500) How Relevance Models Foreshadowed Transformers for NLP ](https://towardsdatascience.com/how-relevance-models-foreshadowed-transformers-for-nlp/ \"How Relevance Models Foreshadowed Transformers for NLP\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500) Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1 ](https://towardsdatascience.com/javascript-fatigue-you-dont-need-js-to-build-chatgpt/ \"Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500) The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs ](https://towardsdatascience.com/subset-sum-problem-solved-in-linear-time-for-dense-enough-inputs/ \"The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500) Does Your Company Have a Data Strategy? ](https://towardsdatascience.com/does-your-company-have-a-data-strategy-e8944dbec4ae/ \"Does Your Company Have a Data Strategy?\")\n\n\n",
  "metadata": {
    "title": "Supercharge Your RAG with Multi-Agent Self-RAG | Towards Data Science",
    "description": "Apply human reasoning to your RAG application",
    "keywords": null,
    "author": "Julian Yip",
    "og:locale": "en_US",
    "og:type": "article",
    "og:title": "Supercharge Your RAG with Multi-Agent Self-RAG",
    "og:description": "Apply human reasoning to your RAG application",
    "og:url": "https://towardsdatascience.com/supercharge-your-rag-with-multi-agent-self-rag/",
    "og:site_name": "Towards Data Science",
    "og:image": "https://assets.insightmediagroup.io/media/wp-content/uploads/2025/02/1_Mk3h4-E_5MD778JNFBO1pg.webp",
    "og:image:width": "939",
    "og:image:height": "442",
    "og:image:type": "image/webp",
    "twitter:card": "summary_large_image",
    "twitter:site": "@TDataScience",
    "twitter:creator": "@TDataScience",
    "twitter:label1": "Written by",
    "twitter:data1": "Julian Yip",
    "twitter:label2": "Est. reading time",
    "twitter:data2": "13 min read",
    "article:published_time": "2025-02-05T22:07:47.000Z",
    "article:modified_time": "2025-02-05T22:07:47.000Z",
    "article:author": "https://towardsdatascience.com/author/jyipkl/"
  },
  "paywall": {
    "listed_paid": false,
    "detected": false,
    "marker": "",
    "public_only": false,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 202,
    "error": ""
  },
  "code_blocks": [
    {
      "language": "txt",
      "file": "attachments/a500d0643183/code/block_000.txt",
      "chars": 3192
    },
    {
      "language": "txt",
      "file": "attachments/a500d0643183/code/block_001.txt",
      "chars": 925
    },
    {
      "language": "txt",
      "file": "attachments/a500d0643183/code/block_002.txt",
      "chars": 1130
    },
    {
      "language": "txt",
      "file": "attachments/a500d0643183/code/block_003.txt",
      "chars": 500
    },
    {
      "language": "txt",
      "file": "attachments/a500d0643183/code/block_004.txt",
      "chars": 1749
    },
    {
      "language": "txt",
      "file": "attachments/a500d0643183/code/block_005.txt",
      "chars": 568
    },
    {
      "language": "txt",
      "file": "attachments/a500d0643183/code/block_006.txt",
      "chars": 57
    },
    {
      "language": "txt",
      "file": "attachments/a500d0643183/code/block_007.txt",
      "chars": 1071
    },
    {
      "language": "txt",
      "file": "attachments/a500d0643183/code/block_008.txt",
      "chars": 122
    },
    {
      "language": "txt",
      "file": "attachments/a500d0643183/code/block_009.txt",
      "chars": 457
    }
  ],
  "images": [
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T18:01:50Z"
    },
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T18:01:50Z"
    },
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T18:01:50Z"
    },
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T18:01:50Z"
    }
  ],
  "audio": [],
  "videos": [
    {
      "url": "https://www.youtube.com/c/TowardsDataScience",
      "kind": "channel_reference",
      "status": "reference_only"
    }
  ],
  "links": [
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/latest/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/editors-pick/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/the-variable/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/shipai/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/submissions/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/artificial-intelligence/large-language-models/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/jyipkl/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/llm/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/agentic-ai/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/llm-agent/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/multi-agent-systems/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/retrieval-augmented/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/here-is-what-using-an-llm-for-monsters-taught-me-about-programming-4ce44f5f4f14/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/programming/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/korybecker/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/domain-adaptation-of-a-large-language-model-2692ed59f180/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/artificial-intelligence/deep-learning/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/mina.ghashami/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/4-new-techniques-to-maximize-claude-code/"
    },
    {
      "type": "external",
      "href": "https://write.insightmediagroup.io"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/company/towards-data-science/"
    },
    {
      "type": "external",
      "href": "https://x.com/TDataScience"
    },
    {
      "type": "external",
      "href": "https://langchain-ai.github.io/langgraph/tutorials/rag/langgraph_self_rag/"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh/ai-engineer"
    },
    {
      "type": "external",
      "href": "https://www.eu-startups.com/2024/04/comparative-analysis-eu-vs-us-flight-compensation-policies-sponsored/"
    },
    {
      "type": "external",
      "href": "https://www.geodatos.net/en/distances/cities/germany/bavaria/munich"
    },
    {
      "type": "external",
      "href": "https://github.com/yip-kl/enhanced-self-rag"
    },
    {
      "type": "external",
      "href": "https://langchain-ai.github.io/langgraph/tutorials/introduction/"
    },
    {
      "type": "external",
      "href": "https://openrouter.ai/models?fmt=cards&order=newest&supported_parameters=tools"
    },
    {
      "type": "external",
      "href": "https://www.facebook.com/sharer/sharer.php?title=Supercharge+Your+RAG+with+Multi-Agent+Self-RAG&u=https%3A%2F%2Ftowardsdatascience.com%2Fsupercharge-your-rag-with-multi-agent-self-rag%2F"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/shareArticle?mini=true&title=Supercharge+Your+RAG+with+Multi-Agent+Self-RAG&url=https%3A%2F%2Ftowardsdatascience.com%2Fsupercharge-your-rag-with-multi-agent-self-rag%2F"
    },
    {
      "type": "external",
      "href": "https://x.com/share?text=Supercharge+Your+RAG+with+Multi-Agent+Self-RAG&url=https%3A%2F%2Ftowardsdatascience.com%2Fsupercharge-your-rag-with-multi-agent-self-rag%2F"
    },
    {
      "type": "external",
      "href": "https://www.youtube.com/c/TowardsDataScience"
    },
    {
      "type": "external",
      "href": "https://www.threads.net/@towardsdatascience"
    },
    {
      "type": "external",
      "href": "https://bsky.app/profile/towardsdatascience.com"
    },
    {
      "type": "external",
      "href": "https://thenewstack.io"
    },
    {
      "type": "external",
      "href": "https://roadmap.sh"
    },
    {
      "type": "external",
      "href": "https://insightmediagroup.io/creator-network"
    }
  ],
  "repair_version": 2,
  "repaired_at": "2026-10-20T17:31:01Z",
  "source_url": "https://towardsdatascience.com/supercharge-your-rag-with-multi-agent-self-rag/",
  "delivery_status": "unverified",
  "discovery_status": "http_403",
  "missing_reason": "源页面未重新核验:http_403；已按保留正文补采图片",
  "repair_error": "",
  "actual_video_files": [],
  "expected_saved_body_images": 4,
  "image_discovery": "saved_markdown",
  "source_body_markdown": "![Revisit consent button](https://cdn-cookieyes.com/assets/images/revisit.svg)\nWe value your privacy\nWe use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking \"Accept All\", you consent to our use of cookies.\nCustomise Reject All Accept All\nCustomise Consent Preferences ![](https://cdn-cookieyes.com/assets/images/close.svg)\nWe use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.\nThe cookies that are categorised as \"Necessary\" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more\nNecessaryAlways Active\nNecessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.\n  * Cookie\nBCTempID\n  * Duration\n10 minutes\n  * Description\nNo description available.\n\n\n  * Cookie\n__cf_bm\n  * Duration\n1 hour\n  * Description\nThis cookie, set by Cloudflare, is used to support Cloudflare Bot Management. \n\n\n  * Cookie\nAWSALBCORS\n  * Duration\n7 days\n  * Description\nAmazon Web Services set this cookie for load balancing.\n\n\n  * Cookie\n_cfuvid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services\n\n\n  * Cookie\nli_gc\n  * Duration\n6 months\n  * Description\nLinkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.\n\n\n  * Cookie\n__hssrc\n  * Duration\nsession\n  * Description\nThis cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.\n\n\n  * Cookie\n__hssc\n  * Duration\n1 hour\n  * Description\nHubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.\n\n\n  * Cookie\nwpEmojiSettingsSupports\n  * Duration\nsession\n  * Description\nWordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.\n\n\n  * Cookie\nBCSessionID\n  * Duration\n1 year 1 month 4 days\n  * Description\nBlueconic sets this cookie as a unique identifier for the BlueConic profile.\n\n\n  * Cookie\n_octo\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nlogged_in\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\n__Secure-YEC\n  * Duration\npast\n  * Description\nYouTube sets this cookie to stores the user's video player preferences using embedded YouTube video\n\n\n  * Cookie\n__eoi\n  * Duration\n6 months\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTGCORS\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\nlogin-status-p\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTG\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\ncsrf_token\n  * Duration\nsession\n  * Description\nNo description available.\n\n\n  * Cookie\ntoken_v2\n  * Duration\n1 day\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nD\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nPHPSESSID\n  * Duration\nsession\n  * Description\nThis cookie is native to PHP applications. The cookie stores and identifies a user's unique session ID to manage user sessions on the website. The cookie is a session cookie and will be deleted when all the browser windows are closed.\n\n\n  * Cookie\nVISITOR_PRIVACY_METADATA\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to store the user's cookie consent state for the current domain. \n\n\n  * Cookie\ncookietest\n  * Duration\nsession\n  * Description\nThe cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.\n\n\n  * Cookie\n__Host-airtable-session\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\n__Host-airtable-session.sig\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\nm\n  * Duration\n1 year 1 month 4 days\n  * Description\nStripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.\n\n\n  * Cookie\nBIGipServer*\n  * Duration\nsession\n  * Description\nMarketo sets this cookie to collect information about the user's online activity and build a profile about their interests to provide advertisements relevant to the user. \n\n\n  * Cookie\n__cfruid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to identify trusted web traffic.\n\n\n  * Cookie\n_GRECAPTCHA\n  * Duration\n6 months\n  * Description\nGoogle Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.\n\n\n  * Cookie\n__Secure-YNID\n  * Duration\n6 months\n  * Description\nGoogle cookie used to protect user security and prevent fraud, especially during the login process.\n\n\n  * Cookie\ncookieyes-consent\n  * Duration\n1 year\n  * Description\nCookieYes sets this cookie to remember users' consent preferences so that their preferences are respected on subsequent visits to this site. It does not collect or store any personal information about the site visitors.\n\n\nFunctional\nFunctional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.\n  * Cookie\nlidc\n  * Duration\n1 day\n  * Description\nLinkedIn sets the lidc cookie to facilitate data center selection.\n\n\n  * Cookie\nbrw\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nbrwConsent\n  * Duration\n5 minutes\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nWMF-Uniq\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nloom_anon_comment\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nloom_referral_video\n  * Duration\nsession\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nVISITOR_INFO1_LIVE\n  * Duration\n6 months\n  * Description\nA cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.\n\n\n  * Cookie\nyt-remote-connected-devices\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nytidb::LAST_RESULT_ENTRY_KEY\n  * Duration\nNever Expires\n  * Description\nThe cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.\n\n\n  * Cookie\nyt-remote-device-id\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-name\n  * Duration\nsession\n  * Description\nThe yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\nyt-remote-fast-check-period\n  * Duration\nsession\n  * Description\nThe yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-app\n  * Duration\nsession\n  * Description\nThe yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-available\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-installed\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\ncp_session\n  * Duration\n3 months\n  * Description\nCodepen sets this cookie for Help systems found in the website.\n\n\n  * Cookie\nloid\n  * Duration\n1 year 1 month 4 days\n  * Description\nThis cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.\n\n\nAnalytics\nAnalytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.\n  * Cookie\n__hstc\n  * Duration\n6 months\n  * Description\nHubspot set this main cookie for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).\n\n\n  * Cookie\nhubspotutk\n  * Duration\n6 months\n  * Description\nHubSpot sets this cookie to keep track of the visitors to the website. This cookie is passed to HubSpot on form submission and used when deduplicating contacts.\n\n\n  * Cookie\n_ga\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.\n\n\n  * Cookie\n_ga_*\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to store and count page views.\n\n\n  * Cookie\n__Host-psifi.analyticsTrace\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n__Host-psifi.analyticsTraceV2\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n_gh_sess\n  * Duration\nsession\n  * Description\nGitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.\n\n\n  * Cookie\nYSC\n  * Duration\nsession\n  * Description\nYSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.\n\n\n  * Cookie\najs_anonymous_id\n  * Duration\n1 year\n  * Description\nThis cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.\n\n\n  * Cookie\nvuid\n  * Duration\n1 year 1 month 4 days\n  * Description\nVimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. \n\n\nPerformance\nPerformance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.\n  * Cookie\nAWSALB\n  * Duration\n7 days\n  * Description\nAWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.\n\n\n  * Cookie\nacq\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nacq.sig\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nptc\n  * Duration\n2 years\n  * Description\nNo description available.\n\n\nAdvertisement\nAdvertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.\n  * Cookie\nmuc_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to collect user behaviour and interaction data to optimize the website.\n\n\n  * Cookie\nguest_id_marketing\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\nguest_id_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\npersonalization_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to integrate and share features for social media and also store information about how the user uses the website, for tracking and targeting.\n\n\n  * Cookie\nguest_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor. It registers if a user is signed in to the Twitter platform and collects information about ad preferences.\n\n\n  * Cookie\nbcookie\n  * Duration\n1 year\n  * Description\nLinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.\n\n\n  * Cookie\n__Secure-ROLLOUT_TOKEN\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.\n\n\n  * Cookie\nyt.innertube::nextId\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nyt.innertube::requests\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nsession_tracker\n  * Duration\nsession\n  * Description\nThis cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.\n\n\n  * Cookie\nedgebucket\n  * Duration\nsession\n  * Description\nReddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.\n\n\n  * Cookie\ndid\n  * Duration\n1 year\n  * Description\nArbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.\n\n\nUncategorised\nOther uncategorised cookies are those that are being analysed and have not been classified into a category as yet.\nNo cookies to display.\nReject All Save My Preferences Accept All\nToggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation\n[](https://towardsdatascience.com/)\nPublish AI, ML & data-science insights to a global community of data professionals.\nSign in[Submit an Article](https://write.insightmediagroup.io)\n[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)\n* * *\n[Write For TDS](https://towardsdatascience.com/submissions/)\n[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search\n[Large Language Models](https://towardsdatascience.com/category/artificial-intelligence/large-language-models/)\n# Supercharge Your RAG with Multi-Agent Self-RAG\nApply human reasoning to your RAG application\n[Julian Yip](https://towardsdatascience.com/author/jyipkl/)\nFebruary 5, 202513 min read\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2025/02/1_Mk3h4-E_5MD778JNFBO1pg.webp)\nDrawn by the author. Icons are attributed to Brain icons created by Smashicons — Flaticon \n## **Introduction**\nMany of us might have tried to build a RAG application and noticed it falls significantly short of addressing real-life needs. Why is that? It’s because many real-world problems require multiple steps of information retrieval and reasoning. We need our agent to perform those as humans normally do, yet most RAG applications fall short of this.\nThis article explores how to supercharge your RAG application by making its data retrieval and reasoning process similar to how a human would, under a multi-agent framework. The framework presented here is based on the [Self-RAG strategy](https://langchain-ai.github.io/langgraph/tutorials/rag/langgraph_self_rag/) but has been significantly modified to enhance its capabilities. Prior knowledge of the original strategy is not necessary for reading this article.\n## **Real-life Case**\nConsider this: I was going to fly from Delhi to Munich (let’s assume I am taking the flight from an EU airline), but I was denied boarding somehow. Now I want to know what the compensation should be.\nThese two webpages contain relevant information, I go ahead adding them to my vector store, trying to have my agent answer this for me by retrieving the right information.\nLearn this step by step with the interactive [AI Engineer](https://roadmap.sh/ai-engineer) roadmap.\n  * [Flight compensation policy](https://www.eu-startups.com/2024/04/comparative-analysis-eu-vs-us-flight-compensation-policies-sponsored/)\n  * [Distance between Munich and other major cities in the world](https://www.geodatos.net/en/distances/cities/germany/bavaria/munich) (note: it does not reflect the distance between airports, but it serves the purpose for our demonstration)\n\n\nNow, I pass this question to the vector store:  _**“how much can I receive if I am denied boarding, for flights from Delhi to Munich?”**_.\ntext\n\n```\n– – – – – – – – – – – – – – – – – – – – – – – – –\nOverview of US Flight Compensation Policies To get compensation for delayed flights, you should contact your airline via their customer service or go to the customer service desk. At the same time, you should bear in mind that you will only receive compensation if the delay is not weather-related and is within the carrier`s control. According to the US Department of Transportation, US airlines are not required to compensate you if a flight is cancelled or delayed. You can be compensated if you are bumped or moved from an overbooked flight. If your provider cancels your flight less than two weeks before departure and you decide to cancel your trip entirely, you can receive a refund of both pre-paid baggage fees and your plane ticket. There will be no refund if you choose to continue your journey. In the case of a delayed flight, the airline will rebook you on a different flight. According to federal law, you will not be provided with money or other compensation. Comparative Analysis of EU vs. US Flight Compensation Policies\n– – – – – – – – – – – – – – – – – – – – – – – – –\n(AUTHOR-ADDED NOTE: IMPORTANT, PAY ATTENTION TO THIS)\nShort-distance flight delays – if it is up to 1,500 km, you are due 250 Euro compensation.\nMedium distance flight delays – for all the flights between 1,500 and 3,500 km, the compensation should be 400 Euro.\nLong-distance flight delays – if it is over 3,500 km, you are due 600 Euro compensation. To receive this kind of compensation, the following conditions must be met; Your flight starts in a non-EU member state or in an EU member state and finishes in an EU member state and is organised by an EU airline. Your flight reaches the final destination with a delay that exceeds three hours. There is no force majeure.\n– – – – – – – – – – – – – – – – – – – – – – – – –\nCompensation policies in the EU and US are not the same, which implies that it is worth knowing more about them. While you can always count on Skycop flight cancellation compensation, you should still get acquainted with the information below.\n– – – – – – – – – – – – – – – – – – – – – – – – –\nCompensation for flight regulations EU: The EU does regulate flight delay compensation, which is known as EU261. US: According to the US Department of Transportation, every airline has its own policies about what should be done for delayed passengers. Compensation for flight delays EU: Just like in the United States, compensation is not provided when the flight is delayed due to uncontrollable reasons. However, there is a clear approach to compensation calculation based on distance. For example, if your flight was up to 1,500 km, you can receive 250 euros. US: There are no federal requirements. That is why every airline sets its own limits for compensation in terms of length. However, it is usually set at three hours. Overbooking EU: In the EU, they call for volunteers if the flight is overbooked. These people are entitled to a choice of: Re-routing to their final destination at the earliest opportunity. Refund of their ticket cost within a week if not travelling. Re-routing at a later date at the person`s convenience.\n```\n\nUnfortunately, they contain only generic flight compensation policies, without telling me how much I can expect when denied boarding from Delhi to Munich specifically. If the RAG agent takes these as the sole context, it can only provide a generic answer about flight compensation policy, without giving the answer we want.\nHowever, while the documents are not immediately useful, there is an important insight contained in the 2nd piece of context:  _**compensation varies according to flight distance**_. If the RAG agent thinks more like human, it should follow these steps to provide an answer:\n  1. Based on the retrieved context, reason that compensation varies with flight distance\n  2. Next, retrieve the flight distance between Delhi and Munich\n  3. Given the distance (which is around 5900km), classify the flight as a long-distance one\n  4. Combined with the previously retrieved context, figure out I am due 600 EUR, assuming other conditions are fulfilled\n\n\nThis example demonstrates how a simple RAG, in which a single retrieval is made, fall short for several reasons:\n  1. **Complex Queries** : Users often have questions that a simple search can’t fully address. For example, “What’s the best smartphone for gaming under $500?” requires consideration of multiple factors like performance, price, and features, which a single retrieval step might miss.\n  2. **Deep Information** : Some information lies across documents. For example, research papers, medical records, or legal documents often include references that need to be made sense of, before one can fully understand the content of a given article. Multiple retrieval steps help dig deeper into the content.\n\n\nMultiple retrievals supplemented with human-like reasoning allow for a more nuanced, comprehensive, and accurate response, adapting to the complexity and depth of user queries.\n## Multi-Agent Self-RAG\nHere I explain the reasoning process behind this strategy, afterwards I will provide the code to show you how to achieve this!\n> Note: For readers interested in knowing how my approach differs from the [original Self-RAG](https://langchain-ai.github.io/langgraph/tutorials/rag/langgraph_self_rag/), I will describe the discrepancies in quotation boxes like this. But general readers who are unfamiliar with the original Self-RAG can skip them.\nIn the below graphs, each circle represents a step (aka **Node**), which is performed by a dedicated agent working on the specific problem. We orchestrate them to form a multi-agent RAG application.\n### 1st iteration: Simple RAG\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2025/02/1_7cjs7z09W_HEySmLc0-whw.webp)\nA simple RAG chain\nThis is just the vanilla RAG approach I described in “Real-life Case”, represented as a graph. After `Retrieve documents`, the `new_documents` will be used as input for `Generate Answer`. Nothing special, but it serves as our starting point.\n### 2nd iteration: Digest documents with “Grade documents”\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2025/02/1_S7emqxgrROrusM2R4K0N2w-1024x261.webp)\nReasoning like human do\nRemember I said in the “Real-life Case” section, that as a next step, the agent should  _**“reason that compensation varies with flight distance”**_? The `Grade documents` step is exactly for this purpose.\nGiven the `new_documents`, the agent will try to output two items:\n  1. `useful_documents`: Comparing the question asked, it determines if the documents are useful, and retain a memory for those deemed useful for future reference. As an example, since our question does not concern compensation policies for US, documents describing those are discarded, leaving only those for EU\n  2. `hypothesis`: Based on the documents, the agent forms a hypothesis about how the question can be answered, that is, flight distance needs to be identified\n\n\nNotice how the above reasoning resembles human thinking! But still, while these outputs are useful, we need to instruct the agent to use them as input for performing the next document retrieval. Without this, the answer provided in `Generate answer` is still not useful.\n> `useful_documents` are appended for each document retrieval loop, instead of being overwritten, to keep a memory of documents that are previously deemed useful. `hypothesis` is formed from `useful_documents` and `new_documents` to provide an “abstract reasoning” to inform how query is to be transformed subsequently.\n> The `hypothesis` is especially useful when no useful documents can be identified initially, as the agent can still form hypothesis from documents not immediately deemed as useful / only bearing indirect relationship to the question at hand, for informing what questions to ask next\n### 3rd iteration: Brainstorm new questions to ask\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2025/02/1_xI3fGpV0M6BfLPIZDtD_2Q-1024x355.webp)\nSuggest questions for additional information retrieval\nWe have the agent reflect upon whether the answer is useful and grounded in context. If not, it should proceed to `Transform query` to ask further questions.\nThe output `new_queries` will be a list of new questions that the agent consider useful for obtaining extra information. Given the `useful_documents` (compensation policies for EU), and `hypothesis` (need to identify flight distance between Delhi and Munich), it asks questions like **“What is the distance between Delhi and Munich?”**\nNow we are ready to use the `new_queries` for further retrieval!\n> The `transform_query` node will use `useful_documents` (which are accumulated per iteration, instead of being overwritten) and `hypothesis` as input for providing the agent directions to ask new questions.\n> The new questions will be a list of questions (instead of a single question) separated from the original `question`, so that the original question is kept in state, otherwise the agent could lose track of the original question after multiple iterations.\n### Final iteration: Further retrieval with new questions\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2025/02/1_g2kgeEqpTlWhHntGo7ip6Q-1024x439.webp)\nIssuing new queries to retrieve extra documents\nThe output `new_queries` from `Transform query` will be passed to the `Retrieve documents` step, forming a retrieval loop.\nSince the question  _**“What is the distance between Delhi and Munich?”**_ is asked, we can expect the flight distance is then retrieved as `new_documents`, and subsequently graded as `useful_documents`, further used as an input for `Generate answer`.\n> The ` _grade_documents_`node will compare the documents against both the original` _question_`and` _new_questions_`list, so that documents that are considered useful for` _new_questions_`, even if not so for the original` _question_`, are kept.\n> This is because those documents might help answer the original ` _question_`indirectly, by being relevant to` _new_questions_`_(like “_ What is the distance between Delhi and Munich?”)\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2025/02/1_6CPIMb3V8A2dOOyR8N89Uw-1024x412.webp)\nFinal answer!\nEquipped with this new context about flight distance, the agent is now ready to provide the right answer: **600 EUR**!\nNext, let us now dive into the code to see how this multi-agent RAG application is created.\n## Implementation\nThe source code can be found [here](https://github.com/yip-kl/enhanced-self-rag). Our multi-agent RAG application involves iterations and loops, and LangGraph is a great library for building such complex multi-agent application. If you are not familiar with LangGraph, you are strongly suggested to have a look at [LangGraph’s Quickstart guide](https://langchain-ai.github.io/langgraph/tutorials/introduction/) to understand more about it!\nTo keep this article concise, I will focus on the key code snippets only.\n**Important note** : I am using OpenRouter as the [Llm](https://towardsdatascience.com/tag/llm/) interface, but the code can be easily adapted for other LLM interfaces. Also, while in my code I am using Claude 3.5 Sonnet as model, you can use any LLM as long as it support `tools` as parameter (check this list [here](https://openrouter.ai/models?fmt=cards&order=newest&supported_parameters=tools)), so you can also run this with other models, like DeepSeek V3 and OpenAI o1!\n### State definition\nIn the previous section, I have defined various elements e.g. `new_documents`, `hypothesis` that are to be passed to each step (aka **Nodes**), in LangGraph’s terminology these elements are called **State**.\nWe define the State formally with the following snippet.\npython\n\n```\nfrom typing import List, Annotated\nfrom typing_extensions import TypedDict\n\ndef append_to_list(original: list, new: list) -> list:\n    original.append(new)\n    return original\n\ndef combine_list(original: list, new: list) -> list:\n    return original + new\n\nclass GraphState(TypedDict):\n    \"\"\"\n    Represents the state of our graph.\n\n    Attributes:\n        question: question\n        generation: LLM generation\n        new_documents: newly retrieved documents for the current iteration\n        useful_documents: documents that are considered useful\n        graded_documents: documents that have been graded\n        new_queries: newly generated questions\n        hypothesis: hypothesis\n    \"\"\"\n\n    question: str\n    generation: str\n    new_documents: List[str]\n    useful_documents: Annotated[List[str], combine_list]\n    graded_documents: List[str]\n    new_queries: Annotated[List[str], append_to_list]\n    hypothesis: str\n```\n\n### Graph definition\nThis is where we combine the different steps to form a “**Graph** ”, which is a representation of our multi-agent application. The definitions of various steps (e.g. `grade_documents`) are represented by their respective functions.\npython\n\n```\nfrom langgraph.graph import END, StateGraph, START\nfrom langgraph.checkpoint.memory import MemorySaver\nfrom IPython.display import Image, display\n\nworkflow = StateGraph(GraphState)\n\n# Define the nodes\nworkflow.add_node(\"retrieve\", retrieve)  # retrieve\nworkflow.add_node(\"grade_documents\", grade_documents)  # grade documents\nworkflow.add_node(\"generate\", generate)  # generatae\nworkflow.add_node(\"transform_query\", transform_query)  # transform_query\n\n# Build graph\nworkflow.add_edge(START, \"retrieve\")\nworkflow.add_edge(\"retrieve\", \"grade_documents\")\nworkflow.add_conditional_edges(\n    \"grade_documents\",\n    decide_to_generate,\n    {\n        \"transform_query\": \"transform_query\",\n        \"generate\": \"generate\",\n    },\n)\nworkflow.add_edge(\"transform_query\", \"retrieve\")\nworkflow.add_conditional_edges(\n    \"generate\",\n    grade_generation_v_documents_and_question,\n    {\n        \"useful\": END,\n        \"not supported\": \"transform_query\",\n        \"not useful\": \"transform_query\",\n    },\n)\n\n# Compile\nmemory = MemorySaver()\napp = workflow.compile(checkpointer=memory)\ndisplay(Image(app.get_graph(xray=True).draw_mermaid_png()))\n```\n\nRunning the above code, you should see this graphical representation of our RAG application. Notice how it is essentially equivalent to the graph I have shown in the final iteration of “Enhanced Self-RAG Strategy”!\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2025/02/1_bRGuqH1Zm577pt6nDJIPWQ.webp)\nVisualizing the multi-agent RAG graph\n> After `generate`, if the answer is considered “not supported”, the agent will proceed to `transform_query` intead of to `generate` again, so that the agent will look for additional information rather than trying to regenerate answers based on existing context, which might not suffice for providing a “supported” answer\nNow we are ready to put the multi-agent application to test! With the below code snippet, we ask this question `how much can I receive if I am denied boarding, for flights from Delhi to Munich?`\npython\n\n```\nfrom pprint import pprint\nconfig = {\"configurable\": {\"thread_id\": str(uuid4())}}\n\n# Run\ninputs = {\n    \"question\": \"how much can I receive if I am denied boarding, for flights from Delhi to Munich?\",\n    }\nfor output in app.stream(inputs, config):\n    for key, value in output.items():\n        # Node\n        pprint(f\"Node '{key}':\")\n        # Optional: print full state at each node\n        # print(app.get_state(config).values)\n    pprint(\"\\n---\\n\")\n\n# Final generation\npprint(value[\"generation\"])\n```\n\nWhile output might vary (sometimes the application provides the answer without any iterations, because it “guessed” the distance between Delhi and Munich), it should look something like this, which shows the application went through multiple rounds of data retrieval for RAG.\npython\n\n```\n---RETRIEVE---\n\"Node 'retrieve':\"\n'\\n---\\n'\n---CHECK DOCUMENT RELEVANCE TO QUESTION---\n---GRADE: DOCUMENT NOT RELEVANT---\n---GRADE: DOCUMENT RELEVANT---\n---GRADE: DOCUMENT NOT RELEVANT---\n---GRADE: DOCUMENT NOT RELEVANT---\n---ASSESS GRADED DOCUMENTS---\n---DECISION: GENERATE---\n\"Node 'grade_documents':\"\n'\\n---\\n'\n---GENERATE---\n---CHECK HALLUCINATIONS---\n'---DECISION: GENERATION IS NOT GROUNDED IN DOCUMENTS, RE-TRY---'\n\"Node 'generate':\"\n'\\n---\\n'\n---TRANSFORM QUERY---\n\"Node 'transform_query':\"\n'\\n---\\n'\n---RETRIEVE---\n\"Node 'retrieve':\"\n'\\n---\\n'\n---CHECK DOCUMENT RELEVANCE TO QUESTION---\n---GRADE: DOCUMENT NOT RELEVANT---\n---GRADE: DOCUMENT NOT RELEVANT---\n---GRADE: DOCUMENT RELEVANT---\n---GRADE: DOCUMENT NOT RELEVANT---\n---GRADE: DOCUMENT NOT RELEVANT---\n---GRADE: DOCUMENT NOT RELEVANT---\n---GRADE: DOCUMENT NOT RELEVANT---\n---ASSESS GRADED DOCUMENTS---\n---DECISION: GENERATE---\n\"Node 'grade_documents':\"\n'\\n---\\n'\n---GENERATE---\n---CHECK HALLUCINATIONS---\n---DECISION: GENERATION IS GROUNDED IN DOCUMENTS---\n---GRADE GENERATION vs QUESTION---\n---DECISION: GENERATION ADDRESSES QUESTION---\n\"Node 'generate':\"\n'\\n---\\n'\n('Based on the context provided, the flight distance from Munich to Delhi is '\n '5,931 km, which falls into the long-distance category (over 3,500 km). '\n 'Therefore, if you are denied boarding on a flight from Delhi to Munich '\n 'operated by an EU airline, you would be eligible for 600 Euro compensation, '\n 'provided that:\\n'\n '1. The flight is operated by an EU airline\\n'\n '2. There is no force majeure\\n'\n '3. Other applicable conditions are met\\n'\n '\\n'\n \"However, it's important to note that this compensation amount is only valid \"\n 'if all the required conditions are met as specified in the regulations.')\n```\n\nAnd the final answer is what we aimed for!\ntext\n\n```\nBased on the context provided, the flight distance from Munich to Delhi is\n5,931 km, which falls into the long-distance category (over 3,500 km).\nTherefore, if you are denied boarding on a flight from Delhi to Munich\noperated by an EU airline, you would be eligible for 600 Euro compensation,\nprovided that:\n1. The flight is operated by an EU airline\n2. There is no force majeure\n3. Other applicable conditions are met\n\nHowever, it's important to note that this compensation amount is only valid\nif all the required conditions are met as specified in the regulations.\n```\n\nInspecting the State, we see how the `hypothesis` and `new_queries` enhance the effectiveness of our multi-agent RAG application by mimicking human thinking process.\n**Hypothesis**\npython\n\n```\nprint(app.get_state(config).values.get('hypothesis',\"\"))\n```\n\ntext\n\n```\n--- Output ---\nTo answer this question accurately, I need to determine:\n\n1. Is this flight operated by an EU airline? (Since Delhi is non-EU and Munich is EU)\n2. What is the flight distance between Delhi and Munich? (To determine compensation amount)\n3. Are we dealing with a denied boarding situation due to overbooking? (As opposed to delay/cancellation)\n\nFrom the context, I can find information about compensation amounts based on distance, but I need to verify:\n- If the flight meets EU compensation eligibility criteria\n- The exact distance between Delhi and Munich to determine which compensation tier applies (250€, 400€, or 600€)\n- If denied boarding compensation follows the same amounts as delay compensation\n\nThe context doesn't explicitly state compensation amounts specifically for denied boarding, though it mentions overbooking situations in the EU require offering volunteers re-routing or refund options.\n\nWould you like me to proceed with the information available, or would you need additional context about denied boarding compensation specifically?\n```\n\n**New Queries**\npython\n\n```\nfor questions_batch in app.get_state(config).values.get('new_queries',\"\"):\n    for q in questions_batch:\n        print(q)\n```\n\ntext\n\n```\n--- Output ---\nWhat is the flight distance between Delhi and Munich?\nDoes EU denied boarding compensation follow the same amounts as flight delay compensation?\nAre there specific compensation rules for denied boarding versus flight delays for flights from non-EU to EU destinations?\nWhat are the compensation rules when flying with non-EU airlines from Delhi to Munich?\nWhat are the specific conditions that qualify as denied boarding under EU regulations?\n```\n\n## Conclusion\nSimple RAG, while easy to build, might fall short in tackling real-life questions. By incorporating human thinking process into a multi-agent RAG framework, we are making RAG applications much more practical.\n_*Unless otherwise noted, all images are by the author_\n* * *\n## Register Now to Continue Reading\n### Unlock Towards Data Science with a Free Account\nAll articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more.\nRegister for freeSign in to your account\n* * *\n![](https://assets.insightmediagroup.io/media/1787657545973_9tepv8.jpeg)\nWritten By\n## [Julian Yip](https://towardsdatascience.com/author/jyipkl/)\n[See all from Julian Yip](https://towardsdatascience.com/author/jyipkl/)\n[Agentic Ai](https://towardsdatascience.com/tag/agentic-ai/)[Llm](https://towardsdatascience.com/tag/llm/)[Llm Agent](https://towardsdatascience.com/tag/llm-agent/)[Multi Agent Systems](https://towardsdatascience.com/tag/multi-agent-systems/)[Retrieval Augmented](https://towardsdatascience.com/tag/retrieval-augmented/)\nShare This Article\n  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2Fsupercharge-your-rag-with-multi-agent-self-rag%2F&title=Supercharge%20Your%20RAG%20with%20Multi-Agent%20Self-RAG)\n  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2Fsupercharge-your-rag-with-multi-agent-self-rag%2F&title=Supercharge%20Your%20RAG%20with%20Multi-Agent%20Self-RAG)\n  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2Fsupercharge-your-rag-with-multi-agent-self-rag%2F&text=Supercharge%20Your%20RAG%20with%20Multi-Agent%20Self-RAG)\n\n\nTowards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.\n[Write for TDS](https://towardsdatascience.com/submissions/)\n## Related Articles\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/06/1ehoqpphjhtXNW-yUrpHqPg.jpeg)](https://towardsdatascience.com/here-is-what-using-an-llm-for-monsters-taught-me-about-programming-4ce44f5f4f14/)\n## [Here is what using an LLM for monsters taught me about programming](https://towardsdatascience.com/here-is-what-using-an-llm-for-monsters-taught-me-about-programming-4ce44f5f4f14/)\n[Programming](https://towardsdatascience.com/category/programming/)\nHow I learned to use AI as an alternative to generate amazing random data.\n[Kory Becker](https://towardsdatascience.com/author/korybecker/)\nJune 9, 20248 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/11/1Me6zhsYiozyhy9uxU_vJeA.png)](https://towardsdatascience.com/domain-adaptation-of-a-large-language-model-2692ed59f180/)\n## [Domain Adaptation of A Large Language Model](https://towardsdatascience.com/domain-adaptation-of-a-large-language-model-2692ed59f180/)\n[Deep Learning](https://towardsdatascience.com/category/artificial-intelligence/deep-learning/)\nAdapt a pre-trained model to a new domain using HuggingFace\n[Mina Ghashami](https://towardsdatascience.com/author/mina.ghashami/)\nNovember 14, 202313 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/06/maximize-claude-code-and-codex_cover.jpg)](https://towardsdatascience.com/4-new-techniques-to-maximize-claude-code/)\n## [4 New Techniques to Maximize Claude Code](https://towardsdatascience.com/4-new-techniques-to-maximize-claude-code/)\n[Agentic AI](https://towardsdatascience.com/category/artificial-intelligence/agentic-ai/)\nGet the most out of Claude Code with these four techniques\n[Eivind Kjosbakken](https://towardsdatascience.com/author/oieivind/)\nJune 8, 20269 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/07/1NzYQDnV2y_M_dbu7z2wuFg.png)](https://towardsdatascience.com/a-sanity-check-on-emergent-properties-in-large-language-models-46c1735e111c/)\n## [A Sanity Check on 'Emergent Properties' in Large Language Models](https://towardsdatascience.com/a-sanity-check-on-emergent-properties-in-large-language-models-46c1735e111c/)\n[Deep Learning](https://towardsdatascience.com/category/artificial-intelligence/deep-learning/)\nLLMs are often said to have 'emergent properties'. But what do we even mean by that, and what's the hard evidence?\n[Anna Rogers](https://towardsdatascience.com/author/anna.rogers/)\nJuly 15, 202412 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2025/07/old-bridge-edited.jpg)](https://towardsdatascience.com/hands%e2%80%91on-with-agents-sdk-your-first-api%e2%80%91calling-agent/)\n## [Hands‑On with Agents SDK: Your First API‑Calling Agent](https://towardsdatascience.com/hands%e2%80%91on-with-agents-sdk-your-first-api%e2%80%91calling-agent/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nA practical, beginner‑friendly guide to building an AI weather assistant with Python, OpenAI Agents SDK, API tools, and Streamlit.\n[Iqbal Rahmadhan](https://towardsdatascience.com/author/miqbalrp/)\nJuly 21, 202513 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2025/09/ChatGPT-Image-Sep-17-2025-09_44_05-PM.jpg)](https://towardsdatascience.com/building-llm-apps-that-can-see-think-and-integrate-using-o3-with-multimodal-input-and-structured-output/)\n## [Building LLM Apps That Can See, Think, and Integrate: Using o3 with Multimodal Input and Structured Output](https://towardsdatascience.com/building-llm-apps-that-can-see-think-and-integrate-using-o3-with-multimodal-input-and-structured-output/)\n[Large Language Models](https://towardsdatascience.com/category/artificial-intelligence/large-language-models/)\nA hands-on example of building a time-series anomaly detection system entirely through visualization and prompting\n[Shuai Guo](https://towardsdatascience.com/author/shuaiguo/)\nSeptember 20, 202511 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/09/11FonAguWFTQDo3Nvst5L0Q.png)](https://towardsdatascience.com/building-a-smart-travel-itinerary-suggester-with-langchain-google-maps-api-and-gradio-part-2-86e9d2bcae5/)\n## [Building a Smart Travel Itinerary Suggester with LangChain, Google Maps API, and Gradio (Part 2)](https://towardsdatascience.com/building-a-smart-travel-itinerary-suggester-with-langchain-google-maps-api-and-gradio-part-2-86e9d2bcae5/)\n[Large Language Models](https://towardsdatascience.com/category/artificial-intelligence/large-language-models/)\nLearn how to build an application that might inspire your next road trip\n[Robert Martin-Short](https://towardsdatascience.com/author/rmartinshort/)\nSeptember 26, 202312 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/04/1tip7QDFNIlYzsIZ21Wdfuw.png)](https://towardsdatascience.com/the-business-guide-to-tailoring-language-ai-part-2-989a5e987f0c/)\n## [The Business Guide to Tailoring Language AI Part 2](https://towardsdatascience.com/the-business-guide-to-tailoring-language-ai-part-2-989a5e987f0c/)\n[Large Language Models](https://towardsdatascience.com/category/artificial-intelligence/large-language-models/)\nPrompting ChatGPT and other chatbased language AI - and why you should (not) care about it\n[Georg Ruile, Ph.D.](https://towardsdatascience.com/author/georg.ruile/)\nApril 19, 202413 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/03/1Q4h0NMUMPrlEhTY7eB6yww-scaled.jpeg)](https://towardsdatascience.com/behind-the-millions-estimating-the-scale-of-large-language-models-97bd7287fb6b/)\n## [Behind the Millions: Estimating the Scale of Large Language Models](https://towardsdatascience.com/behind-the-millions-estimating-the-scale-of-large-language-models-97bd7287fb6b/)\n[ChatGPT](https://towardsdatascience.com/category/artificial-intelligence/chatgpt/)\nDiscussing LLMs like ChatGPT, the underlying costs, and inference optimization approaches\n[Dmytro Nikolaiev (Dimid)](https://towardsdatascience.com/author/andimid/)\nMarch 31, 202313 min read\n\n\n  * [YouTube](https://www.youtube.com/c/TowardsDataScience)\n  * [X](https://x.com/TDataScience)\n  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)\n  * [Threads](https://www.threads.net/@towardsdatascience)\n  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)\n\n\n[](https://towardsdatascience.com/)\nYour home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.\nSubscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)\n© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)\n####  Recommended Articles \nClose\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500) How Relevance Models Foreshadowed Transformers for NLP ](https://towardsdatascience.com/how-relevance-models-foreshadowed-transformers-for-nlp/ \"How Relevance Models Foreshadowed Transformers for NLP\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500) Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1 ](https://towardsdatascience.com/javascript-fatigue-you-dont-need-js-to-build-chatgpt/ \"Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500) The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs ](https://towardsdatascience.com/subset-sum-problem-solved-in-linear-time-for-dense-enough-inputs/ \"The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500) Does Your Company Have a Data Strategy? ](https://towardsdatascience.com/does-your-company-have-a-data-strategy-e8944dbec4ae/ \"Does Your Company Have a Data Strategy?\")\n\n\n",
  "body_base_path": "attachments/a500d0643183/pages/",
  "body_markdown_path": "attachments/a500d0643183/pages/archived-body.md",
  "local_html": "attachments/a500d0643183/pages/archived-body.html",
  "body_source": "prior_capture"
}