PedigreeGraph: Built an AI agent that reads a family tree
Built for Graph Hacks: Context for AI Agents (FalkorDB x WeMakeDevs), Track 01: Agents That Act on Connected Data. The story nobody told Most of us know our families through stories: who laughed the loudest,
Built for Graph Hacks: Context for AI Agents (FalkorDB x WeMakeDevs), Track 01: Agents That Act on Connected Data.
The story nobody told
Most of us know our families through stories: who laughed the loudest, who cooked the best, who we lost too soon. But some stories are never told, because nobody knew they were there.
Beta-thalassemia is one of them. One ICMR estimate puts the number of carriers in India at 35 to 45 million, based on a carrier rate of roughly 3.5 to 4 per cent (source). Other sources give slightly different figures, so read it as a rough scale. The hard part is that carriers usually have no symptoms, so they have no reason to suspect anything. When both partners are carriers, each pregnancy has a 25 per cent chance of a child born with thalassemia major (source).
Nobody in that story did anything wrong. They just didn't know.
That made me think: the warning signs are often already in the family, in who is related to whom, who is affected, and who shares ancestors. That is a graph.
My demo video: https://youtu.be/-cMjirH7sjw
What I built
PedigreeGraph stores 30 synthetic families (540 people) in FalkorDB. An AI agent, running on Gemini, answers questions like "What is the risk picture for FAM1_P14?" or "Who should be tested first in FAM3?" by calling graph tools. Every answer shows the family path behind it, highlighted on a drawn pedigree. Clicking any person gives an instant report with no AI call at all.
All data is synthetic. The condition names are real (beta-thalassemia, cystic fibrosis, sickle cell disease, Tay-Sachs disease, familial hypercholesterolemia), but only the inheritance pattern is modelled. This is family-history risk awareness, not a diagnosis.
Try it: https://pedigreegraph.onrender.com/
Try your own family: https://pedigreegraph.onrender.com/custom
The graph model
It is deliberately small:
(:Person {id, family, condition, sex, generation, affected, tested})
(:Person)-[:PARENT_OF]->(:Person)
(:Person)-[:PARTNER_OF]->(:Person)
That is 540 people, 780 PARENT_OF edges and 150 PARTNER_OF edges. The graph only stores what a genetic counselor could observe. The true genotypes and the inheritance mode live outside it, so the agent can't cheat.
Where the graph does the work
The questions that matter are about relationships, and they are multi-hop Cypher queries.
Obligate carriers. An unaffected parent of an affected child must carry a recessive allele:
MATCH (par:Person {family:$fam})-[:PARENT_OF]->(c:Person {family:$fam, affected:true})
WHERE NOT par.affected
RETURN par.id, collect(c.id)
Shared ancestors. Two partners are related if they descend from the same person. Two variable-length patterns meet at the same ancestor:
MATCH (a:Person {family:$fam})-[:PARTNER_OF]->(b:Person {family:$fam}),
(anc:Person)-[:PARENT_OF*1..3]->(a),
(anc)-[:PARENT_OF*1..3]->(b)
RETURN a.id, b.id, collect(DISTINCT anc.id)
The shortest family path from a person to the nearest affected relative. This becomes the red line on the tree:
MATCH p = (a:Person {id:$id})-[:PARENT_OF*1..6]-(b:Person {family:$fam, affected:true})
WHERE b.id <> $id
RETURN [n IN nodes(p) | n.id] AS path, length(p) AS hops
ORDER BY hops LIMIT 1
There are also queries for each person's affected relatives, from siblings and grandparents to aunts, uncles, nieces and nephews.
In the demo family FAM1, two cousins (FAM1_P10 and FAM1_P14) are partners and already have an affected child. The graph finds their shared grandparents on its own, and the exact genetics gives a 25 percent chance for each future child.
The AI never does the maths
The language model never calculates risk. It chooses tools and explains the results. The probabilities come from deterministic code that uses exact variable elimination on the pedigree, so a shared ancestor is counted correctly.
One honest limitation: that calculation runs in Python over the family structure read from FalkorDB, not inside the database.
To check the graph side, I wrote test_cypher.py. It compares every Cypher query with an independent pure-Python implementation for every person in every family, and it passes with no mismatches against FalkorDB Cloud.
Careful wording
A tool like this must not scare people or promise outcomes. It never says "you will get X". It says things like "higher chance" and "discuss this with a doctor or genetic counsellor", and it points to carrier screening, which is a simple blood test.
Update: try your own family
After recording my demo video, I added a /custom page where you can describe your own family of 20 to 50 people: nicknames, sex, who is affected, parents and partners. Click anyone for the same report as the demo families.
For each report the app builds a temporary graph in FalkorDB with a random name, runs the same Cypher queries and exact genetics, then deletes the graph. Nothing is saved. Use nicknames, not real names.
Two things made this possible. First, my original genetics code listed every genotype combination, which became too slow beyond about 20 people. I replaced it with variable elimination on the pedigree. It is still exact, and a 50-person family now takes a fraction of a second. I compared it with the original engine, and the results were identical on all 30 demo families.
Second, there is now an AI chat for your own family. It only receives the family you entered and the report of the person you last clicked, and it quotes the numbers from that report instead of calculating its own. If you ask about someone whose report you haven't generated, it tells you to click them first. The family and your question are sent to Gemini to write the answer, and the app does not save them.
What I would do next
- Run the probability maths inside the graph, or compare it against a graph algorithm.
- Add X-linked conditions and age of onset.
- Support larger families and more conditions.
Built with AI assistance
Claude (Anthropic) helped design the approach and wrote much of the code, and Gemini is the LLM inside the agent. I came up with this idea, set up Docker and FalkorDB Cloud, ran and verified every script, enlarged the dataset, tested the app and agent, and deployed it on Render.
Links
- Live demo: https://pedigreegraph.onrender.com
- Code: https://github.com/vani-crypto-tech/pedigreegraph
- Video: https://youtu.be/-cMjirH7sjw
If a family tree is already a graph, maybe it's time we read it before it surprises us.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.