Postman API Documentation - https://documenter.getpostman.com/view/38639286/2sB3WpPzvj
AI agent url - https://web-production-8b01c.up.railway.app/a2a/health
Step by Step Doc - https://medium.com/@adewumijosephine1/building-a2a-health-agents-with-django-and-google-gemini-eea792d8fa28
I built a Django-based AI health assistant that engages in natural conversations about health and wellness through the A2A protocol for Telex integration. This intelligent agent provides dynamic, contextual health advice using Google Gemini AI instead of static health tips.
This AI agent performs one main function with advanced capabilities
The agent engages users in natural, dynamic conversations about health topics. It understands context, remembers previous messages, and provides personalized health advice using Google Gemini AI. Users discuss health concerns and receive intelligent, conversational responses.
Deployed Bse URL: https://web-production-8b01c.up.railway.app
- Django Framework powers the web application
- Google Gemini AI provides intelligent conversation capabilities
- A2A Protocol enables Telex platform integration
- In-memory session management handles conversation history
- Gemini AI Integration processes natural language conversations
- A2A Endpoint handles Telex chat interactions
- Session Management maintains conversation context
- Health-focused AI specializes in wellness topics
- JSON-RPC 2.0 Compliance ensures protocol standardization
- Error Handling provides clear JSON error responses
- Logging System monitors agent performance and issues
- Health Monitoring offers service status verification
The agent uses Google Gemini 2.0 Flash model to provide intelligent health conversations. It maintains session context and delivers personalized advice based on user interactions.
- Railway Platform hosts the production environment
- Gunicorn Server handles web requests
- Environment Variables secure sensitive configuration
- No database dependency for faster performance
- Context-aware responses remember previous messages
- Health specialization focuses on wellness topics
- Natural language provides ChatGPT-like experience
- Session management maintains conversation flow
A Telex user sends a health-related message to the AI agent within the Telex application.
Telex identifies the health AI agent as the target and formats the user message into A2A protocol JSON-RPC format.
Telex sends an HTTP POST request to the Railway endpoint:
POST https://web-production-8b01c.up.railway.app/api/a2a/health
Telex sends this JSON-RPC 2.0 formatted data:
{
"jsonrpc": "2.0",
"id": "unique-request-id",
"method": "message/send",
"params": {
"message": {
"kind": "message",
"role": "user",
"parts": [
{
"kind": "text",
"text": "User's health question or message"
}
],
"messageId": "msg-id",
"taskId": "task-id"
},
"configuration": {
"blocking": true
}
}
}The A2AHealthView class in views.py handles the incoming request:
- Validates JSON-RPC 2.0 format
- Extracts user message from the parts array
- Processes conversation through Google Gemini AI
- Maintains session context for continuous dialogue
- Generates intelligent health responses based on conversation history
The Google Gemini AI analyzes the conversation and generates contextual responses:
- Understands health context and provides relevant advice
- Remembers previous messages in the session
- Asks follow-up questions to understand user needs
- Provides personalized health recommendations
- Maintains natural conversation flow
The application returns this structured JSON-RPC response:
{
"jsonrpc": "2.0",
"id": "original-request-id",
"result": {
"id": "task-id",
"contextId": "context-id",
"status": {
"state": "completed",
"timestamp": "2025-10-31T13:19:02.013544Z",
"message": {
"messageId": "response-msg-id",
"role": "agent",
"parts": [
{
"kind": "text",
"text": "Intelligent health response generated by AI..."
}
],
"kind": "message",
"taskId": "task-id"
}
},
"artifacts": [...],
"history": [...],
"kind": "task"
}
}Telex processes the A2A response and displays the AI-generated health advice to the user in the chat interface.
The system maintains session context for ongoing conversations:
- Session ID management tracks conversation history
- Context preservation remembers user health topics
- Natural dialogue flow enables multi-turn conversations
- Intelligent follow-ups provide comprehensive health guidance
The agent focuses specifically on health and wellness topics:
- Health advice for nutrition, exercise, and lifestyle
- Wellness tips for mental health and prevention
- Medical guidance within safe boundaries
- Personalized recommendations based on user context
- A2A Protocol Compliance ensures Telex compatibility
- JSON-RPC 2.0 Standard maintains communication consistency
- Google Gemini AI provides intelligent conversation capabilities
- Railway Deployment provides reliable hosting infrastructure
- Session-based conversations enable contextual dialogue
User: "How can I improve my sleep quality?" AI: "For better sleep, I recommend establishing a consistent bedtime routine. Try avoiding screens an hour before bed and keeping your room cool and dark. What's your current sleep schedule like?"
User: "I've been feeling stressed at work" AI: "Work stress can impact your health significantly. Try taking short breaks for deep breathing or stretching throughout the day. Have you noticed any specific triggers for your stress?"
User: "What are some healthy breakfast options?" AI: "Great question! For a nutritious breakfast, consider oatmeal with berries, Greek yogurt with nuts, or eggs with whole-grain toast. These options provide sustained energy. What foods do you typically enjoy in the morning?"
This intelligent conversation system creates an engaging experience where Telex users receive personalized, contextual health advice through natural dialogue with an AI health expert.