Problem
Komodo Health holds a large database of anonymised medical events of US patients. Users ask for counts and cohorts such as "male patients above 59 with diabetes or psoriasis". A plain LLM cannot answer: it does not know the data and may invent numbers. In healthcare a wrong number is unacceptable, yet the assistant must still handle unplanned questions.
Example from the article: "How many patients were diagnosed with hypertension in Florida last year?" must become a structured API query, and the card shown to the user must contain the raw database output.
Solution in brief
The LLM never writes the numbers. It turns the question into a structured object and calls tools whose raw output is shown to the user. An agent supervisor routes each question, and ReAct sub-agents run only where deterministic code cannot do the job.
Questions this case answers
- How to let non-experts query a large structured database in natural language when every number shown must come from the database and never from the model
- How to evaluate a non-deterministic agent system automatically when only the final structured tool call is predictable
- How to build an assistant that answers analytic questions over a large patient-event database without hallucinated numbers?
- How to choose between a router, a multi-agent system and a single agent for a natural-language analytics assistant?
Tools and methods
- Supervisor agent — fixes typos, answers unexpected questions, delegates to workflows or sub-agents
- ReAct sub-agents — only for hard subtasks, such as mapping disease names to codes
- Tool calling with structured payloads — the LLM builds the payload, code runs the query and renders the card
- Automatic tests on tool output — compare the final JSON with the expected one
- LangGraph — the framework the team prefers over LangChain
- Langfuse — traces tokens, latency and tool calls
Google or a one-time email code. No password.