From RAG to Autonomous Data Analysis: My Google Cloud Gen AI Academy Journey
Building grounded AI, BigQuery data agents, secure sandbox execution, and human-in-the-loop workflows with Gemini, Google ADK, and Cloud Run

From RAG to Autonomous Data Analysis: My Google Cloud Gen AI Academy Journey
Building, deploying, and securing AI agents with Google ADK, Gemini, Cloud Run, BigQuery, Google Sheets, and Cloud Run Sandboxes
What happens when an AI agent moves beyond answering questions and starts retrieving data, analyzing it, executing code, and taking actionβwith human approval?
That was the question I explored while completing the three-track hands-on codelabs of the Google Cloud Gen AI Academy APAC Edition.
Over the three tracks, I progressively built three different capabilities:
Track 1 β RAG-powered AI application
Track 2 β Natural-language BigQuery data agent
Track 3 β Secure business-analysis agent with sandbox execution and human-in-the-loop actions
Rather than treating the codelabs as three isolated exercises, I looked at them as a progression toward something much more interesting:
An AI agent that can understand β retrieve β analyze β execute β recommend β act, while keeping humans in control.
π§ The Journey
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β GOOGLE CLOUD GEN AI JOURNEY β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
TRACK 1
β
βΌ
βββββββββββββββββββ
β RAG β
β β
β Retrieve data β
β Ground answers β
ββββββββββ¬βββββββββ
β
βΌ
TRACK 2
β
βΌ
βββββββββββββββββββ
β DATA AGENT β
β β
β Natural Languageβ
β β β
β BigQuery β
ββββββββββ¬βββββββββ
β
βΌ
TRACK 3
β
βΌ
ββββββββββββββββββββββββββ
β BUSINESS AGENT β
β β
β Analyze β Execute β
β Recommend β Approve β
β β β
β Action β
ββββββββββββββββββββββββββ
Each track introduced another layer of capability.
β Track 1 β Building a RAG AI Agent with Google ADK and Cloud Run
The first track focused on understanding the fundamentals of Retrieval-Augmented Generation (RAG).
The scenario was simple:
Build an AI barista that can recommend items from a coffee-shop menu without hallucinating products that don't exist.
But behind this simple example were several important AI engineering concepts.
What I built
The application used:
Google ADK
Gemini
Python
Streamlit
Cloud Run
A structured
menu.jsondataset
The architecture looked roughly like this:
USER
β
βΌ
ββββββββββββββββββββ
β Streamlit Chat UIβ
ββββββββββ¬ββββββββββ
β
βΌ
ββββββββββββββββββββ
β ADK Agent β
β Gemini Model β
ββββββββββ¬ββββββββββ
β
β Tool Call
βΌ
ββββββββββββββββββββ
β get_menu() β
ββββββββββ¬ββββββββββ
β
βΌ
menu.json
β
βΌ
Grounded Response
Instead of putting the entire menu directly into the agent's instructions, the agent could call a tool:
def get_menu() -> str:
with open("menu.json", "r") as f:
menu_data = json.load(f)
return json.dumps(menu_data)
The important idea here was grounding.
If the menu doesn't contain a matcha frappuccino, the agent shouldn't invent one.
For example:
User: Do you have a matcha frappuccino?
The expected behavior is essentially:
Sorry, that item isn't available on our menu.
That is much better than allowing a generative model to confidently create an imaginary product.
π§ Why Tool-Based Retrieval Matters
One of my biggest takeaways from Track 1 was that retrieval isn't only about accuracy.
It is also about context efficiency.
Imagine a coffee shop with:
8 products
500 products
50,000 products
Putting the entire dataset inside the system prompt becomes increasingly inefficient.
Instead:
User Question
β
βΌ
Does the agent need menu data?
β
YES
β
βΌ
Call retrieval tool
β
βΌ
Retrieve relevant data
β
βΌ
Generate grounded answer
This pattern becomes much more interesting when the data source evolves from a local JSON file to a managed database or vector search system.
π Deploying the Agent
The application was deployed to Cloud Run.
One useful lesson here was that source-based deployment can dramatically simplify the deployment process.
Instead of manually building and managing a container image, Cloud Run can use buildpacks to package the application.
Conceptually:
Python Source
β
βΌ
requirements.txt
β
βΌ
Cloud Build / Buildpacks
β
βΌ
Container
β
βΌ
Cloud Run
β
βΌ
Public AI Application
This made the transition from local prototype β cloud application surprisingly straightforward.
π Track 2 β Turning Natural Language into Data Analysis
The second track changed the problem completely.
Instead of asking an agent:
"What's on the coffee menu?"
the idea became:
"Ask questions about a real dataset using natural language."
For this track, I worked with the public New York Citi Bike dataset in BigQuery.
The dataset contained historical trip information and station information.
The trip table included information such as:
Trip duration
Start and stop times
Start and end stations
Bike IDs
Rider type
Gender
Birth year
Customer plan
The station information included:
Station location
Capacity
Available bikes
Available docks
Disabled bikes
Operational status
That creates a much more interesting environment for an AI data agent.
π From Question β Data β Answer
The core idea can be visualized like this:
USER
β
β
"Which stations
are busiest?"
β
βΌ
βββββββββββββββββ
β AI AGENT β
βββββββββ¬ββββββββ
β
βΌ
Understand intent
β
βΌ
Generate / execute
data query
β
βΌ
βββββββββββββββββ
β BigQuery β
β β
β Citi Bike β
β Dataset β
βββββββββ¬ββββββββ
β
βΌ
Query results
β
βΌ
βββββββββββββββββ
β Gemini Agent β
β interprets β
β results β
βββββββββ¬ββββββββ
β
βΌ
Human-friendly
answer
This is where the concept of an AI data analyst starts to become realistic.
Instead of requiring a user to know SQL, the user can communicate in natural language.
π§© Why This Is Different From Basic Chat
A normal chatbot might answer:
"Citi Bike is a bike-sharing system in New York."
A data agent can potentially answer questions such as:
"Which stations had the highest usage?"
"What was the average trip duration?"
"Compare subscriber and customer behavior."
"Which time periods experienced the highest demand?"
The important transition is:
LLM as a text generator
β
LLM as an interface to data
That distinction is extremely important for enterprise AI.
βοΈ Cloud Run + ADK
The agent was then deployed using Google Cloud infrastructure.
The architecture became:
USER
β
βΌ
ββββββββββββββββ
β ADK β
β Agent β
ββββββββ¬ββββββββ
β
βΌ
Google Cloud
/ Vertex AI
β
βΌ
BigQuery
β
βΌ
Data Results
β
βΌ
Natural Language
Response
This track made me think less about "How do I make a chatbot?"
and more about:
"How do I make an AI interface for an organization's data?"
π Track 3 β From Data Analysis to an Agent That Can Act
This was the track I found the most interesting.
The scenario:
A coffee shop is preparing for a huge university graduation weekend.
The agent receives historical Point-of-Sale data and a graduation ceremony schedule.
Its job is to discover operational bottlenecks.
But there is an important constraint:
The agent should not immediately change business data.
It should first analyze the situation, explain its findings, make recommendations, and ask for permission.
Only after explicit approval should it modify the spreadsheet.
This introduced something beyond RAG and data analysis:
Human-in-the-Loop AI
π§ The Track 3 Architecture
MANAGER
β
βΌ
ββββββββββββββββ
β Chat UI β
ββββββββ¬ββββββββ
β
βΌ
ββββββββββββββββ
β ADK Agent β
β β
β Gemini Model β
ββββββββ¬ββββββββ
β
βββββββββββββββΌβββββββββββββββ
β β β
βΌ βΌ βΌ
Google Sheets Sandbox Analysis
β β β
β βΌ β
β Python / Shell β
β execution β
β β β
βββββββββββββββΌβββββββββββββββ
β
βΌ
Insights & Findings
β
βΌ
Recommendations
β
βΌ
HUMAN APPROVAL
β
ββββββββ΄βββββββ
β β
NO YES
β β
βΌ βΌ
Stop Update Sheet
This architecture introduced a very important principle:
An agent should not necessarily be given unrestricted authority just because it can technically perform an action.
π§ͺ Why a Sandbox?
One of the most interesting components was the Cloud Run sandbox.
The agent can dynamically write and execute code to analyze information.
For example, rather than asking the LLM to mentally calculate everything, it can create a Python script to process the data.
Conceptually:
Business Question
β
βΌ
AI Agent
β
βΌ
Generate Python analysis
β
βΌ
Cloud Run Sandbox
β
βΌ
Execute code safely
β
βΌ
Analysis results
β
βΌ
AI interprets results
This is powerful because AI agents aren't limited to generating text.
They can become systems that:
reason β create code β execute β inspect results β reason again
π Finding Operational Bottlenecks
The sample POS data contained variables such as:
Drip Coffee
Cold Brew
Extra Espresso
Alternative Milk
Pastries
Cashiers Working
Wait Time
The agent was instructed to look for relationships between:
Demand + beverage complexity + staffing + wait time
For example:
High Cold Brew
+
High Extra Espresso
+
High Alternative Milk
+
Only 2 Cashiers
+
Wait Time > 10 minutes
β
βΌ
Potential fulfillment bottleneck
β
βΌ
Recommend Support Barista
This is more useful than simply reporting:
"Wait time was 12 minutes."
The agent tries to answer:
"Why did the wait time increase, and what should the manager do about it?"
That's the difference between descriptive analytics and decision-support AI.
β Human Approval Before Action
This was probably the most important design pattern in Track 3.
The agent doesn't immediately write recommendations into the spreadsheet.
Instead:
ANALYZE
β
DISCOVER
β
RECOMMEND
β
ASK FOR APPROVAL
β
βββββββββββββββββ
β Human decides β
βββββββββ¬ββββββββ
β
ββββββ΄βββββ
β β
YES NO
β β
βΌ βΌ
WRITE STOP
Only after explicit approval can the agent:
Check whether the
TODO-2026tab exists.Create it if necessary.
Add the approved tasks.
Confirm exactly what was written.
This is a practical example of human-in-the-loop agent design.
π Security Lessons I Took Away
The three tracks also changed how I think about AI security.
It is easy to focus on:
"Can the model answer correctly?"
But production AI requires another question:
"What is the model allowed to do?"
Track 3 demonstrated the Principle of Least Privilege by using a dedicated service account rather than giving the application unnecessarily broad permissions.
The conceptual model is:
AI AGENT
β
βΌ
βββββββββββββββ
β Permissions β
ββββββββ¬βββββββ
β
Only required
capabilities
β
ββββββββΌβββββββ
βΌ βΌ βΌ
Gemini Sheets Sandbox
This is a lesson I want to carry into future agent projects.
π‘οΈ Another Lesson: AI Needs Guardrails
Across the three tracks, I saw three different types of guardrails.
Track 1 β Data Guardrail
Only recommend products retrieved from the menu.
Track 2 β Data Access
Use the data source to answer analytical questions rather than inventing statistics.
Track 3 β Action Guardrail
Don't modify business data until a human explicitly approves the recommendation.
Together:
AI AGENT
β
βββββββββΌβββββββββ
βΌ βΌ βΌ
GROUND ACCESS ACTION
DATA CONTROL CONTROL
β β β
βΌ βΌ βΌ
RAG BigQuery Human
Approval
ποΈ The Technology Stack
The overall journey exposed me to a broad Google Cloud Gen AI stack:
| Layer | Technology |
|---|---|
| AI Models | Gemini |
| Agent Framework | Google ADK |
| Application | Python |
| UI | Streamlit / Web UI |
| Data | JSON / BigQuery / Google Sheets |
| Cloud Compute | Cloud Run |
| Code Execution | Cloud Run Sandbox |
| Analytics | BigQuery |
| Authentication | Google Cloud IAM |
| Deployment | Cloud Build / Cloud Run |
| API Integration | Google Cloud APIs |
π The Bigger Picture
Looking back at all three tracks, I see them as three stages of an agent's evolution.
Stage 1 β Grounded Generation
Question
β
Retrieve
β
Generate
Stage 2 β Data Intelligence
Question
β
Understand
β
Query Data
β
Analyze
β
Explain
Stage 3 β Agentic Decision Support
Question
β
Retrieve Data
β
Analyze
β
Execute Code
β
Discover Insight
β
Recommend Action
β
Human Approval
β
Take Action
That progression is what made completing the three tracks valuable to me.
π‘ What I Learned
The biggest lessons weren't simply about APIs or commands.
They were architectural.
1. RAG is about grounding
An AI system becomes much more useful when its responses are connected to trusted data.
2. Agents can become interfaces to data
Natural language can become an interface for users who don't know SQL or complex data systems.
3. Code execution expands agent capabilities
An agent can use code as a reasoning and analysis tool instead of relying entirely on language-model reasoning.
4. Permissions matter
An agent should receive only the permissions it actually needs.
5. Human approval is powerful
For business-critical actions, the best agent isn't necessarily the one that acts autonomously.
Sometimes the best design is:
AI recommends. Human decides. AI executes.
π What's Next?
These codelabs gave me a strong foundation, but they also raised bigger questions.
What happens if the local JSON data becomes a production database?
What happens when the agent needs persistent memory?
What happens when multiple agents collaborate?
What happens when the agent needs to monitor data continuously instead of waiting for a user prompt?
And most importantly:
How do we build agents that are not only intelligent, but reliable, secure, observable, and genuinely useful?
Those are the areas I want to explore next.
π― Final Takeaway
I started these codelabs thinking about Gemini and AI agents.
I finished them thinking much more about AI system architecture.
From a coffee menu:
RAG β Grounded answers
To Citi Bike:
Natural language β Data analysis
To a coffee-shop manager:
Data β Code execution β Insights β Recommendations β Human-approved action
The interesting part of agentic AI isn't simply making an AI that can talk.
It's building systems where AI can understand context, access the right data, use tools, reason over results, and safely participate in real workflows.
And that's the direction I'm excited to keep building toward. π
π§° Technologies explored
Google ADK β’ Gemini β’ Cloud Run β’ BigQuery β’ Google Sheets β’ Cloud Run Sandboxes β’ Python β’ Streamlit β’ IAM β’ Cloud Build
π¨βπ» About Me
I'm Mappillai Meeran, an MCA student and developer exploring AI agents, cloud technologies, full-stack development, and practical AI applications.
I'm particularly interested in moving beyond AI demos and building systems that solve real problems.
This is only the beginning. π
Tags
#GoogleCloud #GenerativeAI #Gemini #GoogleADK #AIAgents #CloudRun #BigQuery #VertexAI #Python #RAG #AgenticAI #MachineLearning #CloudComputing #AIEngineering #GenAI
About the author
- π Hi, Iβm Mappillai Meeran, an MCA student and developer passionate about AI Agents, Google Cloud, and full-stack development. I enjoy turning ideas into working products and learning by building. My interests include Generative AI, agentic systems, cloud computing, web development, and developer tools. Iβve worked with technologies such as Python, Java, JavaScript, React, Node.js, SQL, MongoDB, Google Cloud, Gemini, Google ADK, and Cloud Run. π I use this blog to document what I build, what I learn, technical experiments, project journeys, and lessons from hackathons and cloud/AI programs. Build β Break β Learn β Improve β Share. Always exploring whatβs possible with technology.
Comments
Join the discussionNo comments yet. Be the first to comment.
