Sep 9, 2025
You’ve probably heard of Retrieval-Augmented Generation, aka RAG, a technique that lets your AI model ground its answers in real documents instead of just relying on what it was trained on. That way, when someone asks a question, the AI model doesn’t just make something up, it actually goes and looks for the answer in your company’s own files, manuals, or reports.
So far so good. But here’s the thing: in real business scenarios, it’s rarely enough to just pull a chunk of text and that’s it. Think about Finance or HR teams: their questions often involve numbers, calculations, or comparisons. “What’s the average spend per department in Q2?” or “Which team had the highest travel budget this quarter?” aren’t just retrieval questions. They require the AI system to decide what to do (retrieve the right data, perform some calculations, and then explain the result). And not only that, you might want to ask follow up questions like “And what about Q1?”.
Here’s where things go from simple RAG to Agentic RAG. An Agentic RAG system doesn’t just retrieve; it can:
Decide whether to search for information, use a tool, or answer directly.
Combine steps in sequence — for example, fetch data from Google Drive, then compute an average, then present the result.
Adapt on the fly if the question changes (keeping some memory of the conversation).
Agentic RAG is like giving your RAG solution a little bit of initiative. Instead of being a passive Q&A bot, it can take small but useful actions to make the answers more practical, accurate, and context-aware.
In this blog, we’ll show you step by step how to build an Agentic RAG assistant in Stack AI. Our use case comes from Finance: expense reports stored in Google Drive that employees need quick, accurate answers from — without digging through spreadsheets.
The best part is that Stack AI makes the whole process accessible.The platform is designed to make it simple to build agentic workflows that are not only accurate but also context-aware — able to understand your business files, perform reasoning, and give answers you and your employees can trust. Let’s get into it!
What is an Agentic RAG?
RAG basically does two things:
It retrieves information from a knowledge base (your docs, spreadsheets, FAQs, whatever you connect).
It then uses a language model to generate an answer based on that info.
Super simple, right? You ask a question, it looks through the docs, finds the relevant bits, and replies with something grounded in that content. But sometimes just pulling a chunk of text isn’t enough. Think about Finance or Ops teams. They’re not just asking “What’s in the policy?” — they want things like:
“What’s the average spend per department in Q2?”
“Which team had the highest travel budget?”
“Can you compare this quarter with the last one?”
That needs a bit of reasoning, maybe a calculation, maybe remembering what we asked before. Here’s where the ‘agent’ part makes all the difference. You still have the retrieval part, but now the system has an agent layer that gives it a little initiative. It can:
Decide if it should go fetch from the docs, or if it needs to calculate something.
Use tools like a calculator or an API when needed.
Keep memory of the conversation so you can ask follow-ups naturally.
Let’s do a quick comparison:
Feature | Traditional RAG | Agentic RAG |
---|---|---|
Knowledge source | Retrieves from your documents and feeds them into an LLM | Same, but can also combine with tools, APIs, or other data sources as well as context from memory |
Flexibility | Good at retrieving the right context | Can decide whether to retrieve, calculate, or answer directly |
Reasoning | Limited | Can perform multi-step reasoning |
Memory | Each question is treated on its own | Keeps short-term memory so you can ask follow-ups naturally |
Use cases | Perfect for FAQs, policies, manuals | Better for Finance, Ops, HR, or any team where you mix facts + numbers and follow up questions |
Agentic RAG is still grounded in your documents, but it feels much more like a real assistant — not just a search engine.
Step-by-Step: building a Agentic RAG in Stack AI
In real life, most companies don’t keep all their knowledge locally. Instead teams usually have their documents scattered across shared drives: Google Drive, SharePoint, OneDrive.. you name it. Monthly expense reports, policy docs, and team spreadsheets often live there, and the challenge is that answering a simple question usually means someone has to dig through those files manually.
The good news is that Stack AI supports connecting directly to these kinds of shared drives, so you don’t need to download these files locally or copy-paste data every time you want to build an agent. You can just point it to the source where the team already stores their documents.
For this walkthrough, we’re going to simulate a finance department that keeps its expense reports in Google Drive and build an agent that can answer natural questions like:
“Which department spent the most in Q2?”
“What’s the average HR spend in Q1?”
“Compare Engineering vs Finance across both quarters.”
Step 1 — Create the project
From the Dashboard, click New Project. Then Workflow Builder and Create.

From the list of templates, we are going to use the New project which allows us to start a workflow from scratch.

Give it a clear name like Expense Report Analyzer and hit Create Project.

We need a custom workflow (Drive → LLM → Output), because our “documents” aren’t static PDFs — they’re live spreadsheets in Drive.
Step 2 — Get familiar with the canvas

You’ll see three default blocks: User Message → AI Assistant → Output.
This is the foundation of our agent. Right now it doesn’t know where our data lives, so the next step is plugging in Google Drive as a knowledge base.
Step 3 — Add Google Drive as your knowledge base
From the left side bar, open Knowledge Bases → drag Google Drive into the flow and connect it to the User Message and the AI Assistant nodes.

We want every user question to pass through Drive first, so the model only works with the most relevant context from our spreadsheets.

Step 4 — Connect to Google Drive & pick the files
Click the Google Drive node and then Pick Files from Google Drive.

