Inspiration

Pharmacovigilance monitoring drugs for adverse effects after market approval is a $5 billion/year industry that still relies heavily on manual review. The FDA receives over 800,000 adverse event reports every year, and dangerous safety signals can go undetected for months, putting patients at risk. Manual review cycles take 2–6 weeks per signal.

We asked ourselves: what if AI agents could autonomously scan half a million records, detect hidden safety signals, and generate a regulatory-ready report all in under 2 minutes?

That's exactly what SignalShield AI does.

What It Does

SignalShield AI deploys 4 specialized AI agents that work together autonomously:

  • Master Orchestrator — classifies user intent and routes to 7 distinct pipelines
  • Signal Scanner — scans 500K FAERS records using ES|QL to detect statistical anomalies
  • Case Investigator — deep-dives into demographics, co-medications, severity, and geography
  • Safety Reporter — generates FDA MedWatch-style regulatory reports with PDF export

It also includes a RAG-powered knowledge base using ELSER semantic search, so users can ask complex questions like "What are the contraindications of Cardizol-X?" and get grounded, citation-backed answers with zero hallucinations.

The frontend features a premium glassmorphism dashboard with real-time agent reasoning transparency you can watch every ES|QL query and tool invocation as it happens, streamed word-by-word like ChatGPT.

How We Built It

  • Orchestration: LangGraph StateGraph for deterministic multi-agent routing across 7 paths
  • Tool Access: 11 custom ES|QL tools registered in Elastic Agent Builder for complex statistical queries
  • RAG: ELSER v2 semantic vector search over drug labels, pharmacovigilance methodology, and regulatory guidelines
  • LLM: Groq (Llama 3.3 70B) for classification, direct answers, and conversational responses
  • Backend: FastAPI with WebSocket streaming for real-time reasoning transparency
  • Frontend: React 19 + Vite with dark-mode glassmorphism UI and PDF report export
  • Data: 500,000 synthetic FAERS records with 3 embedded safety signals the agents must detect
  • CI/CD: Docker multi-stage build with GitHub Actions

Our agents compute the Proportional Reporting Ratio (PRR) to flag disproportionate drug-reaction pairs and detect temporal spikes by comparing 90-day rates against 365-day baselines.

Challenges We Ran Into

  1. Elastic Agent Builder returns free-text LLM responses. We built robust regex parsers with multi-layer fallbacks to extract structured signal data (PRR values, case counts, spike ratios) from natural language.

  2. Not every query needs database tools. We designed a hybrid architecture where knowledge questions bypass Agent Builder and go straight to Groq (fast, zero overhead), while data queries route through Elastic agents with full ES|QL tool access.

  3. Streaming step-by-step agent reasoning to the frontend required careful WebSocket event design and handling race conditions between concurrent tool calls.

  4. We implemented a two-tier RAG retrieval strategy (ELSER semantic search then BM25 fallback) with explicit prompt engineering to prevent the LLM from fabricating drug safety data.

Accomplishments That We're Proud Of

  • End-to-end investigation from natural language to regulatory PDF report in under 2 minutes
  • 4 agents with 11 custom ES|QL tools deployed natively in Elastic Agent Builder
  • 7-route intelligent classification with zero-shot LLM routing
  • RAG pipeline using ELSER v2 that eliminates hallucinations for complex pharma questions
  • Premium full-stack UI with real-time agent reasoning visualization
  • Comprehensive automated test suite covering routing, RAG accuracy, and full pipelines

What We Learned

  • Elastic Agent Builder is incredibly powerful for deploying domain-specific AI agents with structured tool access. ES|QL tools enable complex statistical queries impossible with raw LLM inference.
  • ELSER v2 provides remarkably accurate semantic retrieval for specialized pharmacovigilance terminology.
  • LangGraph's deterministic state machine approach gives predictability that pure LLM chaining lacks essential for safety-critical applications.
  • Showing users every reasoning step dramatically improves trust in autonomous AI systems.

What's Next for SignalShield AI

  • Connect to real FDA FAERS OpenFDA API for live adverse event monitoring
  • Interactive data visualization dashboards with charts and geographic heatmaps
  • Automated scheduled scans with email/Slack alert notifications
  • ICH E2B(R3) XML report generation for direct regulatory submission

Built With

Share this project:

Updates