
I’m taking a nutrition course this winter (as one does for fun). Then I got the idea to build a personal agent based on the course materials to help me keep track of my nutrition, with a frontend UI designed just for me.
Here are the details
- Google ADK & Gemini 4 Hydrogen — Gemini 4 Hydrogen answers my quick questions, like “what should I have for a snack” or “I couldn’t resist the popchips. Help me save this as a new food item,” and also helps me with meal planning for the day. TypeScript handles the math.
- Cloud Run instances — for hosting the web app. A Cloud Run instance provides me with a cost-effective, dedicated singleton container instance (think min & max instances = 1) that is long-lived (e.g. 7 days until restart) with a URL. My agent is ready-to-go whenever I need to log something or ask a question.
- SQLite on Cloud Storage — Stores all food logs, meal plans, chat history, and nutrition course embeddings (more on this below) in one SQLite file on a Cloud Storage FUSE volume. FYI, you have to use PRAGMA journal_mode = MEMORY to run SQLite over GCS FUSE without journal write errors. The Cloud Run instance singleton avoids lock contention. My coding agent really wanted me to add the part about PRAGMA to the blog post 🤷
- Auth — I debated briefly whether to use Firebase Auth vs IAP (either will work here), but for my use case, IAP for Cloud Run was the clear winner. I use my Google Account to sign-in, so Auth is done at the edge before traffic reaches the container instance. And with IAP, no load balancer is required.
- RAG in SQLite (w/o a separate vector DB) — The nutrition course material was quite large. It is split into chunks, then embedded once with Vertex AI text-embedding-005, and lastly searched in memory. Pulling only the top few chunks (approx 1,000 tokens) keeps replies fast and cheaper compared to sending the very large nutrition course material on every turn. Ask me how I know this! 🙂
- Search sub-agent + Human-in-the-Loop approvals — A dedicated ADK sub-agent uses Google Search grounding to look up nutrition facts, e.g. I’m about to eat at a restaurant and need a back-of-the-envelope guess at the nutritional contents for a turkey sandwich. Before saving any new food to SQLite, the agent pauses and waits for an explicit Human in the Loop approve & save click in the UI.
- Model Armor — Reviews web search results before the coach agent sees them. It also reviews the final reply before returning it to the browser. More info here.
A couple of other fun technical features to try:
- SSH for Cloud Run — if I need to take a closer look at logs or see what happens if i make small tweaks
- sandboxes — if I decide in the future I want my agent to write code and safely execute it on the fly, e.g. charting my weekly nutrition trends.
Lastly, here are a couple of screenshots…

and asking my AI agent to save my popchips to my food database.

And human in the loop to save the popchips

Building my personal nutrition-tracking agent running on a Cloud Run instance was originally published in Google Cloud – Community on Medium, where people are continuing the conversation by highlighting and responding to this story.
Source Credit: https://medium.com/google-cloud/building-my-personal-nutrition-tracking-agent-running-on-a-cloud-run-instance-fe5aeaf6bd4c?source=rss—-e52cf94d98af—4
