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 singlehandedly adress this problem by creating an AI chat bot that runs entirely offline locally on your device. While primarily targeted to hikers, campers, and international travelers TrialAid is a Progressive Web App with a highly resilient backend to ensure zero data loss during emergencies.

How I built TrialAid: TrailAid is architected as an offline-first Progressive Web App (PWA) with a highly resilient backend utilizing to ensure zero data loss during emergencies.

Frontend & User Experience: I built the app primarily using SAI Aget S utilizing Next.js 15 and React, designing a PWA with a high-contrast dark theme 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 and rapid evacuation).

Crash-Resistant State Management: Ensuring the AI conversation 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: Implementing 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 duplicating 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 the edge 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—it was eye-opening to see how decoupling the execution state from the local device process creates applications that are virtually unkillable. 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 relentlessly serve humans in their most vulnerable moments.

Accomplishments that we're proud of: As a solo developer for this hackathon Im incredibly proud of teh amount of working features I integrated into TrialAid and my ability to create a working app in 24 hours entirely by myself. While I was unable to host it on vercel or Expo go. Im very produ of what i built in the last 24 hours. A tool that not only helps humans but saves them.

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
Share this project:

Updates