A specialized healthcare assistant system built using Google's Agent Development Kit (ADK) framework featuring intelligent symptom analysis and hospital location services for India.
This healthcare agent system features a coordinator agent that manages two specialized sub-agents:
- Friendly Patient Interaction: Warmly greets patients and understands their health concerns
- Symptom Analysis: Provides preliminary assessment of symptoms with appropriate recommendations
- Health Information: Delivers information about medical conditions and treatments
- Emergency Guidance: Offers critical emergency medical guidance and instructions
- Google Search Integration: Uses Google Search for additional medical information
- Auto-Location Detection: Automatically detects user location via IP address
- Hospital Location: Finds nearby hospitals and medical facilities using Google Places API
- Comprehensive Details: Provides hospital information including address, phone, rating, and hours
- Emergency Hospitals: Locates emergency hospitals and urgent care centers
- India-Focused: Optimized for Indian healthcare system with local emergency numbers
-
Smart Request Routing
- Analyzes user requests and routes to appropriate sub-agent
- Coordinates responses from multiple agents
- Provides comprehensive assistance
-
Seamless Integration
- Combines symptom analysis with hospital location services
- Provides emergency guidance with nearby hospital information
- Offers health information with specialist recommendations
- Automatic Location Detection: No need to ask users for their location
- India Emergency Integration: Uses 108 emergency number
- Real-time Hospital Search: Live data from Google Places API
- Medical Information Search: Google Search integration for medical queries
- Safety-First Approach: Prioritizes emergency situations and professional medical care
- Python 3.9 or higher
- Google AI Studio API key
- Google Places API key
- Internet connection for API access
-
Clone the repository
git clone <repository-url> cd agent-demo-health
-
Install dependencies
pip install -r requirements.txt
-
Set up environment variables
Option A: Use the setup script (Recommended)
python setup_env.py
This will create a
.env
file with all necessary variables. Then edit the.env
file to add your API keys.Option B: Manual setup Create a
.env
file in the root directory:# For Google AI Studio (default) GOOGLE_API_KEY=your_google_ai_api_key_here GOOGLE_GENAI_USE_VERTEXAI=False # For Vertex AI (alternative) GOOGLE_GENAI_USE_VERTEXAI=True GOOGLE_CLOUD_PROJECT=your_project_id GOOGLE_CLOUD_LOCATION=us-central1 GOOGLE_APPLICATION_CREDENTIALS=path/to/your/service-account-key.json # Required for both GOOGLE_PLACES_API_KEY=your_google_places_api_key_here DEFAULT_MODEL=gemini-2.0-flash
-
Get your API keys
# For detailed instructions on getting API keys python setup_env.py --help
Required API Keys & Authentication:
Option A: Google AI Studio (Recommended for beginners)
- Google AI API Key: Get from Google AI Studio
- Set
GOOGLE_GENAI_USE_VERTEXAI=False
in.env
Option B: Vertex AI (Enterprise/Production)
- Google Cloud Project: Create project in Google Cloud Console
- Service Account: Create service account with Vertex AI permissions
- Service Account Key: Download JSON key file
- Set
GOOGLE_GENAI_USE_VERTEXAI=True
in.env
- Set
GOOGLE_APPLICATION_CREDENTIALS=path/to/your/service-account-key.json
Both options require:
- Google Places API Key: Get from Google Cloud Console
-
Validate your setup
python setup_env.py --validate
-
Choose your AI service Edit your
.env
file to select either:- Google AI Studio: Set
GOOGLE_GENAI_USE_VERTEXAI=False
(default) - Vertex AI: Set
GOOGLE_GENAI_USE_VERTEXAI=True
(enterprise)
- Google AI Studio: Set
-
Run the agent
adk web
For production deployment to Google Cloud Vertex AI, see the Deployment Guide.
-
Create deployment configuration:
cp .env1.template .env1 # Edit .env1 with your Google Cloud settings
-
Deploy to Vertex AI:
python deploy.py create
-
Test deployment:
python deploy.py test <resource_id>
For detailed instructions, troubleshooting, and best practices, see deploy_guide.md.
The system provides a web interface where users can interact with the healthcare coordinator:
-
Symptom Analysis
- User: "I have a fever and headache"
- System: Analyzes symptoms, provides preliminary assessment, and offers recommendations
-
Hospital Finding
- User: "Find nearby hospitals"
- System: Auto-detects location and provides list of nearby hospitals with details
-
Emergency Guidance
- User: "Someone is having chest pain"
- System: Provides immediate emergency guidance AND finds nearest emergency hospitals
-
Health Information
- User: "Tell me about diabetes"
- System: Provides comprehensive information about diabetes and management
- Symptom Analysis: Preliminary assessment with urgency levels
- Hospital Information: Name, address, phone, rating, hours, and status
- Emergency Guidance: Step-by-step instructions for emergency situations
- Health Information: Condition descriptions, symptoms, and care recommendations
- Safety Reminders: Always includes medical disclaimers and emergency number (108)
The system uses a .env
file for configuration loaded automatically using python-dotenv
.
Always Required:
GOOGLE_PLACES_API_KEY
: Your Google Places API key (required)
For Google AI Studio:
GOOGLE_API_KEY
: Your Google AI API key (required)GOOGLE_GENAI_USE_VERTEXAI
: Set toFalse
For Vertex AI:
GOOGLE_GENAI_USE_VERTEXAI
: Set toTrue
GOOGLE_CLOUD_PROJECT
: Your Google Cloud project ID (required)GOOGLE_APPLICATION_CREDENTIALS
: Path to service account JSON file (required)
For Google AI Studio (default):
GOOGLE_GENAI_USE_VERTEXAI
: Set toFalse
(default)DEFAULT_MODEL
: AI model to use (default: gemini-2.0-flash)
For Vertex AI:
GOOGLE_GENAI_USE_VERTEXAI
: Set toTrue
GOOGLE_CLOUD_PROJECT
: Your Google Cloud project ID (required)GOOGLE_CLOUD_LOCATION
: Location for Vertex AI (default: us-central1)GOOGLE_APPLICATION_CREDENTIALS
: Path to service account JSON file (required)DEFAULT_MODEL
: AI model to use (default: gemini-2.0-flash)
Google AI Studio Setup (.env file):
GOOGLE_API_KEY=your_actual_api_key_here
GOOGLE_GENAI_USE_VERTEXAI=False
GOOGLE_PLACES_API_KEY=your_places_api_key_here
DEFAULT_MODEL=gemini-2.0-flash
Vertex AI Setup (.env file):
GOOGLE_GENAI_USE_VERTEXAI=True
GOOGLE_CLOUD_PROJECT=your-project-id
GOOGLE_CLOUD_LOCATION=us-central1
GOOGLE_APPLICATION_CREDENTIALS=./path/to/your-service-account-key.json
GOOGLE_PLACES_API_KEY=your_places_api_key_here
DEFAULT_MODEL=gemini-2.0-flash
# Create .env file with all variables
python setup_env.py
# Get help on obtaining API keys
python setup_env.py --help
# Validate your .env file configuration
python setup_env.py --validate
agent-demo-health/
βββ healthcare_agents/
β βββ __init__.py # Package initialization
β βββ agent.py # Main coordinator agent
β βββ config.py # Configuration management
β βββ prompt.py # All agent prompts and instructions
β βββ symptom_agent.py # Symptom analyzer agent
β βββ hospital_finder_agent.py # Hospital finder agent
βββ setup_env.py # Environment setup script
βββ deploy.py # Deployment script for Vertex AI
βββ deploy_guide.md # Comprehensive deployment guide
βββ requirements.txt # Python dependencies
βββ LICENSE # MIT licence
βββ Agent_demo_colab.ipynb # Notebook to run the agent in Google Colab.
βββ .env # Environment variables (created by setup)
βββ .env1.template # Template for deployment configuration
βββ README.md # This file
-
Coordinator Agent (
healthcare_coordinator
)- Routes requests to appropriate sub-agents
- Manages multi-agent interactions
- Provides comprehensive responses
-
Symptom Analyzer (
symptom_analyzer
)- Google Search integration for medical information
- Symptom analysis with urgency assessment
- Emergency guidance system
-
Hospital Finder (
hospital_finder
)- Auto-location detection via IP address
- Google Places API integration
- Real-time hospital information retrieval
- Google ADK: Agent Development Kit framework
- Google AI (Gemini): Language model for agent responses
- Google Places API: Hospital and medical facility data
- Google Search: Medical information retrieval
- Python-dotenv: Environment variable management
IMPORTANT: This healthcare assistant provides general health information and should not be used as a substitute for professional medical advice, diagnosis, or treatment. Always seek the advice of your physician or other qualified health provider with any questions you may have regarding a medical condition.
In case of medical emergency, call emergency services immediately:
- India Emergency Services: 108
- Additional Emergency Numbers: Available in system responses
- No personal health information is stored permanently
- All interactions are processed in real-time
- Location detection is automatic and temporary
- API calls are secured with proper authentication
- Service account credentials are kept local and secure
- Vertex AI provides additional enterprise security features
Use the ADK web interface for testing:
adk web
Navigate to http://localhost:8000
to access the web interface.
- Symptom Analysis: Test with various symptom combinations
- Hospital Search: Verify location detection and hospital results
- Emergency Situations: Test emergency guidance responses
- Health Information: Query various medical conditions
- Fork the repository
- Create a feature branch
- Install development dependencies
- Test your changes
- Submit a pull request
- Follow PEP 8 style guidelines
- Include comprehensive docstrings
- Keep prompts in
prompt.py
for centralized management - Maintain minimal agent files with only tool integration
Google AI Studio API (Option A)
- Used for agent language model capabilities
- Free tier available for moderate usage
- Easier setup for development and testing
- Required when
GOOGLE_GENAI_USE_VERTEXAI=False
Vertex AI (Option B)
- Google Cloud's enterprise AI platform
- More advanced features and enterprise support
- Requires Google Cloud project and service account
- Better for production deployments
- Required when
GOOGLE_GENAI_USE_VERTEXAI=True
- Used for hospital and medical facility search
- Requires billing setup after free tier
- Essential for hospital finder functionality
- Required for both AI Studio and Vertex AI setups
-
Enhanced Medical Information
- More comprehensive symptom database
- Drug interaction information
- Preventive care recommendations
-
Improved Location Services
- Manual location input option
- Multi-city hospital search
- Specialist finder by specialty
-
User Experience
- Multi-language support
- Voice interaction capabilities
- Mobile-optimized interface
This project is licensed under the MIT License. See the LICENSE file for details.
Remember: This is a healthcare information tool, not a replacement for professional medical advice. Always consult with qualified healthcare providers for medical decisions.