Inspiration: One of the biggest issues plaguing the healthcare industry today is the collapse of rural and Safety-Net Care. Since 2010, over 150 rural hospitals have closed or discontinued inpatient services, and in 2026, roughly one-third of remaining rural hospitals are considered at risk of closing. This leads to a loss of emergency services, maternity wards, and primary care treatment for people living in these areas. I wanted to address this problem by creating an AI chatbot that runs entirely locally and offline on your device. Primarily targeted to hikers, campers, and international travelers, TrialAid is a Progressive Web App with a highly resilient backend to ensure zero data loss and full coverage during emergencies.
How I built TrialAid: TrialAid is architected as an offline-first Progressive Web App (PWA) utilizing a highly resilient backend to ensure zero data loss and optimal up-to-date adbvice/care during emergencies.
Frontend & User Experience: I built the app primarily using SAI Agent S, utilizing Next.js 15 and React to design a PWA optimized for outdoor visibility and battery efficiency.
Offline-First AI: To eliminate the need for an internet connection, I integrated WebLLM running the Phi-3.5-mini model (~2GB) directly in the browser via WebGPU.
Voice Integration: Recognizing that a user's hands might be occupied during an emergency, I implemented a push-to-talk interface using Deepgram's Nova-2 model for highly accurate, medical-grade speech-to-text.
Durable State & Backend: The backend is powered by Python Flask and PostgreSQL. To handle the chaos of remote environments, I utilized Agentspan and Orkes Conductor. This allows AI sessions to survive app crashes and network drops. If a device goes offline, emergency logs are queued locally and synced using an exponential backoff algorithm when the connection is restored.
🚧 Challenges I Faced: Resource-Aware Prompting: Standard AI models assume you have access to a hospital. I had to heavily engineer the system prompts to ensure the AI always asks "Do you have [X]?" before recommending a treatment. I had to build a two-tier response system: one for ideal treatments (e.g., an EpiPen for anaphylaxis) and one for wilderness improvisation (e.g., specific positioning, makeshift splints, etc.)
Crash-Resistant State Management: Ensuring the chat session could survive a browser crash or a dead battery was incredibly difficult. I had to leverage Orkes Conductor workflows and execution_id tokens stored in localStorage to allow the AI agents to seamlessly pick up right where they left off without losing the context of the medical emergency.
Offline Error Tracking: Implemented telemetry without an internet connection required building a custom transport for the Sentry SDK, queueing JavaScript errors in local storage, and ensuring they auto-synced without duplication once the user found cell service.
🧠What I Learned: Building TrailAid fundamentally shifted my understanding of offline-first application design. I learned how to move complex machine learning models directly onto devices using WebGPU, which completely changes the paradigm of where compute happens. Furthermore, working with Orkes Agentspan taught me the immense value of durable workflow orchestration. On a broader scale, structuring the 11 comprehensive WHO/WMS protocols into programmatic tools reinforced my vision for the future of AI: systems that are deeply grounded in factual, life-saving data and built to aid and support humans in their most vulnerable moments.
Accomplishments that I'm proud of: As a solo developer for this hackathon, I'm incredibly proud of the many features I integrated to create a working app in under 24 hours. While I was unable to host it on Vercel or Expo Go. I'm very impressed with what I was able to build across such a short timespan. A tool that not only helps but even saves lives.
What's next for TrailAid: I see lots of potential for an AI chatbot that runs locally and completely offline. In the near future, I plan to find a way to host it entirely offline.
Built With
- agentspan
- claude
- deepgram
- orkes
- python
- sai
- sentry
Log in or sign up for Devpost to join the conversation.