CareCompass Architecture & Implementation
Technology Stack
Multi-Agent Architecture
CareCompass employs a sophisticated multi-agent system where specialized AI agents work together to process healthcare queries through a coordinated workflow:
Intent Agent
Purpose: Classifies and filters healthcare-related queries from general requests
Technology: OpenAI classification models with intelligent keyword fallback mechanisms
Output: Healthcare classification confidence scores and intent categorization
Search Agent
Purpose: Discovers and retrieves relevant healthcare information from trusted sources
Technology: Tavily Search API for production environments, mock data for development
Output: Curated collection of healthcare source URLs and metadata
Extractor Agent
Purpose: Extracts comprehensive content from identified healthcare sources
Technology: Tavily Extract API with intelligent content caching and persistence
Output: Full-text content from verified healthcare authorities and institutions
Validator Agent
Purpose: Evaluates content quality, credibility, and healthcare relevance
Technology: Rule-based scoring algorithms with trusted domain validation
Output: Content credibility scores, quality metrics, and source reliability assessments
Planner Agent
Purpose: Synthesizes information into actionable healthcare guidance
Technology: Template-based deterministic planning or AI-powered dynamic planning
Output: Structured action plans with safety recommendations and clinical guidance
LangGraph Workflow
The workflow orchestrates agents in a sequential pipeline with error handling:
Database Schema
Users Collection
Runs Collection
Extracts Collection
Deployment Guide
Environment Variables
Production Deployment
- Platform: AWS Elastic Beanstalk (via Procfile)
- Database: MongoDB Atlas (cloud-hosted)
- Monitoring: Health checks at /health, /env-check, /db-check
- Rate Limiting: One active query per user every 5 minutes
- Error Handling: Comprehensive logging with structured context
Safety Features
- High-Risk Detection: Automatic identification of medication, dosing, and emergency queries
- Trusted Sources: Tier-based credibility scoring for healthcare domains
- Clinical Consultation: Mandatory recommendations for high-risk scenarios
- Conservative Approach: Safety-first guidance when evidence is uncertain
- Content Validation: Multi-layer validation against trusted healthcare sources
Key Metrics
- Query processing time: Target <10 seconds
- Agent success rates and fallback usage
- Evidence quality scores and citation accuracy
- Clinical consultation recommendation rates
- API error rates and system reliability
API Integration
The backend exposes a RESTful API for healthcare query processing:
- Query Submission: POST /v1/query
- Result Polling: GET /v1/query/{run_id}/result
- History Management: GET/DELETE /v1/history
- System Health: GET /health, /env-check, /db-check
CareCompass Backend v1.0.0
Evidence-based healthcare navigation through AI-powered multi-agent workflows
Built with FastAPI, LangGraph, MongoDB, OpenAI, and Tavily API