The World’s First C++ Accelerated, Multi-Agent Virtual Multidisciplinary Team (MDT)
BioTwin is a next-generation clinical copilot designed to prevent fragmented medical care for multi-morbid patients. It leverages parallel LLM personas (Cardiologist, Nephrologist, Endocrinologist) to debate clinical workflows, which are then strictly evaluated against a deterministic C++ constraint engine (HERA) to enforce physiological and socioeconomic limits.
Modern medicine suffers from severe fragmentation. A patient with Diabetes, Hypertension, and CKD might receive conflicting prescriptions from three different specialists, leading to catastrophic drug-drug interactions or unaffordable copays.
BioTwin solves this by simulating the Multidisciplinary Team (MDT) meeting.
Instead of relying on a single, hallucination-prone LLM, BioTwin utilizes an advanced Agent Negotiation Protocol. Specialized LLMs debate the patient's case, while the Health Economics & Resource Agent (HERA)—powered by a custom-compiled C++ graph engine—acts as a ruthless safety net, vetoing any AI proposal that violates strict medical, biological, or economic constraints.
Crucially, the human doctor always retains the final say. BioTwin is a decision-support copilot, featuring a robust Physician Override mechanism.
BioTwin is engineered for absolute deterministic safety combined with generative flexibility.
flowchart TB
classDef ui fill:#000,stroke:#fff,color:#fff,rx:8px
classDef node fill:#339933,stroke:#fff,color:#fff,rx:8px
classDef cpp fill:#00599C,stroke:#fff,color:#fff,rx:8px
classDef db fill:#47A248,stroke:#fff,color:#fff,rx:8px
classDef cache fill:#DC382D,stroke:#fff,color:#fff,rx:8px
classDef ai fill:#00A67E,stroke:#fff,color:#fff,rx:8px
subgraph "Frontend Layer (Next.js & React)"
Dashboard["🏥 Physician Dashboard\n(React / TailwindCSS)"]:::ui
Telemetry["📡 Live Telemetry Viewer\n(WebSockets)"]:::ui
end
subgraph "Backend Layer (Node.js & Express)"
API["🔌 API Gateway & Auth"]:::node
WS["⚡ WebSocket Server"]:::node
Orchestrator["🧠 Multi-Agent Orchestrator\n(Parallel Agent Spawning)"]:::node
end
subgraph "Data Storage"
MongoDB[("🍃 MongoDB\n(Patient Phenotypes)")]:::db
Redis[("⚡ Redis\n(Drug Intel Caching)")]:::cache
end
subgraph "AI Deliberation Layer"
LLM["🤖 OpenAI GPT-4 / Gemini\n(Cardiologist, Nephrologist, etc.)"]:::ai
end
subgraph "Deterministic Safety Layer"
HERA["🛡️ HERA Engine\n(C++ Constraint Graph)"]:::cpp
end
%% Client to Server Links
Dashboard <-->|REST API| API
Telemetry <-->|Live Data Stream| WS
%% Internal Server Links
API --> Orchestrator
Orchestrator -->|Push Updates| WS
API <--> MongoDB
Orchestrator <--> Redis
%% Orchestrator to AI
Orchestrator <-->|Clinical Debate| LLM
%% Orchestrator to Safety Engine
Orchestrator <-->|"O(1) Veto / Validation via node-addon-api"| HERA
- Parallel Deliberation: The backend dynamically spawns distinct LLM personas (e.g., Cardiologist, Nephrologist).
- Context Isolation: Each agent only receives the biomarkers and history relevant to their specialty, preventing context bloat and hallucination.
- Consensus Generation: Agents debate iteratively until a unified protocol is formed.
You cannot trust LLMs with hard mathematical constraints like "$150/mo budget" or "GFR < 30 absolute contraindication."
-
Native Node-Addon: BioTwin uses a custom
hera_graph.nodeC++ binary bound to Node.js vianode-addon-api. -
$O(1)$ Verification: The proposed protocol is passed from the LLMs to the C++ engine, which traverses a directed acyclic graph (DAG) of the patient's physiological and socioeconomic limits. - Absolute Veto: If an AI agent recommends an $800 biologic for a patient with a $150 budget, the C++ engine instantaneously issues a hard veto, triggering a re-negotiation.
- To minimize token costs and reduce latency during massive agent swarms, semantic drug-interaction queries and identical clinical sub-routines are aggressively cached in Redis.
- Live Telemetry: The UI consumes the live JSON telemetry from the backend negotiation, rendering the precise rationale, recommendations, and confidence scores of each agent in real-time.
- Glassmorphic Design: A stunning, highly responsive dashboard built with TailwindCSS and Lucide icons.
| Domain | Technology | Purpose |
|---|---|---|
| Frontend | Next.js, React, TailwindCSS | Dynamic telemetry rendering & physician dashboard |
| Backend | Node.js, Express.js | API routing, Auth, and Agent Orchestration |
| Native Addon | C++, node-addon-api, node-gyp
|
HERA Graph Engine for |
| AI / ML | OpenAI GPT-4 API | Generative clinical reasoning and multi-agent debate |
| Database | MongoDB | Persistent storage for complex patient phenotypes |
| Caching | Redis | High-speed cache for drug intelligence and semantic queries |
Due to proprietary reasons and to prevent unauthorized deployments during our placement drive, the specific environment variable configuration schema, .env file structure, API keys, and local setup instructions are not provided publicly.
Note for Recruiters: The full source code architecture is available here for your review, and the working application can be accessed via the Live Link on our resumes.
- Patient Intake: Load the patient's complex multi-morbid profile (e.g., CKD, Diabetes, low socioeconomic status).
- Initiate MDT: Click
Initiate MDT Consult. - Live Telemetry: Watch in real-time as the Cardiologist, Nephrologist, and Endocrinologist debate the protocol.
- Constraint Validation: See the HERA C++ engine instantly validate or veto the AI consensus.
- Human Authority: The attending physician reviews the AI's transparent rationale and clicks "Acknowledge & Override Veto" or accepts the optimized baseline.
- Zero Hallucination Guarantee on Hard Constraints: Because the final protocol MUST pass the C++ deterministic engine, LLM hallucinations cannot bypass biological or financial limits.
- JWT Authentication: fully secured API endpoints.
- Stateless AI: The OpenAI API is only used for processing; no PHI is retained in the LLM's memory.
⚠️ Notice for Recruiters & Placement Officers: This repository is the original, independent work of Mohit Thakur and Hitendra Kumar Vishwas. Due to instances of other candidates cloning this repository for their own resumes during the on-campus placement drive, please verify original authorship by checking the Commit History, which demonstrates continuous development by us. Any other student claiming this project as their own is engaging in academic misconduct.