← Aditya Kumar, all work

I made an AI health coach agent 15x cheaper.

The agent turns a blood test into a personal diet and workout plan. Now rules make the decisions and AI only writes.

Aditya Kumar, Founding Software Engineer. I built it alone, including the quality checks and stress tests.

15x
lower AI cost for each plan, from ₹73 down to ₹4.7
780
plans an hour from one small server
0
plans lost when 100 patients sent their forms in the same minute
505
sample questionnaires the rules are tested on
1,000+
diet and workout plans made so far

A diet and workout plan in minutes, built from a blood test.

Labs we partner with offer the agent to patients after their blood test.

1

Patient fills a short form

  • Goals
  • Food habits
  • Daily routine
  • Blood report from the lab
2

Rules make the decisions

  • Works out daily calories
  • Finds results out of range
  • Shortlists the diet styles that fit
  • Same answer every time
AI

AI writes the plans

  • Writes all four PDFs
  • Stays inside the limits the rules set
  • Runs on a smaller, cheaper model
4

Sent on WhatsApp

Diet planPDF
Workout planPDF
Habit GuidePDF
Food GuidePDF

A lab with 100 patients a day would have paid ₹2.19 lakh a month in AI fees. Now it pays ₹36,600, or ₹14,100 with the cheaper model.

The first version used AI for six jobs. Most of them didn't need it.

That made each plan cost ₹73, and running it twice for the same patient could give two different plans.

First version: six AI calls

₹73
Calorie mathsAIAI double checked each patient's calorie numbers and explained its working.
Diet approachAIAI read through every diet style we had, and sometimes made up a new one.
MethodsAIAI picked the habits and diet methods, and wrote a reason for each.
Care summaryAIAI wrote the patient's whole care story: who they are, their goals, health, food habits and what could make them slip. About 13,000 characters.
Meal planAIThe biggest, most expensive model wrote a 7 day plan.
Nine documentsAINine separate AI calls, and each one sent the same patient details again.

Rebuilt: three AI calls

₹12
Calorie mathsrulesNow a simple formula. It costs nothing and answers instantly.
Diet approachrules, then AI picksRules shortlist the diet styles that fit. AI picks one from that list, and any other answer is rejected.
MethodsrulesNow chosen by rules, from the patient's answers and blood results.
Care summaryremovedNot written any more. Each step gets the patient's facts straight from the rules.
Meal plansmaller AIA smaller model writes it, inside the numbers the rules set.
Workout and care guides1 AI callOne AI call writes all three: the workout plan, the Habit Guide and the Food Guide.
With the cheaper GLM 5.2 model, the same plan costs ₹4.7.

Why I built it this way.

Rules for decisions, AI for writing

Even a cheaper AI can give the same patient two different plans. Rules give the same answer every time, and I can test them. The rules are tested on 505 sample questionnaires.

Smaller models, once the rules were in place

With rules setting the numbers, the meal plan no longer needed the biggest model. I ran the cheaper GLM 5.2 model on 100 patients at $0.054 a plan (under ₹5). In a separate check, a second AI compared its plans with the top model's plans for the same patients (the “LLM as a judge” method), and they matched.

Let a rush wait in line

The server makes two PDFs at a time on purpose. When many patients arrive at once, they wait a few extra minutes and nothing breaks.

100 patients in one minute. Every plan delivered.

I ran a stress test on a copy of our live server, a small machine with two processors. 100 test patients sent their forms in the same minute.

minute 0.00 of 100 delivered
each dot is one patient; it turns green when all 4 PDFs arrive
780

plans an hour, at full speed

Once it is busy, the server finishes about 13 plans every minute. 100 patients in one minute is as many as a typical small lab sees in a whole day.

The first plans arrived after 6.8 minutes and the last after 14.1. The server never used more than about a ninth of its memory.

One server is enough for about 90 typical labs.

How many patients different labs see in a day, next to how many plans one server can make in a 12 hour day.

India has more than 1.3 lakh diagnostic labs, and most of them are small, single labs. Bigger chains need more servers: the largest national chain would need about nine.

If your team is saying any of these, I can help.

“Our AI bill grows faster than our users.”

I move the decisions into code, keep AI for the writing and use the smallest model that keeps the quality.

“It gives a different answer every time.”

I turn the decisions into rules, so the same input gets the same answer, and test them on real cases before release.

“It works in the demo but breaks with real users.”

I stress test it and add a waiting line, so a rush slows things down instead of breaking them.

“We need someone to own our AI, end to end.”

I built this agent alone, from the first prompt to the plan on a patient's phone, tests included.

Aditya KumarFounding Software Engineer

Built with Python, FastAPI, Gemini on Vertex AI (Google Cloud), MongoDB, Playwright, the WhatsApp Cloud API and Claude Code.

Book a call →