Personalized Supplement Recommender

Using Agents and Knowledge Graphs

An AI-powered supplement safety advisor that analyzes your complete health profile to deliver personalized, evidence-grounded recommendations.

Neo4j Knowledge Graph LangGraph Agents Personalized Health

Introduction

Why does personalized supplementation matter?

Millions of people take dietary supplements every day - yet most recommendations come from one-size-fits-all lists that ignore your age, medications, existing conditions, and lifestyle. What's beneficial for one person can be harmful or redundant for another.

Our project addresses this gap by building a system that treats you as an individual. By combining a rich health knowledge graph with a multi-agent AI workflow, we can reason about your entire health profile and surface recommendations that are safe, relevant, and evidence-backed.

Generic Advice Falls Short

Most supplement guides ignore interactions with medications, pre-existing conditions, and individual nutritional gaps.

Health is Interconnected

Symptoms, nutrients, and conditions form a complex web. A knowledge graph lets us reason across these relationships.

AI That Understands Context

Agentic AI workflows can plan, verify safety, and synthesize a holistic answer - not just pattern-match keywords.

Data & Knowledge Graph

Building a map of human health

At the core of our system is a Neo4j knowledge graph that encodes relationships between supplements, nutrients, health conditions, symptoms, and medications. Rather than querying a flat table, our agents traverse this graph to understand why a recommendation makes sense.

Data Sources

  • Supplement ingredient databases
  • Clinical nutrition literature
  • Drug–nutrient interaction records
  • User health profile inputs

Graph Entities

  • Nodes: Supplements, nutrients, conditions, symptoms, medications
  • Edges: treats, interacts_with, deficiency_of, contraindicated

Why a Knowledge Graph?

Relational databases can't easily express multi-hop relationships. A graph lets us ask: "Which supplements help with heart health, are safe with metformin, and don't overlap with this person's current vegan diet?"

Technology

We use Neo4j as our graph database, with Cypher queries executed dynamically by agents during a live recommendation session.

Example Multi-Hop Reasoning

A user on Warfarin asks about heart health supplements. The graph surfaces CoQ10 and fish oil as common recommendations, immediately flags dangerous interactions with Warfarin through multi-hop paths, and suggests flaxseed oil as the safest alternative - all traced through explicit graph relationships.

    Heart disease → commonly treated by → Fish oil → contains → Icosapent → interacts with → Warfarin → not safe to recommend

System Architecture

How the agents work together

Our system uses a LangGraph multi-agent workflow where a central orchestrator decomposes your health query, dispatches specialized agents in parallel, and synthesizes their findings into a single personalized response. Built with LangGraph for stateful agent orchestration, Claude as the underlying LLM for each agent, and Neo4j Cypher queries for real-time graph traversal during each recommendation session.

__start__ entity_extractor entity_normalizer supervisor safety_check recommendation deficiency_check synthesis __end__
Technical Details

Linear Pre-Processing Pipeline

  • entity_extractor.py - Hybrid LLM parses unstructured natural-language user queries; structured profile inputs are parsed via deterministic rules. Extracts medications, supplements, conditions, and dietary restrictions.
  • entity_normalizer.py - Agent LLM reads schema.py and dynamically generates Cypher queries to map extracted entities to database IDs. Produces normalized medications_list, supplements_list, and dietary_restrictions_list.

Dynamic Routing Loop

  • supervisor.py - Agent Reads the full shared state (user query, profile, and completed specialist outputs). Reasons over question intent (safety, deficiency, recommendation, or combinations), determines what remains pending, and dynamically routes execution. Re-invoked after each specialist to enable iterative, state-aware control flow.
  • safety_check.py - Tool Executes hardcoded Cypher across four interaction pathways. Detects supplement–medication risks and returns severity with supporting evidence.
  • deficiency_check.py - Tool Executes hardcoded Cypher queries over diet-, supplement-, and medication-based pathways. Identifies nutrient deficiency risks from the user profile.
  • recommendation.py - Tool Executes hardcoded Cypher to retrieve supplements associated with user conditions. Returns a ranked list with per-supplement safety verdicts.

Final Output

  • synthesis_agent.py - Agent Aggregates all findings from shared state. Generates a personalized, evidence-based response with confidence-adjusted language and explicit knowledge-graph justifications.

Evaluation

How well does it actually work?

We tested the system with 62 golden-set test cases — real health scenarios with known correct answers verified against our knowledge graph. Every test ran through the full multi-agent pipeline and was manually rated.

81%
overall accuracy (50/62 correct)
3
false positives - traceable to minor graph quality issues
1
false negative (14/15 known interactions caught)
12
partial results, all from data gaps - never unsafe outputs
Test Suite Tests Correct Partial Accuracy
Safety Check 22 17 5 77%
Deficiency Check 12 12 0 100%
Recommendation 15 10 5 67%
Multi-Agent (E2E) 13 11 2 85%
Results Discussion

The system is strongest where it matters most - safety. It detected every known supplement-medication conflict including Fish Oil with Warfarin, CoQ10 with Metformin, and Aloe with Warfarin. Deficiency detection works across all three pathways (diet, medication, supplement) and correctly identifies compounded risks when multiple sources affect the same nutrient. The 12 partial results all trace to knowledge graph coverage gaps for common conditions (joint pain, fatigue, headaches) or minor data quality issues - not to the system giving dangerous advice.

Discussion

Limitations & Future Work

Limitations

  • Knowledge Graph Coverage: bounded by what DrugBank and Mayo Clinic provide - sufficient to demonstrate the architecture but not comprehensive. Small data quality issues can propagate through multi-hop reasoning and produce visible output errors.
  • Static Knowledge Base: a fixed snapshot that won't reflect newly discovered interactions or updated clinical guidelines until manually rebuilt.
  • LLM Reliability: the system relies on Claude (Anthropic API) for multiple reasoning steps, introducing risks of hallucination, inconsistency, and sensitivity to prompt phrasing - which could affect any stage of the pipeline.
  • Decision Support Only: the system is not a substitute for medical advice. All recommendations should be validated by a qualified healthcare provider.

Future Work & Improvements

  • Expanded Data Coverage: scale the knowledge graph to broader biomedical databases and capture richer patient context including lifestyle factors such as age, stress, and exercise.
  • Dynamic Knowledge Verification: cross-validate outputs against live biomedical data sources to surface newly updated interactions and guidelines.
  • Conversational Flexibility: support follow-up questions, comparative analysis, and symptom-based querying for a more interactive user experience.
  • Fully Agentic Graph Traversal: replace remaining hardcoded Cypher queries with LLM-generated queries across all agents, enabling more flexible and comprehensive graph reasoning.
  • Clinical Validation: evaluate outputs against pharmacist or physician review for safety and accuracy assessment.

Resources

Learn More

Demo Link
Project Repository
Report