This system provides AI-powered heart failure medication titration support for CS224V research. It uses the OpenAI Agents SDK with Azure OpenAI for realistic patient-agent conversations.
python3 cli.py interactive --patient-id HF_CONV_001 --weeks 4- You act as the patient
- HF Agent provides clinical guidance
- Automatic week progression when agent says "WEEK_COMPLETE"
python3 cli.py automated --patient-id HF_CONV_001 --weeks 4- Two AI agents converse automatically
- Realistic patient behavioral patterns
- Complete conversation logs saved
python3 cli.py list-scenarios- Shows all 149 available patient scenarios
- Different education levels, medical literacy, medication combinations
- CLI Interface (
cli.py) - Main entry point for all interactions - HF Agent (
hf_agent/agents/azure_hf_agent.py) - Clinical decision support agent - Patient Agent (
hf_agent/agents/azure_patient_agent.py) - Simulates realistic patients - Clinical Tools (
hf_agent/tools/complete_protocol_tools.py) - Evidence-based protocols
✅ 20+ Heart Failure Medications with complete clinical protocols
✅ 149 Patient Scenarios with varied backgrounds and medication regimens
✅ Behavioral Patterns (adherence, symptoms, side effects, outcomes)
✅ Safety Validation with emergency detection and lab monitoring
✅ Time-based Lab Monitoring (1-2 weeks for ACE/ARB, 2-4 weeks for others)
✅ Evidence-based Titration using clinical guidelines
✅ Rich CLI Interface with progress tracking and conversation logs
- Patient Scenarios (
all_conversations.json) - 149 realistic clinical cases - Medication Protocols (
hf_agent/data/complete_protocols.py) - Complete clinical data - Clinical Guidelines - Built into agent instructions and tools
- Uses
AsyncAzureOpenAIclient for proper Azure integration - Function calling for clinical tools and patient data generation
- Conversation state management handled by SDK
- Adherence Patterns: consistently_high, declining, improving, fluctuating
- Symptom Patterns: steady_improvement, progressive_worsening, mixed_response
- Vital Signs Patterns: stable, trending_low/high, oscillating
- Target Endpoints: complete_success, side_effect_failure, acute_decompensation
- Mandatory Tool Usage: Agents must use specific tools for safety checks
- Evidence-based Protocols: All recommendations follow clinical guidelines
- Safety-first Approach: Emergency detection with immediate referral triggers
- Lab Monitoring: Automated reminders based on medication timing requirements
HF_Agent_CS224V/
├── cli.py # Main CLI interface
├── all_conversations.json # 149 patient scenarios
├── requirements.txt # Python dependencies
├── .env # Azure OpenAI credentials
└── hf_agent/
├── agents/
│ ├── azure_hf_agent.py # Heart Failure specialist agent
│ ├── azure_patient_agent.py # Patient simulation agent
│ └── patient_agent.py # Utility functions for patient data
├── data/
│ ├── complete_protocols.py # All 20+ medication protocols
│ └── protocol_loader.py # Protocol access utilities
├── models/
│ ├── medication.py # Pydantic models for medications
│ └── patient.py # Pydantic models for patients
├── tools/
│ └── complete_protocol_tools.py # Clinical decision support tools
├── evaluation/
│ └── safety_validator.py # Safety validation utilities
└── llm_client.py # Azure OpenAI client wrapper
- Medication Adherence Studies: Simulate different patient compliance patterns
- Clinical Decision Support: Test AI-guided medication titration algorithms
- Patient Education Research: Analyze communication effectiveness across education levels
- Safety Protocol Validation: Test emergency detection and intervention triggers
- Multi-agent Healthcare: Study AI-AI medical conversations and handoffs
- Realistic Patient Simulation with behavioral consistency over time
- Evidence-based Clinical Tools integrated via function calling
- Multi-week Progression with automatic state management
- Safety-first Architecture with mandatory protocol compliance
- Rich Conversational Interface supporting both human and AI interactions
This system demonstrates sophisticated AI agents working together to provide realistic, clinically-accurate heart failure medication management scenarios for research and education.