💡 Inspiration

In critical domains like healthcare, AI agents cannot afford "context amnesia", lost historical allergies, or corrupt memory states when asynchronous telemetry arrives out of order. Most LLM applications rely on simple short-term chat history or naive RAG, which fails over long multi-visit patient lifecycles.

We built AegisMed to solve this: an enterprise-grade Clinical Agentic Intelligence System engineered around a resilient 4-Tier Cognitive Memory Hierarchy that ensures AI agents maintain persistent, verifiable, and safe clinical memory.


⚙️ What It Does

AegisMed deploys a coordinated swarm of specialized clinical agents (Triage, Diagnostic, Pharmacovigilance, and Reflection) that interact with a unified memory engine:

  • Prevents Fatal Medical Errors: Recalls past adverse reactions and allergies (e.g., 14-month-old severe penicillin anaphylaxis) to automatically block contraindicated prescriptions even when the primary LLM suggests them.
  • Longitudinal Disease Tracking: Detects progressive organ decline (e.g., chronic renal drift) across multi-year encounters.
  • Bayesian Uncertainty Bounds: Calculates epistemic and aleatoric confidence intervals (Gaussian Process Regression) to autonomously trigger human physician escalation on rare or uncertain diagnoses.
  • Late-Telemetry Reconciliation: Deterministically re-indexes out-of-order wearable or laboratory samples without state corruption.

🛠️ How We Built It (CockroachDB & AWS Architecture)

🪳 CockroachDB as the Cognitive Memory Spine:

  1. Tier 1 (Working Memory): SERIALIZABLE isolation and distributed row locks maintain transient multi-agent state and prevent concurrent write collisions.
  2. Tier 2 (Episodic Memory): Distributed vector embeddings (pgvector) index longitudinal patient encounters and clinical notes with cosine distance search.
  3. Tier 3 (Semantic Memory): Relational ontologies store medical guidelines and drug-drug contraindication matrices.
  4. Tier 4 (Reflective Meta-Memory): Async meta-cognition tables synthesize multi-visit trajectories and reconcile out-of-order lab telemetry.
  5. CockroachDB MCP Server & CLI: Integrated Model Context Protocol (MCP) server for native AI tool calling alongside the ccloud CLI manager.

☁️ AWS Cloud Services:

  • AWS Bedrock: Powered by Claude 3.5 Sonnet for multi-agent reasoning and Titan Text Embeddings v2 for clinical semantic vectorization.
  • AWS S3: Archival storage for longitudinal diagnostic imaging reports and encrypted clinical records.
  • AWS Lambda: Serverless event-driven ingestion for incoming asynchronous patient telemetry.

🚧 Challenges We Ran Into

  • Multi-Agent State Contention: When multiple agents (Diagnostic vs. Pharmacovigilance) attempt to update patient encounter records simultaneously, standard databases suffer race conditions. CockroachDB's distributed serializable transaction locking solved this completely.
  • Out-of-Order Clinical Telemetry: Handling lab results that arrive weeks after a clinical consultation required building snapshot-based retroactive reconciliation logic directly backed by CockroachDB transactions.

🏆 Accomplishments That We're Proud Of

  • Built a 100% functional, production-ready system with an interactive Clinician Console, 2D Vector Memory Graph visualizer, and 18/18 passing automated tests (pytest).
  • Successfully integrated 4 native CockroachDB capabilities (Distributed SQL, Vector Indexing, MCP Server, ccloud CLI) with 3 AWS services (Bedrock, S3, Lambda).
  • Seamless zero-hallucination safety shield in real-time benchmark patient trials.

🔮 What's Next for AegisMed

  • Expanding FHIR/HL7 EHR integration standards for native hospital rollout.
  • Multi-modal vision integration via AWS Bedrock to store radiology and ECG scan embeddings into CockroachDB episodic memory.

Built With

Share this project:

Updates

Submission history