Set up a new connection. This will connect to your selected Google Drive.

From there, select the files that you would like your agent to have access to.

Step 5 — Configure the Drive knowledge base
With the Drive node selected, check that your files are synced.

For our search parameters we use chunks to bring back the smallest, most relevant piece of the file (faster, cheaper, easier to cite), and we use semantic search so the agent understands meaning (“spend” ≈ “expenses”) even when the wording isn’t an exact match.
Step 6 — Pick the model & give it a proper system prompt
In the AI Assistant block, I’m going with Provider: Google → Model: Gemini 2.0 Flash.
Why this one? Well, others could have worked just fine also but there are a couple of reasons:
It’s fast. Finance/Ops questions are often short and factual. Nobody wants to wait 10 seconds for an answer to “What’s the average HR spend in Q1?” Gemini Flash is optimized for quick responses, so the whole flow feels snappy.
It’s cost-efficient. Since we’re working with tabular data and relatively simple calculations, we don’t need the heaviest model. Flash gives us plenty of accuracy for a fraction of the cost of a “big” model.
It’s good with structure. Flash is solid at reading and interpreting tables or rows from spreadsheets — exactly the kind of data we’re pulling from Google Drive.
Scalable. If later the Finance team starts asking for more complex analysis (e.g., forecasting, variance, or explanations across multiple sheets), we can always upgrade to a stronger model. But for day-to-day Q&A, Flash hits the sweet spot.

And we add the system prompt. This is basically the agent’s job description. In this case, we tell it straight up: you’re an intelligent assistant designed to analyze expense reports from Excel or Google Sheets. Then we spell out its capabilities — it should retrieve the right numbers from the files, use tools like a calculator when a question needs math (like averages or totals), and make the whole analysis process quicker and more consistent. The goal we give it is clear: be efficient, be accurate, and give financial insights people can trust. In this way, we guide the assistant’s behavior so it doesn’t just sound smart, it actually acts like a Finance/Ops helper.
Step 7 — Attach the Knowledge Base, add the search tool, enable memory
Still in the assistant settings:
Under Knowledge Bases, select the Drive Knowledge Base you just created.
Under Tools, add Search Knowledge Bases.
Turn Memory ON with Sliding Window = 10 (so it remembers when you ask follow-ups like “And what about Q1?”).

This is what makes it agentic — it can search, compute, and respond, and remember your conversation.

Step 8 — First test run
Right, now we are ready to run and test our RAG agent! We hit run and the nodes should all light up green. Let’s try: “What’s the travel budget for Q2?” → click Run.

We can see that all nodes run successfully and that the agent successfully provides an answer.
Behind the scenes, the assistant pulled the Q2 spreadsheet from Google Drive, looked at April–June spending across all departments, and added up the totals.
Instead of just dumping the table, it calculated:
Engineering: $14,000 + $13,500 + $15,000 = $42,500
Marketing: $11,000 + $12,000 + $12,500 = $35,500
…and so on.
Step 9 — Export to PDF
One thing that StackAI allows you to do is to download your answers in PDF format. In the Output block, just hit Download PDF.

This is a super handy feature — you can grab a snapshot of the answer and share it with your team, or even keep it as part of an audit trail so there’s a record of exactly what the assistant returned.
Step 10 — Publish the interface & do quick QA
Now that we’ve built and tested the workflow, the last step is to package it into an application that the Finance/Ops team can actually use day to day. For that, we are going to save our project and publish it. After that we click Export.

Why would you want to do this? Because it’s one thing to test answers inside the workflow builder, but it’s much more powerful when employees can interact with a simple app — type in their question, get back a clean answer, and even download results if they need to share them. This turns our prototype into a real, usable tool for the business.
In this exported app, we’re also testing out the “agentic” behaviors. Memory lets the assistant keep track of the conversation (so if you ask a follow-up like “And in Q1?” it knows you’re still talking about spend by department). Tools, like the calculator, let it go beyond retrieval and actually do the math for you.
The RAG part is still front and center — whenever you ask a question, the assistant is going back to Google Drive, pulling in the relevant rows from the spreadsheets, and grounding its answers in that data. That’s what makes the responses reliable and auditable. But the agentic part adds the extra layer of intelligence: remembering context, deciding when to calculate, and giving you exactly what you need instead of just dumping raw data.
Now, youhave a Finance/Ops helper that combines the trustworthiness of RAG with the flexibility of an agent.
Conclusion and final remarks
What we just built is a small but powerful example of what’s possible with Agentic RAG. Instead of manually opening spreadsheets and doing the math yourself, you can now ask natural questions and get quick, grounded answers.
And remember, we only scratched the surface. This same approach works not just with Google Drive, but also with SharePoint, OneDrive, and other knowledge sources your company already uses. You can add more tools (like a calculator for advanced metrics, or connectors to APIs), layer in memory for richer conversations, and customize the assistant’s personality and style to fit your team.
The takeaway is simple: Agentic RAG makes AI assistants more than just search engines. They become reliable, context-aware helpers that can actually save Finance, Ops, and HR teams hours of manual work.
If you’re ready to try it for yourself, head over to Stack AI, connect your own data, and start building. In just a few minutes, you can have your own assistant up and running.