Agentic Hospital — Implementation Report
1. System Overview
Agentic Hospital is a fully simulated AI-powered hospital built on Google ADK. It models a 500-bed academic medical centre with a multi-agent architecture where a root coordinator triages incoming patient queries and routes them to one of 40 specialist sub-agents. The system supports text conversations, medical image analysis, real-time web search for clinical guidelines, critical lab value monitoring, a live bed management simulation with ward visualisations, SQLAlchemy-backed persistence, BioMCP biomedical research tools, and coordinator-mediated inter-department specialist consults.
Design Philosophy
- Every agent is a specialist — they do not overlap
- Tools are synchronous Python functions returning structured dicts
- Core state (patients, triage, pharmacy, discharge, consults) is persisted in SQLite via SQLAlchemy ORM (19 models)
- The root agent routes; specialist agents treat and document
- Web search fills the gap for any knowledge beyond the training cutoff
- Chain of Expert Thought (CoET) knowledge bases embed senior-physician reasoning patterns per specialty
- MCP integration provides real-time drug, literature, and guideline queries via medical-mcp, FHIR R4, and BioMCP (36 biomedical tools)
- Inter-department consults are coordinator-mediated — departments post consult requests; coordinator routes to target specialist automatically
2. Architecture
2.1 System Block Diagram
2.2 Agent Hierarchy
hospital_coordinator (root_agent — ADK entry point)
│
├── Tools (10):
│ get_patient_info · get_patient_encounter_history · check_critical_lab_values
│ triage_assessment · request_mdt_consultation · generate_treatment_plan
│ record_patient_encounter · generate_deterioration_alert
│ analyze_medical_image · web_search
│
└── Sub-Agents (39):
├── Medical Specialties (17)
│ allergy_immunology · cardiology · endocrinology · gastroenterology
│ general_medicine · gynecology · hematology · infectious_diseases
│ nephrology · neurology · oncology · pediatrics · psychology
│ pulmonology · rheumatology
│
├── Surgical Specialties (9)
│ cardiothoracic_surgery · colorectal_surgery · general_surgery
│ neurosurgery · orthopedics · plastic_surgery · thoracic_surgery
│ urology · vascular_surgery
│
├── Diagnostic & Support Specialties (9)
│ anesthesiology · critical_care · emergency_medicine · nuclear_medicine
│ ophthalmology · pathology · physical_medicine_rehab · radiation_oncology
│ radiology
│
└── Hospital Operations (4)
hospital_admission · triage_nurse · pharmacy · discharge_planning
2.3 Patient Intake Flow (4-Phase + Admission) Updated: Sprints 1-4
- Phase 1: Registration — coordinator gets patient info, history, critical labs
- Phase 2: Nurse Triage (Sprint 1) — triage_nurse_agent performs ESI v4 scoring
- Phase 3: Routing — coordinator routes to specialist based on ESI level
- Phase 4: Pharmacy (Sprint 2) — pharmacy_agent verifies & dispenses medications
- Discharge: Discharge Planning (Sprint 3) — generates summary, GP letter, community referrals
- Diagnostic: Diagnostic Ordering (Sprint 4) — order_investigation() workflow integrated
2.4 Patient Flow (Updated with Sprints 1-4)
Patient arrives
│
▼
hospital_coordinator (Phase 1: Registration)
└─ get_patient_info + get_patient_encounter_history + check_critical_lab_values
│
▼
triage_nurse_agent (Phase 2: Nurse Triage) [Sprint 1]
├─ calculate_esi_score() → ESI 1-5
├─ record_nurse_triage() → vitals, pain, allergies
└─ assign_waiting_priority() → queue or resuscitation
│
├─ ESI 1-2 → emergency_medicine_agent / critical_care_agent (immediate)
└─ ESI 3-5 → hospital_coordinator (Phase 3: Routing)
│
▼
specialist_agent
├─ get_patient_info
├─ get_lab_results / order_investigation() [Sprint 4]
├─ record_vitals
├─ check_drug_interactions
├─ [2 specialty tools]
├─ web_search
└─ generate_soap_note
│
▼
If medication ordered:
pharmacy_agent [Sprint 2]
├─ verify_medication_order()
├─ medication_reconciliation()
└─ dispense_medication()
│
▼
If admission:
hospital_admission_agent
└─ assign_bed()
│
▼
If discharge:
discharge_planning_agent [Sprint 3]
├─ check_discharge_criteria()
├─ generate_discharge_summary()
├─ pharmacy_agent.generate_tta_prescription()
├─ send_gp_letter()
└─ arrange_community_services()
3. Agent Roster (39 sub-agents)
3.1 Root Coordinator
| Agent | Variable | Model | Sub-agents |
|---|---|---|---|
| Hospital Coordinator | root_agent → hospital_coordinator |
gemini-2.5-flash-lite |
39 |
Coordinator tools (10):
3.2 Medical Specialties (17 agents)
| # | File | Agent Variable | Persona | Specialty Tools |
|---|---|---|---|---|
| 1 | allergy_immunology.py | allergy_immunology_agent | Dr. AllergyAI | allergy_skin_test_interpretation, immunodeficiency_risk_assessment |
| 2 | cardiology.py | cardiology_agent | Dr. CardioAI | analyze_ecg, assess_cardiac_risk |
| 3 | dermatology.py | dermatology_agent | Dr. DermaAI | skin_lesion_analysis, allergy_patch_test_interpretation |
| 4 | endocrinology.py | endocrinology_agent | Dr. EndoAI | diabetes_management_assessment, thyroid_nodule_assessment |
| 5 | ent.py | ent_agent | Dr. ENTAI | hearing_assessment, sleep_apnea_screening |
| 6 | gastroenterology.py | gastroenterology_agent | Dr. GastroAI | liver_function_assessment, ibs_symptom_scoring |
| 7 | general_medicine.py | general_medicine_agent | Dr. PrimaryAI | bmi_calculator, vaccination_schedule |
| 8 | gynecology.py | gynecology_agent | Dr. GyneAI | pregnancy_risk_assessment, menstrual_cycle_analysis |
| 9 | hematology.py | hematology_agent | Dr. HematoAI | anemia_classification, dvt_risk_assessment |
| 10 | infectious_diseases.py | infectious_diseases_agent | Dr. InfectAI | sepsis_screening, antibiotic_selection_guide |
| 11 | nephrology.py | nephrology_agent | Dr. NephroAI | calculate_gfr, assess_kidney_stage |
| 12 | neurology.py | neurology_agent | Dr. NeuroAI | assess_stroke_risk, evaluate_consciousness |
| 13 | oncology.py | oncology_agent | Dr. OncoAI | cancer_screening_recommendation, staging_assessment |
| 14 | pediatrics.py | pediatrics_agent | Dr. PedsAI | pediatric_growth_assessment, vaccination_tracker |
| 15 | psychology.py | psychology_agent | Dr. PsychoAI | phq9_depression_screening, gad7_anxiety_screening |
| 16 | pulmonology.py | pulmonology_agent | Dr. PulmoAI | spirometry_interpretation, asthma_control_score |
| 17 | rheumatology.py | rheumatology_agent | Dr. RheumaAI | arthritis_assessment, lupus_activity_assessment |
3.3 Surgical Specialties (9 agents)
| # | File | Agent Variable | Specialty Tools |
|---|---|---|---|
| 18 | cardiothoracic_surgery.py | cardiothoracic_surgery_agent | cardiac_surgery_risk_score, thoracic_surgery_feasibility |
| 19 | colorectal_surgery.py | colorectal_surgery_agent | colorectal_cancer_screening, bowel_obstruction_assessment |
| 20 | general_surgery.py | general_surgery_agent | appendicitis_scoring, surgical_risk_assessment |
| 21 | neurosurgery.py | neurosurgery_agent | intracranial_pressure_assessment, spinal_cord_injury_assessment |
| 22 | orthopedics.py | orthopedics_agent | fracture_risk_assessment, joint_mobility_score |
| 23 | plastic_surgery.py | plastic_surgery_agent | burn_assessment, reconstructive_planning |
| 24 | thoracic_surgery.py | thoracic_surgery_agent | pulmonary_function_surgical_risk, pleural_disease_assessment |
| 25 | urology.py | urology_agent | kidney_stone_assessment, prostate_assessment |
| 26 | vascular_surgery.py | vascular_surgery_agent | peripheral_arterial_disease_assessment, aortic_aneurysm_assessment |
3.4 Diagnostic & Support Specialties (9 agents)
| # | File | Agent Variable | Specialty Tools |
|---|---|---|---|
| 27 | anesthesiology.py | anesthesiology_agent | asa_physical_status_classification, calculate_anesthesia_risk |
| 28 | critical_care.py | critical_care_agent | calculate_severity_score, organ_dysfunction_assessment |
| 29 | emergency_medicine.py | emergency_medicine_agent | chest_pain_risk_stratification, trauma_triage_assessment |
| 30 | nuclear_medicine.py | nuclear_medicine_agent | pet_ct_oncology_assessment, thyroid_scan_interpretation |
| 31 | ophthalmology.py | ophthalmology_agent | vision_assessment, glaucoma_risk_assessment |
| 32 | pathology.py | pathology_agent | interpret_biopsy_result, critical_lab_value_alert |
| 33 | physical_medicine_rehab.py | physical_medicine_rehab_agent | functional_independence_assessment, stroke_rehabilitation_prognosis |
| 34 | radiation_oncology.py | radiation_oncology_agent | calculate_radiation_dose, radiation_toxicity_assessment |
| 35 | radiology.py | radiology_agent | imaging_study_selector, report_critical_findings |
3.5 Hospital Operations (4 agents) Sprints 1-3
| File | Agent Variable | Role | Sprint |
|---|---|---|---|
hospital_admission_agent.py |
hospital_admission_agent |
Bed management, admissions, discharges, transfers, waitlists, ward visualisation | Existing |
triage_nurse.py |
triage_nurse_agent |
ESI v4 triage scoring, vital signs, waiting queue management | Sprint 1 |
pharmacy.py |
pharmacy_agent |
Medication verification, dispensing, reconciliation, TTA prescriptions | Sprint 2 |
discharge_planning.py |
discharge_planning_agent |
Discharge readiness, summaries, GP letters, community referrals | Sprint 3 |
4. Tool Inventory
4.1 Common Tools — tools/common_tools.py
Available to every department agent (12 + 3 diagnostic functions):
| Function | Description |
|---|---|
get_patient_info(patient_id) | Retrieves full demographics, allergies, medications, conditions |
record_vitals(patient_id, bp, hr, temp, spo2, ...) | Records vitals with automated clinical analysis and alert levels |
check_drug_interactions(medications) | Checks known drug-drug interactions from an in-memory interaction DB |
schedule_appointment(department, urgency, patient_id, reason) | Books follow-up with urgency-based triage (emergency/urgent/routine) |
get_lab_results(patient_id, test_type) | Retrieves lab panels (CBC, BMP, LFTs, HbA1c, troponin, etc.) |
generate_soap_note(patient_id, chief_complaint, ...) | Generates structured SOAP documentation at end of consultation |
calculate_medication_dose(medication, weight_kg, age, ...) | Weight- and organ-function-adjusted dosing from a drug formulary |
triage_assessment(symptoms, duration, severity) | Scores urgency (EMERGENCY/URGENT/ROUTINE) with department recommendation |
record_patient_encounter(patient_id, department, ...) | Logs encounter to longitudinal patient history |
get_patient_encounter_history(patient_id, last_n, ...) | Retrieves chronological visit history with cross-department context |
request_mdt_consultation(patient_id, departments, ...) | Initiates multi-disciplinary team consultation for complex cases |
generate_treatment_plan(patient_id, diagnosis, ...) | Generates structured evidence-based treatment plan |
4.2 Monitoring Tools — tools/monitoring_tools.py
| Function | Description |
|---|---|
check_critical_lab_values(patient_id) | Scans all lab results against AACC critical thresholds; returns ranked alerts |
generate_deterioration_alert(patient_id, trigger, value, unit, context) | Generates a structured deterioration alert for a specific abnormal finding |
4.3 Image Analysis Tool — tools/image_tools.py
| Function | Description |
|---|---|
analyze_medical_image(image_source, image_type, clinical_context, patient_id) | Multimodal AI analysis via litellm.completion with Gemini vision |
Supported image types (13):
Input formats: File path, HTTPS URL, raw base64, or existing data URI.
4.4 Web Search Tools — tools/websearch_tools.py
| Function | Description | Available To |
|---|---|---|
make_department_web_search(dept) | Factory that returns a department-specific web_search function. Uses DuckDuckGo DDGS with 3 backend fallbacks (html → lite → api). Top-3 results: full-page content (3,000 chars each via requests + BeautifulSoup). Results 4–8: snippets + URL. Total output ~10,000 chars. | All 40 departments |
medical_image_search(query, max_results) | Searches DuckDuckGo Images for medical/clinical images. Returns image URLs, thumbnails, titles, and source pages. | All 40 departments |
medical_video_search(query, max_results) | Searches YouTube (via DuckDuckGo Videos) for medical education videos, procedural guides, and clinical demonstrations. Returns title, URL, description, and duration. | All 40 departments |
Returns: {"status": "success"|"error"|"timeout", "query": ..., "result": ...}
duckduckgo-search (v8.1.1). The web_search factory is wired to every department agent; medical_image_search and medical_video_search are available to all 40 sub-agents.
4.5 Bed Management Tools — tools/bed_management_tools.py
Available to hospital_admission_agent only (8 functions):
| Function | Description |
|---|---|
get_hospital_dashboard() | Returns full markdown table dashboard of all 20 wards with occupancy stats |
get_ward_visualization(ward) | Returns ASCII floor-plan map for one ward with per-bed status icons |
check_bed_availability(ward) | Returns available bed count and IDs for one or all wards |
assign_bed(patient_id, ward, reason, priority) | Admits patient to first available bed; auto-waitlists if full |
discharge_patient_from_bed(patient_id, discharge_notes) | Frees bed (→ cleaning), calculates length of stay, notifies waitlist |
transfer_patient_bed(patient_id, target_ward, reason) | Inter-ward transfer: frees old bed, assigns new; full audit trail |
add_to_waitlist(patient_id, ward, priority, reason) | Priority queue (emergency → urgent → routine) with estimated wait |
get_waitlist_status(ward) | Returns current waitlist ordered by priority then arrival time |
4.6 Triage Tools — tools/triage_tools.py Sprint 1
Available to triage_nurse_agent (4 functions):
| Function | Description |
|---|---|
calculate_esi_score(symptoms, vitals, pain_score, arrival_mechanism) | Calculates Emergency Severity Index v4 level (1-5) with colour, target time, and rationale |
record_nurse_triage(patient_id, chief_complaint, vitals, pain_score, esi_level, ...) | Documents full nurse triage assessment including allergy verification and wristband flag |
assign_waiting_priority(patient_id, esi_level) | Places patient in acuity queue; ESI 1-2 bypass waiting room to resuscitation |
get_triage_queue() | Returns the current ED waiting queue ordered by ESI priority with estimated wait times per patient |
4.7 Pharmacy Tools — tools/pharmacy_tools.py Sprint 2
Available to pharmacy_agent (4 functions):
| Function | Description |
|---|---|
verify_medication_order(patient_id, medication, dose, route, frequency, indication) | Validates against formulary, checks allergies, renal/hepatic adjustment, flags contraindications |
dispense_medication(patient_id, medication, dose, quantity, instructions, pharmacist_id) | Records dispensing event with batch number, expiry, pharmacist sign-off |
medication_reconciliation(patient_id, stage) | Compares home vs inpatient (admission) or inpatient vs discharge (discharge) medications |
generate_tta_prescription(patient_id, discharge_medications, duration_days) | Generates Take-To-Away prescription with dosing instructions and warning signs |
4.8 Discharge Planning Tools — tools/discharge_tools.py Sprint 3
Available to discharge_planning_agent (4 functions):
| Function | Description |
|---|---|
check_discharge_criteria(patient_id, clinical_criteria) | Validates discharge readiness (haemodynamically stable, pain controlled, mobile, etc.) |
generate_discharge_summary(patient_id, admitting_diagnosis, final_diagnosis, ...) | Creates structured discharge summary with clinical course, investigations, treatment, TTA meds |
send_gp_letter(patient_id, gp_name, summary, urgent_actions) | Generates and sends discharge letter to GP with key findings and follow-up plan |
arrange_community_services(patient_id, services_required, clinical_reason, urgency) | Refers to district nursing, physiotherapy, OT, social work, palliative care, etc. |
4.9 Diagnostic Ordering — tools/common_tools.py Sprint 4
Available to all agents (3 new functions):
| Function | Description |
|---|---|
order_investigation(patient_id, investigation_type, clinical_indication, urgency) | Places investigation order with status tracking (ordered → processing → resulted → reviewed) |
get_pending_results(patient_id, status_filter) | Returns all ordered investigations with current status and turnaround times |
acknowledge_critical_result(patient_id, investigation_id, clinician_id, notes) | Records clinician acknowledgment of critical result, closing the notification loop |
4.10 Specialty Tools — tools/{specialty}_tools.py
35 files × 2 functions = 70 specialty tool functions total.
| Department | Tool 1 | Tool 2 |
|---|---|---|
| allergy_immunology | allergy_skin_test_interpretation | immunodeficiency_risk_assessment |
| anesthesiology | asa_physical_status_classification | calculate_anesthesia_risk |
| cardiology | analyze_ecg | assess_cardiac_risk |
| cardiothoracic_surgery | cardiac_surgery_risk_score | thoracic_surgery_feasibility |
| colorectal_surgery | colorectal_cancer_screening | bowel_obstruction_assessment |
| critical_care | calculate_severity_score | organ_dysfunction_assessment |
| dermatology | skin_lesion_analysis | allergy_patch_test_interpretation |
| emergency_medicine | chest_pain_risk_stratification | trauma_triage_assessment |
| endocrinology | diabetes_management_assessment | thyroid_nodule_assessment |
| ent | hearing_assessment | sleep_apnea_screening |
| gastroenterology | liver_function_assessment | ibs_symptom_scoring |
| general_medicine | bmi_calculator | vaccination_schedule |
| general_surgery | appendicitis_scoring | surgical_risk_assessment |
| gynecology | pregnancy_risk_assessment | menstrual_cycle_analysis |
| hematology | anemia_classification | dvt_risk_assessment |
| infectious_diseases | sepsis_screening | antibiotic_selection_guide |
| nephrology | calculate_gfr | assess_kidney_stage |
| neurology | assess_stroke_risk | evaluate_consciousness |
| neurosurgery | intracranial_pressure_assessment | spinal_cord_injury_assessment |
| nuclear_medicine | pet_ct_oncology_assessment | thyroid_scan_interpretation |
| oncology | cancer_screening_recommendation | staging_assessment |
| ophthalmology | vision_assessment | glaucoma_risk_assessment |
| orthopedics | fracture_risk_assessment | joint_mobility_score |
| pathology | interpret_biopsy_result | critical_lab_value_alert |
| pediatrics | pediatric_growth_assessment | vaccination_tracker |
| physical_medicine_rehab | functional_independence_assessment | stroke_rehabilitation_prognosis |
| plastic_surgery | burn_assessment | reconstructive_planning |
| psychology | phq9_depression_screening | gad7_anxiety_screening |
| pulmonology | spirometry_interpretation | asthma_control_score |
| radiation_oncology | calculate_radiation_dose | radiation_toxicity_assessment |
| radiology | imaging_study_selector | report_critical_findings |
| rheumatology | arthritis_assessment | lupus_activity_assessment |
| thoracic_surgery | pulmonary_function_surgical_risk | pleural_disease_assessment |
| urology | kidney_stone_assessment | prostate_assessment |
| vascular_surgery | peripheral_arterial_disease_assessment | aortic_aneurysm_assessment |
4.11 Knowledge Base Tool — tools/knowledge_base_tools.py Sprint 5
Available to triage_nurse, pharmacy, discharge_planning agents and progressively rolled out to all departments (1 function):
| Function | Description |
|---|---|
query_chain_of_thought(specialty, query_type, symptoms, current_thinking) | Activates the Chain of Expert Thought (CoET) knowledge base for the agent's specialty. Supports query types: red_flags, differential, next_question, illness_script, bias_check, synthesis. |
4.12 Authoritative Website Config — tools/website_config.py Sprint 5
Maps every department to its primary professional-society and guideline sources. Used by the
make_department_web_search() factory in websearch_tools.py to bias browser-use
queries toward evidence-based, peer-reviewed content instead of general health blogs.
| Component | Contents |
|---|---|
UNIVERSAL_SITES | 8 authoritative sources for all departments: PubMed, PMC, Cochrane Library, Medscape, WHO, CDC, NICE Guidelines, BMJ Best Practice |
DEPARTMENT_SITES | Per-department curated site lists for all 35 departments — specialty societies (ACC, AHA, IDSA, ASCO, NCCN…), peer-reviewed journals (NEJM, Lancet, JACC…), and regulatory sources (FDA, CMS, AHRQ) |
get_department_sites(department) | Returns universal + department-specific site config dicts |
get_site_domains(department) | Returns flat list of domains for a department |
get_search_query(department, query) | Builds site:domain OR … prefixed search query for authoritative results |
list_departments() | Returns all configured department keys (alphabetical) |
get_search_query("cardiology", "ACS management 2025")
→ "site:acc.org OR site:professional.heart.org OR site:pubmed.ncbi.nlm.nih.gov ACS management 2025"
4.13 Tool Count Summary
| Category | File | Functions | Available To |
|---|---|---|---|
| Common | common_tools.py | 15 (12 core + 3 diagnostic ordering) | All 35 department agents |
| Monitoring | monitoring_tools.py | 2 | All 35 department agents |
| Image analysis | image_tools.py | 1 | Selected departments + coordinator |
| Web search | websearch_tools.py | 1 | All 35 department agents |
| Website config | website_config.py | 4 | Internal utility (used by websearch) |
| Bed management | bed_management_tools.py | 8 | hospital_admission_agent only |
| Triage (ESI v4) | triage_tools.py | 4 | triage_nurse_agent only |
| Pharmacy | pharmacy_tools.py | 4 | pharmacy_agent only |
| Discharge planning | discharge_tools.py | 4 | discharge_planning_agent only |
| Knowledge base (CoET) | knowledge_base_tools.py | 1 | All 39 agents (progressively rolled out) |
| Specialty (×35) | {dept}_tools.py | 70 | 2 per department agent |
| Total unique | 46 files | 114 functions | — |
15 common + 2 monitoring + 2 specialty + 1 image + 1 web search + 1 CoET (where enabled) (some departments omit image tools where clinically irrelevant)
5. Patient & Lab Database
5.1 Patient Registry — _PATIENT_DB in common_tools.py
10 diverse mock patients (P001–P010) with realistic comorbidities, medications, and allergies:
| ID | Name | Age | Key Conditions | Current Ward |
|---|---|---|---|---|
P001 | John Smith | 55M | Hypertension, T2DM | General_Medicine |
P002 | Sarah Johnson | 34F | PCOS, Iron-deficiency anaemia | Gynecology |
P003 | Robert Chen | 68M | COPD GOLD II, AFib, CHF (EF 40%) | ICU |
P004 | Emily Davis | 28F | Migraines | Neurology |
P005 | Michael Brown | 45M | L4-L5 disc herniation, GAD | Orthopedics |
P006 | Margaret Wilson | 68F | COPD GOLD III, Osteoporosis, MDD, GERD | Pulmonology |
P007 | Carlos Rivera | 34M | T1DM (since age 12), Diabetic retinopathy | Not admitted |
P008 | Linda Park | 55F | SLE, Lupus Nephritis Class III, HTN | Nephrology |
P009 | Andre Williams | 45M | HIV-1 (undetectable), GAD, HBV co-infection | Infectious_Diseases |
P010 | George Thompson | 72M | Post-CABG, Persistent AFib, HF (EF 35%), CKD 3b, T2DM | Cardiology |
5.2 Lab Database
Full panels available for all 10 patients including: CBC, BMP (electrolytes, renal, glucose), Lipid Panel, HbA1c, LFTs, TSH, coagulation (INR/PT), iron studies, hormone panels, troponin, BNP, urinalysis, blood cultures, and specialty panels.
5.3 Drug Interaction Database
In-memory lookup of known clinically significant drug-drug interactions checked before any new medication is recommended (_DRUG_INTERACTIONS in common_tools.py).
5.4 Drug Formulary
Dosing reference for common medications with weight- and organ-function-adjusted calculations used by calculate_medication_dose (_DRUG_FORMULARY in common_tools.py).
6. Hospital Infrastructure — Bed Management System
6.1 Overview
Added in the most recent implementation sprint. Provides a full simulation of hospital inpatient operations with real-time state tracking, ASCII ward maps, and a markdown hospital dashboard.
6.2 Ward Inventory
| Ward | Beds | Type | Floor | Baseline Occupancy |
|---|---|---|---|---|
| ICU | 10 | intensive_care | 2 | 60% |
| Emergency | 15 | emergency | 1 | 67% |
| Cardiology | 20 | general | 4 | 70% |
| Neurology | 16 | general | 5 | 63% |
| Oncology | 20 | general | 6 | 75% |
| General_Medicine | 30 | general | 3 | 67% |
| Psychiatry | 15 | psychiatric | 7 | 67% |
| Pediatrics | 20 | pediatric | 3 | 60% |
| Orthopedics | 20 | surgical | 4 | 60% |
| General_Surgery | 18 | surgical | 4 | 67% |
| Gynecology | 15 | general | 5 | 67% |
| Nephrology | 14 | general | 6 | 64% |
| Pulmonology | 18 | general | 3 | 67% |
| Gastroenterology | 16 | general | 3 | 63% |
| Infectious_Diseases | 12 | isolation | 2 | 67% |
| Neurosurgery | 12 | surgical | 5 | 67% |
| Cardiothoracic_Surgery | 10 | surgical | 2 | 70% |
| Hematology | 14 | general | 6 | 64% |
| Rehabilitation | 20 | rehab | 7 | 70% |
| Vascular_Surgery | 10 | surgical | 4 | 70% |
6.3 Bed States
| Status | Icon | Meaning |
|---|---|---|
available | 🟢 | Ready for new admission |
occupied | 🔴 | Patient currently in bed |
cleaning | 🟡 | Post-discharge housekeeping (~15 min turnover) |
maintenance | 🔧 | Out of service — engineering review |
6.4 Visualisation Examples
Hospital Dashboard (from get_hospital_dashboard()):
## 🏥 AGENTIC HOSPITAL — BED MANAGEMENT DASHBOARD Date: 2026-02-20 14:35 | Total Capacity: 325 | Occupied: 215 | Available: 78 | Occupancy: 66% | Ward | Capacity | 🔴 Occupied | 🟡 Cleaning | 🔧 Maint | 🟢 Available | Occ% | |---------------------------|----------|-------------|-------------|----------|--------------|---------| | ICU | 10 | 6 | 1 | 1 | 2 | 60% | | Emergency | 15 | 10 | 2 | 0 | 3 | 67% | | Cardiology | 20 | 14 | 2 | 0 | 4 | 70% | | ...
Ward Floor Plan (from get_ward_visualization("ICU")):
╔══════════════════════════════════════════════════════════════════╗ ║ 🏥 ICU Ward — Agentic Hospital ║ ║ Floor 2 | Nurse Station: ICU Central ║ ╠══════════════════════════════════════════════════════════════════╣ ║ Beds: 10 total | 🔴 6 occupied | 🟡 1 cleaning | 🟢 2 available ║ ╠══════════════════════════════════════════════════════════════════╣ ║ [ICU-01] 🔴 OCCUPIED │ Robert Chen ║ ║ │ Dx: COPD exacerbation + CHF ║ ║ │ Admitted: 2026-02-18 08:30 ║ ╠══════════════════════════════════════════════════════════════════╣ ║ [ICU-02] 🔴 OCCUPIED │ George Thompson ║ ║ │ Dx: Decompensated HF + Persistent AFib║ ╠══════════════════════════════════════════════════════════════════╣ ║ [ICU-07] 🟡 CLEANING │ Post-discharge cleaning — ready ~15min║ ╠══════════════════════════════════════════════════════════════════╣ ║ [ICU-08] 🟢 AVAILABLE │ Ready for admission ║ ╚══════════════════════════════════════════════════════════════════╝ Occupancy: 6/10 | Available now: 2
6.5 Admission Workflow (simulated)
Query: "Admit patient P007 to Cardiology for diabetic monitoring"
↓
coordinator → hospital_admission_agent
↓
1. get_patient_info("P007") → Carlos Rivera, T1DM, allergic to amoxicillin
2. check_bed_availability("Cardiology") → 4 beds available
3. assign_bed("P007", "Cardiology", ...) → CARD-17 assigned
4. get_ward_visualization("Cardiology") → updated floor map shown
6.6 Waitlist Priority
Priority queue per ward: emergency (0) → immediate — life-threatening, ICU-level urgent (1) → within 24h — significant illness routine (2) → elective — stable or scheduled Estimated wait: 30 min base + 45 min per patient ahead in queue
7. Clinical Reasoning Framework
Every department agent prompt embeds four shared constants from prompts/shared.py:
_TOOL_PROTOCOL — 9-Step Ordered Sequence
get_patient_info— call first when patient_id availableget_lab_results— before assessmentrecord_vitals— on any reported vitalscheck_drug_interactions— before recommending any medicationweb_search— for post-training-cutoff guidelines or novel presentationsanalyze_medical_image— immediately on any shared imagecalculate_medication_dose— before specifying any dosinggenerate_soap_note— at end of every consultationschedule_appointment— urgency-based follow-up booking
_IMAGE_ANALYSIS_WORKFLOW
Protocol for multimodal inputs: immediate tool invocation, no text description first, 13 supported image types, critical finding escalation rules (STEMI pattern, midline shift, retinal detachment, PE).
_CLINICAL_REASONING — 3-Step Framework
- Step 1 — Think before responding: most dangerous Dx, most likely Dx, missing info, bias risk
- Step 2 — Cognitive bias checklist: anchoring, availability, premature closure, framing, demographic
- Step 3 — Structured output: Clinical Impression → Differential (with likelihood) → Confidence Level → Workup → Management Plan → Red Flags → Follow-up
_SAFETY_DISCLAIMER
Appended to every agent prompt: AI decision-support only, not a licensed clinician, in-person evaluation required for all significant presentations.
7.5 Chain of Expert Thought (CoET) — Knowledge Base System Sprint 5
Each department has a dedicated knowledge base file (knowledge_bases/{dept}_kb.py) containing structured clinical reasoning data. The query_chain_of_thought tool gives agents access to this at any point in a consultation via 6 query types:
| Query Type | When to Call | Returns |
|---|---|---|
red_flags | FIRST — before any history-taking | Must-not-miss life-threatening presentations for this specialty |
next_question | After chief complaint; repeatedly to build history | Most discriminating history question to ask next |
differential | After key symptoms gathered | Ranked differential: Must-Not-Miss → Most Likely → Less Common |
illness_script | To test leading hypothesis | Canonical presentation for a suspected diagnosis to compare against |
bias_check | Before finalising diagnosis | Cognitive error screen (anchoring, availability, premature closure, demographic) |
synthesis | To structure final clinical assessment | 8-step structured synthesis template for final output |
knowledge_bases/:
35 specialty departments + hospital_admission + pharmacy + discharge_planning.
Each KB is loaded lazily on first access and registered in base_reasoning.py's SPECIALTY_REGISTRY.
7.6 MCP Integration — medical-mcp & FHIR R4 Sprint 5
7.6a medical-mcp — Clinical Knowledge Server
The mcps/medical_mcp_toolset.py module connects agents to the
medical-mcp Node.js MCP server via ADK's McpToolset / stdio transport.
This gives agents real-time access to FDA drug labels, RxNorm, PubMed, Google Scholar,
clinical guidelines, and WHO statistics.
| Toolset Variable | MCP Tools Exposed | Used By |
|---|---|---|
pharmacy_mcp_toolset | search-drugs, get-drug-details, search-drug-nomenclature, search-pediatric-drugs | pharmacy_agent |
oncology_mcp_toolset | search-medical-literature, get-article-details, search-clinical-guidelines, search-google-scholar, search-medical-journals | Oncology depts |
pediatrics_mcp_toolset | search-pediatric-guidelines, search-pediatric-literature, search-pediatric-drugs, search-aap-guidelines, get-child-health-statistics | pediatrics_agent |
general_mcp_toolset | literature, guidelines, databases, health statistics | General & infectious diseases |
surgical_mcp_toolset | literature, guidelines, Google Scholar, journals | Surgical departments |
internal_medicine_mcp_toolset | drugs, literature, guidelines, health statistics | Internal medicine departments |
critical_care_mcp_toolset | drugs, literature, guidelines | Critical care & emergency |
diagnostic_mcp_toolset | literature, guidelines, Google Scholar | Diagnostic departments |
mental_health_mcp_toolset | literature, guidelines, databases | Psychology & psychiatry |
clinical_support_mcp_toolset | drugs, literature, guidelines, health statistics | Triage nurse, discharge planning |
full_medical_mcp_toolset | All 16 medical-mcp tools | Root coordinator, general access |
npm install -g medical-mcp and Node.js 18+. Toolsets are lazy — no process is spawned until an agent first calls a tool. On Windows, the module resolves node.exe + absolute path to medical-mcp/build/index.js automatically.
7.6b LangCare FHIR MCP — Real FHIR R4 Patient Records
The mcps/fhir_mcp_toolset.py module integrates the MIT-licensed
langcare-mcp-fhir
Go binary as a second MCP server. It connects to the public
HAPI FHIR R4 test server (https://hapi.fhir.org/baseR4) — no
authentication required. Configuration lives in mcps/fhir_config.yaml.
Agents can now read and write real FHIR R4 resources: Patient, Encounter, MedicationRequest, Condition, Observation, DiagnosticReport, CarePlan, and any other standard FHIR resource type.
| Toolset Variable | FHIR MCP Tools Exposed | Used By |
|---|---|---|
admission_fhir_toolset | fhir_read, fhir_search | hospital_admission_agent, triage_nurse_agent |
discharge_fhir_toolset | fhir_read, fhir_search, fhir_create, fhir_update | discharge_planning_agent |
clinical_fhir_toolset | fhir_read, fhir_search, patient_chart_review | All 37 other clinical departments |
full_fhir_toolset | All 6 FHIR tools (read, search, create, update, fhir_explorer, patient_chart_review) | Root coordinator / full access |
npm install -g @langcare/langcare-mcp-fhir and Node.js. The Go binary is resolved from PATH → npm global bin → %APPDATA%\npm\ → npx fallback. Config: mcps/fhir_config.yaml — swap base_url to point at any real EHR FHIR endpoint. License: MIT.
7.7 BioMCP — Biomedical Research MCP Sprint 8
mcps/biomcp_mcp_toolset.py integrates the
BioMCP
Python binary as a third MCP server. It provides real-time access to 15+ biomedical databases
(PubMed, ClinicalTrials.gov, ClinVar, gnomAD, OncoKB, OpenFDA FAERS, NCI CTS API, and more)
through 36 structured tools.
Install: pip install biomcp-python · Command: biomcp run (stdio)
| Toolset Variable | Key Tools | Used By |
|---|---|---|
oncology_bio_toolset | variant_searcher, trial_searcher, nci_biomarker_searcher, drug_getter, openfda_adverse_searcher | oncology_agent, cardiothoracic_surgery_agent, colorectal_surgery_agent, gynecology_agent, nuclear_medicine_agent, radiation_oncology_agent, thoracic_surgery_agent, urology_agent |
genomics_bio_toolset | gene_getter, variant_searcher, variant_getter, disease_getter, article_searcher | lab_agent, neurology_agent, endocrinology_agent, hematology_agent, neurosurgery_agent, pathology_agent, rheumatology_agent |
pharmacogenomics_bio_toolset | drug_getter, openfda_adverse_searcher, openfda_label_searcher, openfda_recall_searcher, openfda_shortage_searcher | pharmacy_agent, cardiology_agent, nephrology_agent, critical_care_agent, infectious_diseases_agent, anesthesiology_agent, dermatology_agent, emergency_medicine_agent, pulmonology_agent |
clinical_research_bio_toolset | article_searcher, trial_searcher, disease_getter, drug_getter, think | All remaining 26 departments (allergy, dietitian, ENT, gastro, general medicine, general surgery, ophthalmology, orthopedics, pediatrics, physical medicine, plastic surgery, psychology, radiology, vascular surgery, hospital admission, discharge planning, triage nurse, and others) |
full_bio_toolset | All 36 BioMCP tools | Full access |
.env: NCBI_API_KEY (PubMed), OPENFDA_API_KEY (FAERS), NCI_API_KEY (CTS), ONCOKB_TOKEN (OncoKB), ALPHAGENOME_API_KEY (AlphaGenome). All keys are optional — BioMCP falls back to public endpoints without them.
7.8 SQLAlchemy DB Persistence Sprint 6
All critical clinical state is persisted in a SQLite database (agentic_hospital.db)
via SQLAlchemy ORM. The DB is auto-created and seeded on first run through __init__.py → init_db().
| Module | Purpose |
|---|---|
database/engine.py | SQLAlchemy engine, SessionLocal, get_db() context manager, init_db() |
database/models.py | 19 ORM models: Patient, Bed, Ward, TriageRecord, TriageQueueEntry, DispenseRecord, DischargeSummary, GpLetter, CommunityReferral, AlertRecord, MdtConsultation, InvestigationOrder, ConsultRequest, and more |
database/seed.py | Seeds 10 patients + 20 wards + 325 beds on first run |
Fully DB-backed tool files
tools/bed_management_tools.py— 17get_db()calls (beds, wards, waitlist, admission log)tools/triage_tools.py— triage records + queue entriestools/pharmacy_tools.py— dispense records, reconciliation, TTA prescriptionstools/discharge_tools.py— discharge summaries, GP letters, community referralstools/common_tools.py— SOAP notes, encounters, MDT consultations, investigation orders, consult requests
7.9 Automated Test Suite Sprint 7
A comprehensive pytest suite lives in automated_test_debug_fix/ covering all tool layers.
| Suite | Count | Scope |
|---|---|---|
| Unit tests | 305 | Individual tool functions, mock DB, edge cases |
| Integration tests | 36 | Multi-tool workflows (admit → triage → pharmacy → discharge) |
| End-to-end tests | 15 | Full patient journeys through the agent graph |
| Total passing | 356 | 0 failing as of 2026-02-26 |
python -m pytest automated_test_debug_fix/ -q ·
Coverage: 62% on tools/ ·
DB isolation: conftest.py sets DATABASE_URL=sqlite:///test_agentic_hospital.db
7.10 Inter-Agent Specialist Consults Sprint 9
Department agents can now request peer specialist input during a consultation. The root coordinator automatically detects pending consults and routes to the target specialist before proceeding to prescription or discharge.
Option A — Coordinator-Mediated Flow (implemented)
cardiology_agent → request_specialist_consult("P001","cardiology","hematology",
"Suspected HIT — switch anticoagulant?", urgency="urgent")
↓ writes ConsultRequest(status="pending") to DB
hospital_coordinator ← transfer_to_agent returns
↓ calls get_pending_consults("P001") → [{target_agent:"hematology_agent", urgency:"urgent", ...}]
↓ calls transfer_to_agent("hematology_agent")
hematology_agent → reviews, provides opinion
↓ calls fulfill_specialist_consult("CONS-...", "hematology", response, recommendations)
↓ ConsultRequest(status="fulfilled") in DB
hospital_coordinator → continues to prescription / discharge
| Tool | Caller | Purpose |
|---|---|---|
request_specialist_consult(patient_id, requesting_department, target_department, clinical_question, urgency, clinical_context) | Any department agent | Posts a pending ConsultRequest to DB; signals coordinator |
get_pending_consults(patient_id) | Root coordinator | Reads all pending consults; returns sorted by urgency with routing instructions |
fulfill_specialist_consult(consult_id, fulfilling_department, response, recommendations) | Target department agent | Marks consult fulfilled, stores response + recommendations in DB |
arch.md:
Option B — MDT sub-agent groups (ADK-native hierarchy where an MDT agent orchestrates multiple specialists) and
Option C — Peer tools (direct department-to-department LLM calls bypassing the coordinator).
8. Prompt Architecture
Structure
Each department prompt follows this template:
You are Dr. {Name}AI, a {Department} Specialist at Agentic Hospital.
PERSONA & PHILOSOPHY: [fellowship training, clinical philosophy]
EXPERTISE: [15–20 specialty conditions/procedures]
CLINICAL APPROACH:
► KEY HISTORY QUESTIONS: [department-specific intake questions]
► VALIDATED SCORING SYSTEMS:[5–8 validated clinical scores]
► EVIDENCE-BASED GUIDELINES:[5+ major society guideline citations]
► DIAGNOSTIC PITFALLS: [5–8 specialty-specific cognitive traps]
EMERGENCY RED FLAGS: [4–6 critical presentations requiring 911]
{_TOOL_PROTOCOL}
{_IMAGE_ANALYSIS_WORKFLOW}
{_CLINICAL_REASONING}
{_SAFETY_DISCLAIMER}
Prompt Files
| Location | File | Contents |
|---|---|---|
prompts/shared.py | Shared constants | _SAFETY_DISCLAIMER, _TOOL_PROTOCOL, _IMAGE_ANALYSIS_WORKFLOW, _CLINICAL_REASONING |
prompts/coordinator.py | Coordinator prompt | COORDINATOR_INSTRUCTION (4-phase: Registration → Triage → Routing → Pharmacy) |
prompts/hospital_admission.py | Admission agent prompt | HOSPITAL_ADMISSION_INSTRUCTION |
prompts/triage_nurse.py | Triage nurse prompt | TRIAGE_NURSE_INSTRUCTION |
prompts/pharmacy.py | Pharmacy agent prompt | PHARMACY_INSTRUCTION |
prompts/discharge_planning.py | Discharge planning prompt | DISCHARGE_PLANNING_INSTRUCTION |
prompts/{dept}.py (×35) | Department prompts | {DEPT_UPPER}_INSTRUCTION |
prompts/department_prompts.py | Backward-compat shim | Re-exports all constants |
9. File Structure
agentic_hospital/
├── __init__.py exports root_agent
├── agent.py root coordinator + 39 sub-agent registration
├── config.py runtime configuration (model, env)
│
├── departments/ 39 agent definitions
│ ├── allergy_immunology.py
│ ├── anesthesiology.py
│ ├── cardiology.py
│ ├── cardiothoracic_surgery.py
│ ├── colorectal_surgery.py
│ ├── critical_care.py
│ ├── dermatology.py
│ ├── discharge_planning.py ← discharge coordinator (Sprint 3)
│ ├── emergency_medicine.py
│ ├── endocrinology.py
│ ├── ent.py
│ ├── gastroenterology.py
│ ├── general_medicine.py
│ ├── general_surgery.py
│ ├── gynecology.py
│ ├── hematology.py
│ ├── hospital_admission.py ← bed management agent
│ ├── infectious_diseases.py
│ ├── nephrology.py
│ ├── neurology.py
│ ├── neurosurgery.py
│ ├── nuclear_medicine.py
│ ├── oncology.py
│ ├── ophthalmology.py
│ ├── orthopedics.py
│ ├── pathology.py
│ ├── pediatrics.py
│ ├── pharmacy.py ← clinical pharmacist (Sprint 2)
│ ├── physical_medicine_rehab.py
│ ├── plastic_surgery.py
│ ├── psychology.py
│ ├── pulmonology.py
│ ├── radiation_oncology.py
│ ├── radiology.py
│ ├── rheumatology.py
│ ├── thoracic_surgery.py
│ ├── triage_nurse.py ← ESI v4 triage nurse (Sprint 1)
│ ├── urology.py
│ └── vascular_surgery.py
│
├── knowledge_bases/ 38 files — CoET knowledge base system (Sprint 5)
│ ├── base_reasoning.py SPECIALTY_REGISTRY + process_coet_query() engine
│ ├── {dept}_kb.py × 35 35 medical/surgical/diagnostic specialty KBs
│ └── discharge_planning_kb.py discharge planning KB (36th specialty KB)
│
├── mcps/ MCP server integrations (Sprint 5)
│ ├── medical_mcp.py Python API wrappers (fallback)
│ ├── medical_mcp_toolset.py ADK McpToolset instances — 11 toolsets (medical-mcp)
│ ├── fhir_config.yaml HAPI FHIR R4 server configuration (no auth)
│ └── fhir_mcp_toolset.py LangCare FHIR MCP toolsets — 4 toolsets (MIT)
│
├── prompts/ 42 prompt files
│ ├── shared.py _TOOL_PROTOCOL, _CLINICAL_REASONING, _CHAIN_OF_EXPERT_THOUGHT
│ ├── coordinator.py
│ ├── hospital_admission.py
│ ├── triage_nurse.py
│ ├── pharmacy.py
│ ├── discharge_planning.py
│ ├── department_prompts.py backward-compat re-export shim
│ └── {dept}.py × 35
│
└── tools/ 46 tool files, 114 functions total
├── common_tools.py 15 functions (12 core + 3 diagnostic ordering)
├── monitoring_tools.py 2 critical alert functions
├── image_tools.py 1 multimodal analysis function
├── websearch_tools.py 1 browser-use search + make_department_web_search()
├── website_config.py 4 utility functions — authoritative site config per dept (Sprint 5)
├── bed_management_tools.py 8 bed management functions + _BED_DB
├── triage_tools.py 4 ESI v4 triage functions
├── pharmacy_tools.py 4 medication verification/dispensing functions
├── discharge_tools.py 4 discharge planning functions
├── knowledge_base_tools.py 1 CoET query function (query_chain_of_thought)
└── {dept}_tools.py × 35 70 specialty functions (2 per department)
10. Dependencies
| Package | Purpose |
|---|---|
google-adk | Google Agent Development Kit — agent/sub-agent framework, ADK web UI |
python-dotenv | .env loading (GOOGLE_API_KEY) |
browser-use | Browser automation for real-time web search (headless Chromium) |
langchain-google-genai | Gemini LLM for browser-use agent |
litellm | Model routing — all agents use openrouter/google/gemini-2.5-flash-lite |
Environment variables required (.env):
GOOGLE_API_KEY=your_key_here
Browser dependency:
playwright install chromium # required for web_search tool
11. Running the System
# Install dependencies pip install -r requirements.txt playwright install chromium # Launch ADK web UI adk web # Opens at http://localhost:8000 # Select "hospital_coordinator" from the agent dropdown
Example Interactions
| Query | Routes To | Tools Called |
|---|---|---|
| "I have chest pain radiating to my left arm" | cardiology_agent | triage_assessment → analyze_ecg → assess_cardiac_risk |
| "Show me the hospital bed dashboard" | hospital_admission_agent | get_hospital_dashboard |
| "Admit patient P007 to Cardiology" | hospital_admission_agent | get_patient_info → check_bed_availability → assign_bed → get_ward_visualization |
| "Show me the ICU ward map" | hospital_admission_agent | get_ward_visualization("ICU") |
| "Discharge patient P003" | hospital_admission_agent | discharge_patient_from_bed → get_ward_visualization |
| "Transfer P010 from Cardiology to ICU" | hospital_admission_agent | transfer_patient_bed → get_ward_visualization ×2 |
| "What are the latest COPD guidelines?" | pulmonology_agent | web_search → spirometry_interpretation |
| [skin photo attached] | dermatology_agent | analyze_medical_image → skin_lesion_analysis |
| "P003 has potassium of 6.8 — critical?" | coordinator / nephrology_agent | check_critical_lab_values → generate_deterioration_alert |
| "P005, P002, and P008 need MDT review" | coordinator | request_mdt_consultation |
12. What's Next
| Feature | Status | Notes |
|---|---|---|
| 40 specialist agents | ✅ Complete | 35 medical/surgical/diagnostic + 5 operations (admission, triage, pharmacy, discharge, lab) |
| 123 tool functions | ✅ Complete | Across 48 tool files |
| Bed management system | ✅ Complete | 20 wards, 325 beds, visualisation |
| Patient & lab mock data | ✅ Complete | P001–P010, full panels |
| Multimodal image analysis | ✅ Complete | 13 image types |
| Web search (real-time) | ✅ Complete | DuckDuckGo DDGS — 3 backend fallbacks, top-3 full-page content (3k chars each), snippets for results 4-8 |
| Critical lab monitoring | ✅ Complete | AACC thresholds, AACC 2022 |
| MDT consultation | ✅ Complete | Cross-department coordination |
| Longitudinal encounter history | ✅ Complete | Per-patient visit log |
| SOAP note generation | ✅ Complete | Structured clinical documentation |
| Triage Nurse Agent (ESI v4) | ✅ Sprint 1 | ESI scoring, vital signs, 4-function waiting queue |
| Pharmacy Agent | ✅ Sprint 2 | Medication verification, dispensing, reconciliation, TTA prescriptions |
| Discharge Planning Agent | ✅ Sprint 3 | Discharge summaries, GP letters, community referrals |
| Diagnostic Ordering | ✅ Sprint 4 | Order → processing → resulted → reviewed workflow |
| CoET Knowledge Bases (38 KBs) | ✅ Sprint 5 | Per-department structured KB — red flags, differentials, illness scripts, bias checks |
| MCP Integration (medical-mcp) | ✅ Sprint 5 | Real-time FDA, RxNorm, PubMed, guidelines, WHO statistics via Node.js MCP server |
| FHIR R4 MCP Integration (langcare-mcp-fhir) | ✅ Sprint 5 | Real FHIR R4 patient records via HAPI public server — fhir_read, fhir_search, fhir_create, fhir_update; wired to all 40 agents with role-matched toolsets (admission, discharge, clinical) |
| Authoritative Sources Config (website_config.py) | ✅ Sprint 5 | Per-department curated site lists (35 depts × 3–5 societies) + 8 universal sources; biases web search toward peer-reviewed content |
| SQLAlchemy DB Persistence (19 ORM models) | ✅ Sprint 6 | SQLite-backed triage, pharmacy, discharge, bed management, SOAP notes, encounters, investigation orders; auto-seeded with 10 patients + 325 beds |
| Lab Agent (40th sub-agent) | ✅ Sprint 6 | generate_lab_report, flag_critical_values, share_lab_results; PDF/CSV/TXT upload via upload_lab_tools.py |
| Automated Test Suite (356 tests) | ✅ Sprint 7 | 305 unit + 36 integration + 15 E2E; 62% coverage on tools/; run: python -m pytest automated_test_debug_fix/ -q |
| BioMCP Integration (36 tools) | ✅ Sprint 8 | PubMed, ClinicalTrials.gov, ClinVar, gnomAD, OncoKB, OpenFDA FAERS; 5 specialty-matched toolset slices deployed to all 40 agents |
| State-of-the-Art Prompt Hardening (14 prompts) | ✅ Sprint 8 | Pediatrics (SE drug ladder, croup dosing, API, FLACC scales), neurology (NCSE, hemiplegic migraine), gastro (varices), pharmacy (drug-food interactions), pathology (TRALI/AHTR), anesthesiology (awareness), + 8 more |
| Inter-Department Specialist Consults | ✅ Sprint 9 | Option A: coordinator-mediated via request_specialist_consult / get_pending_consults / fulfill_specialist_consult; ConsultRequest ORM model; auto-routing after every department handoff |
| Full MCP & Search Wiring (Sprint 10) | ✅ Sprint 10 | medical_video_search + medical_image_search wired to all 40 agents; FHIR R4 (clinical_fhir_toolset) wired to all 40 agents with role-matched toolsets; BioMCP specialty-matched toolsets expanded from 8 → all 40 agents; web_search + image_search bug fixes in triage_nurse, hospital_admission, discharge_planning |
| Theatre scheduling agent | 🔲 Planned | Surgical booking, anaesthetic pre-assessment, instrument checklist |
| Radiology order & reporting agent | 🔲 Planned | Imaging queue, AI-assisted report generation, critical finding escalation |
| Patient portal agent | 🔲 Planned | Patient-facing appointment booking, result viewing, medication reminders |