Leveraging an AI Agentic Workflow for Personalized Health Insights

An in-depth look at a multi‑agent system that analyzes time‑series health data to provide actionable recommendations.

For AI engineers, health enthusiasts, and AI/LLM researchers.


The Agentic Workflow at a Glance

“Collecting data is easy—making sense of it is where the magic happens.”

Modern wearables stream thousands of data points each day. Our multi‑agent framework turns this raw torrent into concise, personalised advice by letting a small team of AI specialists collaborate in an agentic loop. Below we’ll peel back the layers—from the high‑level loop to low‑level implementation details—before finishing with the big picture: why agentic design matters for the future of health tech.


1. The Agentic Loop: A Symphony of Specialists

EventProcessor  Orchestrator  ( Summarizer  Analysis ) 
                                    ResultsManager  ReportAgent
  1. Event identificationEventProcessor flags a significant glucose dip/spike.
  2. Context windowOrchestrator selects ±30 min around the event.
  3. Narrative summarySummarizer converts sensor rows into plain English.
  4. Decision makingAnalysis decides final vs needs_more_data.
  5. Iteration – Orchestrator widens/narrows the window based on hints until Analysis returns final or a pass limit is reached.
  6. PersistenceResultsManager stores structured conclusions.
  7. AggregationReportAgent stitches many events into a longitudinal report.

2. Meet the Agents

2.1 EventProcessor — The Gatekeeper

{
  "id": 1,
  "type": "dip",
  "start": 1742743620,
  "end":   1742744520,
  "baseline_glucose": 87.5,
  "nadir_glucose": 81.0
}

Monitors streaming data, emits discrete “events”, and kicks off orchestration.

2.2 OrchestratorAgent — The Conductor

Handles window management, caching, and loop control.

for _ in range(self.max_passes):
    self._summary_cached.cache_clear()
    summary   = self._summary_cached(*window)
    analysis  = self.analysis.analyse(event_id, summary)
    if analysis["status"] == "final":
        write_result(event_id, analysis)
        break
    window = self._refine_window(window, analysis["missing_signals"])

2.3 SummarizerAgent — The Storyteller

Converts numeric trends into natural‑language timelines:

“Between 13:47 and 14:02, glucose fell from 88→81 mg/dL… Heart‑rate hovered at 94–98 bpm despite only 12 steps recorded. SpO₂ stable at 96–97 %.”

2.4 AnalysisAgent — The Decision‑Maker

Returns strict‑schema JSON. Example final verdict:

{
  "status": "final",
  "confidence": 0.85,
  "conclusion": "Sustained tachycardia likely compensatory to mild desaturation, amplified by acute stress spikes.",
  "recommendations": [
    "5 min diaphragmatic breathing twice daily",
    "20 min brisk walking ×3/week",
    "7‑day stress‑reflection journal"
  ]
}

2.5 ReportAgent — The Synthesiser

Aggregates many event results into a unified report for clinicians and users alike.


3. System Architecture

3.1 High‑Level Picture

JSON (glucose_events_v3)  EventProcessor
                           Orchestrator  Summarizer
                                           Analysis
                                           ResultsManager (event_results.json)
ReportAgent (update_report.py)  report.json

3.2 Detailed Flow

| Step | Caller → Callee | Key I/O | Purpose | | ---- | --------------------------------- | ---------------------------------------- | -------------------------- | | 0 | EventProcessor → Orchestrator | event, timeseries | Kick‑off per event | | 1 | Orchestrator | initial window | Give context | | 2 | Summarizer → Analysis loop | natural‑language summary ↔ decision JSON | Iterate until final | | 3 | Orchestrator | refine window | Zoom/extend based on hints | | 4 | Orchestrator | persist result | Success / Pending | | 5 | ReportAgent | patch report | Holistic advice |

3.3 Implementation Notes

  • LRU caching avoids duplicate LLM queries for identical windows.
  • Strict schema keeps the loop robust—malformed JSON downgrades to needs_more_data instead of crashing.
  • Resumable JSON artifacts mean you can pause and resume long analyses.
  • Timezone localisation: raw UTC → Europe/Berlin for human readability.

3.4 End‑to‑End Example (Event ID 1)

  1. Dip detected → window set to 30 min pre/post.
  2. Summariser narrative produced.
  3. Analysis requests suggest_extend_left; window shifts.
  4. After ≤40 passes Analysis returns final; result persisted.
  5. ReportAgent later adds conclusion C1 and recommendation R1 to report.json.

3.5 What “Agentic Loop” Really Means

  • Agents = focused LLM tools.
  • Loop = Orchestrator orchestrating conversation context.
  • Tools = easily extendable (e.g., meal lookup).
  • Separation of concerns = modular, testable code.

4. Project Repository

The complete implementation is open‑source on GitHub: pranav-ghoghari/health_data_aggr.


5. Conclusion: Why Agentic Design Matters for Personalised Health

Breaking a complex analysis into cooperative micro‑tasks lets each agent specialise, iterate, and verify the others’ work. The result is a scalable, interpretable pipeline that turns noisy wearable data into clear, actionable guidance.

Personalised health isn’t just about collecting data—it's about understanding it. With an agentic workflow, a virtual team of AI specialists can provide the kind of continually‑updated insights that once required a room full of human experts.

The future of wellness may well be powered by conversations—between you and a carefully‑choreographed ensemble of AI agents.

Pranav Ghoghari