metadata
title: Multi-Agent AI Health System
emoji: π₯
colorFrom: blue
colorTo: green
sdk: docker
pinned: false
license: mit
PRESAGE: Multi-Agent AI Health Prediction System
A sophisticated medical AI system that uses multiple specialized agents to analyze patient health data and generate personalized 90-day prevention plans.
π Quick Start
Option 1: Automated Startup (Recommended)
Windows (Batch):
start-presage.bat
Windows (PowerShell):
.\start-presage.ps1
Option 2: Manual Startup
Terminal 1 - Start API Backend:
uvicorn api.main:app --reload --host 127.0.0.1 --port 8000
Terminal 2 - Start React Frontend:
cd client
npm install
npm run dev
The system will be available at:
- React UI: http://localhost:3000
- API Backend: http://127.0.0.1:8000
- API Docs: http://127.0.0.1:8000/docs
π Project Structure
presage/
βββ core/ # Core modules
β βββ llm.py # Groq LLM integration
β βββ patient.py # Patient data models
β βββ vector_store.py # ChromaDB vector store
β
βββ agents/ # Specialized agents
β βββ data_agent.py # Data validation & flagging
β βββ risk_agent.py # ML-based risk assessment
β βββ literature_agent.py # PubMed literature search
β βββ intervention_agent.py # 90-day plan generation
β βββ orchestrator.py # Pipeline coordinator
β
βββ api/ # FastAPI backend
β βββ main.py # REST API endpoints
β
βββ client/ # React (Next.js) frontend
β βββ ... # Next.js project structure
β
βββ data/ # Data storage
β βββ risk_models/ # Pre-trained ML models
β
βββ .env # Environment variables (API keys)
βββ requirements.txt # Python dependencies
βββ README.md # This file
π§ Configuration
Environment Variables
Create or update .env file in the root directory:
GROQ_API_KEY=your_api_key_here
Get your API key from: https://console.groq.com
π¨ Troubleshooting
Timeout Error: "Read timed out (read timeout=45/120)"
Cause: API server isn't running or is processing too slowly
Solution:
- Make sure API server is running:
uvicorn api.main:app --reload - Check API health:
curl http://127.0.0.1:8000/health - Check terminal logs for errors
- Increase timeout in the API client if needed
Connection Error: "Cannot connect to API server"
Solution:
- Ensure FastAPI is running on port 8000
- Check if port 8000 is already in use:
netstat -ano | findstr :8000 - Try a different port:
uvicorn api.main:app --port 8001
Import Errors
Solution:
pip install -r requirements.txt
Groq API Key Error
Solution:
- Verify
.envfile exists in root directory - Check that
GROQ_API_KEY=...is correct - Generate a new key at https://console.groq.com
π Pipeline Overview
The PRESAGE system operates through a coordinated multi-agent pipeline:
- Data Agent β Validates patient metrics and flags abnormalities
- Risk Agent β Predicts disease risk percentages using ML models
- Literature Agent β Searches PubMed for evidence-based interventions
- Intervention Agent β Synthesizes findings into a 90-day plan
- Orchestrator β Coordinates parallel execution and aggregates results
π Security
- API keys are stored in
.env(never commit to Git) .gitignoreprevents accidental exposure- No sensitive data is logged
- CORS enabled for frontend-backend communication
π¦ Dependencies
- groq: LLM API client
- fastapi: Backend framework
- Next.js/React: Frontend framework
- Tailwind CSS: UI styling
- scikit-learn: ML models
- chromadb: Vector database
- pydantic: Data validation
- requests: HTTP client
π§ͺ Testing
Run the orchestrator test:
python test_orchestrator.py
π API Documentation
Interactive API docs available at:
http://127.0.0.1:8000/docs
π€ Contributing
To add new agents or features:
- Add agent to
agents/folder - Implement
run_presage_pipeline()updates - Update API schema if needed
- Test with
test_orchestrator.py
π License
Proprietary Medical AI System