Building a medical emergency AI agent boot using A2A protocol for HNG backend stage.
Motivation:
Building Emergent AI and AI Agent that answers medical emergency related questions and give tips on what to do based on described emergency.
It is a difficult thing to exactly know what to do in different emergency situation, the data is already out their is just to have the exact information of what to do on different situation before help arise can save lives and property.
I wanted to be able to have an AI agent that can easily guide someone through this situation.
Tech stack:
PHP/Laravel
Laragent library
Railway
In short Emergent is a chat bot that answers #medical #emergency related questions & help with tips!
System design:
User Message (Telex)
    ↓
JSON-RPC 2.0 Request
    ↓
Railway App Service (NGINX Server)
    ↓
Laravel Framework & API
    ↓
Gemini AI Agent
    ↓
Format & Return
    ↓
A2A Response
    ↓
Telex.im Display
💻 Building the Agent:
I set up Laravel
Install Laragent
Register my API KEY on Gemini
Add the API_KEY to my .env file
I test the agent ability
I Implement the A2A Protocol
I test it again
I push to GitHub and deployed to Railway
Result
The challenges:
- I wasn't able to understand how a2a works. I go through the documentation and articles multiple times.
 - I wast not getting the right message. I went on to test and debug the codebase again.
 - Other AI model I used wasn't working. I tried multiple LLM before finally using Gemini.
 - Formatting the response and error. I created different methods to format the responses for error and success.
 - I have production error while deploying to Railway. I changed the PHP version from 8.2 to 8.3.
 - I wasn't able to integrate it with telex. An article and step by step guide was later sent to the slack group that is want I used to be able to setup my Agent.
 
Performance:
Response agent api time <500ms
Total response time ~2-3s
Uptime 99.9%
Success rate 99%
Conclusion:
Building Emergent AI Agent allow people to be able to seek emergency tips before help arrive and I was able to work on something extra-ordinary using AI and combining it with a technology new to me Telex A2A protocol.
Connect with me:
GitHub: https://github.com/abdulsalamamtech/hng-stage-3
X (Twitter): https://x.com/abdulsalamtech
Linkedin: https://linkedin.com/in/abdulsalamamtech
Facebook: https://facebook.com/abdulsalamamtech
              
    
Top comments (0)