Skip to content

Repository files navigation

Panacea — The Good Agent

An autonomous clinical research agent that turns any medical question into an interactive, evidence-backed disease-progression map.


What it does

Type a clinical question like "How does PCOS lead to peripheral neuropathy?" and Panacea:

  1. Runs a live multi-agent pipeline — classifies your query, plans sub-searches, retrieves PubMed + ClinicalTrials evidence in parallel, and extracts mechanistic claims — all streamed to an agent log in real time

  2. Builds a causal graph — maps the disease progression as a connected chain of nodes (e.g. PCOS → Insulin Resistance → Hyperglycemia → Peripheral Neuropathy → Numbness in Fingers) with confidence scores on every edge

  3. Lights up a 3D anatomical body — affected organs highlight as the agent identifies which tissues are involved in the pathway

  4. Click any node to see its supporting claim, evidence confidence, affected organs, upstream/downstream factors, open PubMed papers, and research gaps


Architecture

frontend/               Next.js 14 (TypeScript)
  app/api/research/     7-stage server-side agent pipeline
  lib/generate.ts       OpenAI causal graph generation
  components/           AgentLog, ResearchStage, 3D anatomy viewer, graph

panacea/                Python backend (FastAPI)
  server.py             SSE API — /stream, /graph, /clinical-graph
  orchestrator.py       Modal docking swarm driver
  clinical_agents.py    Four-agent clinical hypothesis panel
  research_loop.py      Iterative autoresearch loop
  graph.py              Live mechanism graph builder
  pipeline.py           Drug library + target pipeline

modal_app.py            Deployed docking functions (AutoDock Vina swarm)

Agent pipeline

Stage What it does
Query Classification Triages the question and checks for prior runs
Research Planning Decomposes into sub-queries across mechanisms, organs, biomarkers
Literature Retrieval (x2, parallel) Fetches PubMed abstracts + ClinicalTrials evidence
Evidence Extraction Parses abstracts into structured mechanistic claims
Graph Builder Synthesizes a causal progression network
Critic Validates citations, flags contradictions, checks claim strength
Refinement Loop Targeted re-search to close identified gaps

Plus a four-agent clinical panel (Forward Search, Reverse Search, Integration, Peer Review) for structured hypothesis evaluation on specific patient cases.


Setup

Frontend

cd frontend
npm install

Create frontend/.env.local:

OPENAI_API_KEY=sk-...
PANACEA_LLM=gpt-4o-mini   # optional, this is the default
npm run dev
# → http://localhost:3000

Python backend

Requires Python 3.11+ and uv.

uv sync
uv run uvicorn panacea.server:app --port 8000

Modal docking swarm (optional)

Only needed for the drug-repurposing docking mode.

uv run modal deploy modal_app.py

API endpoints

Endpoint Description
GET /health Health check
GET /stream?diseases=... Live docking swarm as Server-Sent Events
GET /graph?diseases=... Live mechanism graph as Server-Sent Events
GET /clinical-graph Four-agent clinical hypothesis stream

All streaming endpoints emit JSON events consumed by the frontend via EventSource.

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages