Answer questions about my own Fitbit data with a receipt for every number

Karthickbalaje built a Gemini agent that answers questions about their own Fitbit and journal data by writing and running SQL or Python, attaching re-runnable code to each figure for about $0.008 a question.

Done withCustom agentinGoogle Health· Oct 31, 2026

What they did

The author, Karthickbalaje, wanted a health assistant that computes figures instead of recalling them. A scheduled Cloud Run job pulls 33 data types from their Fitbit through the Google Health API, an evening mood and energy journal from a Google Form, and local weather, then stores it all in one SQLite file. A single agent built on Google's Agent Development Kit with Gemini Flash-Lite answers plain-language questions in a tool loop: it checks which metrics exist, writes read-only SQL, runs Python in a sandbox with no network, and attaches a receipt (code, data hash, output) to every number. A plain code check after the model flags any figure no tool produced. It runs from a laptop command line and a private web app.

How it went

The first version was a router feeding several specialist agents and a writer. When the author labelled 30 of its answers, 14 failed, mostly because revisions went to the one node with no tools. Labelling 110 real answers found 32 failures; after switching to one agent with tools, a blind judge preferred the new answers 92 to 14, and 29 of the 32 failures improved. Each question costs about $0.008 and takes a median 9 seconds; running costs are around $0.10 a month.

Worth knowing

The published scores come from synthetic test data for one person, so the error bars are wide. Keeping the raw API payloads mattered: an early version overstated sleep by over half an hour a night until sleep stages were rebuilt from them. The agent has no tool that can send data out, which the author treats as the main defence against injected text in journal notes.

Try it

With Custom agent· 2 parts to fill in

You have read-only access to my health data in [database or export, e.g. a SQLite file of Fitbit and journal data]. When I ask a question like [example question], first list which metrics and dates exist and where data is missing. Then answer only by writing and running SQL or Python against that data; never state a number you did not compute. After each number, show the code you ran and its output so I can re-run it. Count days with no data as gaps, not zeros, and say how many days the answer covers. Do not diagnose anything; if a result looks like a medical concern, tell me to see a doctor and stop.

Square brackets are the parts to fill in. The prompt is ours; the story is theirs.

Where they said it

Related