{"slug": "not-classic-rag-building-a-structured-retrieval-discovery-agent-with-langgraph", "title": "Not Classic RAG: Building a Structured-Retrieval Discovery Agent with LangGraph", "summary": "A developer built a structured-retrieval discovery agent for the educational movie-discovery project Kino, using LangGraph to enable prompt-driven catalog searches. The system interprets natural language queries like \"Discover comedy movies from 2010 onward\" into structured query arguments such as genres and year ranges, then returns grounded titles from a local catalog. This approach differs from classic RAG by using a domain-specific structured retrieval API rather than unstructured text retrieval, creating a workflow-agent hybrid that enforces deterministic results.", "body_md": "I just added a new feature to [ Kino](https://github.com/gryphon2411/kino/), my educational movie-discovery project built with LangGraph: a prompt-driven discovery flow that finds grounded titles from a local catalog.\n\nThe easy label would be **RAG**.\n\nMore precisely, it is not **classic RAG**.\n\nWhat I built is closer to a\n\nstructured-retrieval agent: the model interprets the request, a narrow service returns structured facts, and deterministic code enforces the final result.\n\nThat distinction sounds academic at first.\n\nIn practice, it changed almost every implementation choice.\n\nKino is an educational project, but this feature forced a very real architecture decision.\n\nI wanted a user to be able to type something like `Discover comedy movies from 2010 onward from Kino's catalog.`\n\nand get back grounded titles from the project's own data.\n\nThe final flow is intentionally small:\n\n`search_titles`\n\ntool turns that into a structured catalog queryThat final payload is also deliberately narrow: `titles`\n\nplus `notes`\n\n.\n\nI removed extra narrative fields because the system is not trying to be a movie critic. It is trying to be a grounded discovery interface.\n\nA lot of AI features get called RAG by default.\n\nThat label is too broad here.\n\nClassic **RAG** usually means retrieving unstructured text, such as document chunks, and injecting that material back into the model context so the model can answer from it.\n\nThe project is doing something different.\n\nThe tool is not a web search. It is not a vector search over article chunks. It is not a document retriever.\n\nIt is a **domain-specific structured retrieval API**.\n\nThe model is translating natural language into structured query arguments like:\n\n`genres`\n\n`title_type`\n\n`is_adult`\n\n`min_year`\n\n`max_year`\n\nThen the catalog service returns structured records.\n\nThat puts the feature much closer to a **structured-retrieval agent** than classic document RAG.\n\nIf you want the research lineage, the loop is also closer to [ReAct](https://arxiv.org/abs/2210.03629) than to a standard document-grounded RAG pipeline.\n\nThe most useful taxonomy I found for explaining this is Anthropic's framing of [workflows and agents](https://www.anthropic.com/engineering/building-effective-agents), along with the corresponding [LangGraph workflows and agents documentation](https://docs.langchain.com/oss/python/langgraph/workflows-agents).\n\nUnder that framing, this feature sits in the middle.\n\nIt is not a pure workflow, because the model is doing real interpretation work.\n\nIt is not a free-form autonomous agent either, because the tool surface is tiny and the final output is tightly controlled.\n\nThe best plain-English description is:\n\n**a workflow-agent hybrid over a structured retrieval backend**\n\nOr, shorter:\n\n**a structured-retrieval discovery agent**\n\nThat phrasing matters because it tells people what the model is actually allowed to do.\n\nOnce I stopped pretending this was generic RAG or open-ended recommendation, a few design choices became obvious.\n\n`recommend`\n\nto `discover`\n\nThat was not branding fluff.\n\n`Recommend`\n\nsuggests some kind of ranking intelligence or taste layer.\n\nAt the moment, the project does not have ratings, popularity signals, user history, or editorial scoring. So calling it a recommendation engine would be overclaiming.\n\n`Discover`\n\nis much more honest.\n\nIt says: the system helps the user find grounded candidates from the catalog.\n\nThis was one of the most important separations in the whole feature.\n\nThe LLM is good at understanding phrases like:\n\n`from 2010 onward`\n\n`between 1990 and 2000`\n\n`comedy movies`\n\n`non-adult`\n\nSo the model should do that linguistic work.\n\nBut the system should still enforce the structured constraints.\n\nThat is why I moved toward explicit query arguments like `min_year`\n\nand `max_year`\n\n, and why the backend contract now uses clearer `minYear`\n\nand `maxYear`\n\nsemantics instead of leaking database-style operator names into the user-facing architecture.\n\nIn other words:\n\nThat split ended up being much cleaner than trying to re-parse English later in the pipeline.\n\nAt one point, the response included extra explanation fields like `reason`\n\nand `tradeoff`\n\n.\n\nIn theory, that sounds useful.\n\nIn practice, for a narrow structured-retrieval flow, those fields were mostly filler.\n\nThey pushed me toward brittle heuristics or shallow generated text without adding much product value.\n\nSo I simplified the contract.\n\nNow the system returns only the grounded titles and any relevant notes.\n\nThat made the feature easier to trust and easier to inspect.\n\nOne nice side effect of building this in LangGraph is that the graph is inspectable in **LangSmith Studio**.\n\nThat matters more than it sounds.\n\nWhen you can literally see the flow as:\n\n`__start__`\n\n`model`\n\n`tools`\n\n`model`\n\n`after_agent`\n\n`__end__`\n\nit becomes much easier to explain what the system is and is not doing.\n\nIt also made debugging much more concrete.\n\nI could see when the model produced the right year bounds, when the tool call returned old titles, when a provider was failing upstream, and when a stale local server was being mistaken for the deployed agent.\n\nFor an educational project, that visibility is a real advantage.\n\nThe architecture is not hidden behind marketing language.\n\nThis feature is useful, but it is still intentionally narrow.\n\nIt is not:\n\nAnd some user preferences still cannot be enforced unless the catalog actually has the right metadata.\n\nFor example, `general audience`\n\nsounds natural in a prompt, but it is only enforceable if the underlying data exposes a reliable signal for that concept.\n\nThere is also a more boring operational truth: provider reliability still matters.\n\nEven when the architecture is clean, upstream model providers can still return transient failures, timeouts, or internal errors.\n\nThat is exactly why narrowing the tool surface and keeping the final response contract deterministic was worth it.\n\nThe practical lesson from this feature is simple:\n\n**If your domain data is structured, do not force a classic RAG story onto it.**\n\nSometimes the better answer is a small agent that interprets the user's language, calls a narrow retrieval API, and hands the final truth back to deterministic code.\n\nThat is what I ended up building in this project.\n\nNot a generic AI search box.\n\nNot a recommendation engine.\n\nA **structured-retrieval discovery agent**.\n\nAnd once I named it correctly, the implementation got better.", "url": "https://wpnews.pro/news/not-classic-rag-building-a-structured-retrieval-discovery-agent-with-langgraph", "canonical_source": "https://eido-askayo.blogspot.com/2026/05/not-classic-rag-building-structured.html", "published_at": "2026-05-07 14:35:07+00:00", "updated_at": "2026-06-04 13:18:32.226408+00:00", "lang": "en", "topics": ["ai-agents", "large-language-models", "artificial-intelligence", "ai-tools", "ai-products"], "entities": ["Kino", "LangGraph", "gryphon2411"], "alternates": {"html": "https://wpnews.pro/news/not-classic-rag-building-a-structured-retrieval-discovery-agent-with-langgraph", "markdown": "https://wpnews.pro/news/not-classic-rag-building-a-structured-retrieval-discovery-agent-with-langgraph.md", "text": "https://wpnews.pro/news/not-classic-rag-building-a-structured-retrieval-discovery-agent-with-langgraph.txt", "jsonld": "https://wpnews.pro/news/not-classic-rag-building-a-structured-retrieval-discovery-agent-with-langgraph.jsonld"}}