MAMA – Brief Description

Problem Solved

Nigeria accounts for 27% of the global malaria burden, and pregnant women are the most vulnerable. Community health workers face a 1:10,000 ratio with no decision support, while overlapping symptoms make accurate diagnosis difficult. Supply chains are unreliable, with disruption rates exceeding 50% in some regions, rendering many prescriptions useless before the patient even gets home.

What MAMA Does

MAMA (Maternal Artificial Multi-agent Assistant) is a multi-step AI agent built with Elastic Agent Builder, which helps Nigerian health workers diagnose and manage malaria in pregnancy across all six geopolitical zones. It orchestrates a "Triangle of Reasoning" within a single Gemini-powered agent:

  • Analyst — calls an ES|QL tool (get_malaria_trends) to retrieve 10 years of malaria data, calculating the average burden and a disruption rate (percentage of months with supply interruptions).

  • Clinician — applies trimester-specific treatment protocols (e.g., Artemether-Lumefantrine is contraindicated in the first trimester; Quinine + Clindamycin is safe).

  • Logistician — calls another ES|QL tool (check_pharmacy_inventory) to verify drug stock and return an alert level (OK / WARNING / URGENT).

  • Dr. Verify — an adversarial internal reviewer that always raises at least one challenge — because a review where nothing is questioned is a rubber stamp, not a safeguard — forcing MAMA to defend or revise its recommendation before it reaches the patient.

The final output includes risk analysis, diagnosis, safety review, and treatment plan, stock status, review notes, and follow-up instructions, all in a structured, health-worker-friendly format.

Features Used

  • ES|QL with TO_INTEGER and CASE logic for conditional aggregations and dynamic stock alerts
  • Multi-step reasoning across two custom tools and an internal review loop
  • Adversarial internal review implemented entirely via prompt engineering

Challenges and Features I Liked

Mastering ES|QL syntax was the steepest learning curve, discovering TO_INTEGER(condition) unlocked conditional aggregations that made disruption-rate calculations possible. Designing Dr. Verify to be genuinely adversarial required iterative tweaking; adding the rule "Dr. Verify must always find something to question" transformed output quality. I also loved how seamlessly Agent Builder integrates tool execution with LLM reasoning, no glue code needed, just clear instructions and well-designed tools.

Impact

MAMA reduces diagnosis time from 45 minutes to under 2 minutes, catches contraindications that could harm fetuses, and accounts for real supply chain disruptions, putting world-class clinical reasoning in the hands of every community health worker in Nigeria.

Built With

  • elasticagentbuilder
  • elasticcloud
  • elasticcloudserverless
  • es|ql
  • gemini-1.5-pro
  • github
  • querrylanguage
  • vertexai
Share this project:

Updates