Inspiration

A serious diagnosis is terrifying. But what comes after — the phone calls, the cost research, the logistics, the insurance forms — is a second crisis nobody prepares you for. We built MedSurge AI because navigating the American healthcare system as a solo patient shouldn't require a law degree, a financial advisor, and a travel agent all at once.

What it does

MedSurge AI is a multi-agent system that activates the moment a doctor hands you a diagnosis. You upload your consultation PDF. Within minutes, MedSurge returns a complete action plan:

  • Drug prices — real-time pharmacy comparison via GoodRx for every prescribed medication
  • Surgery cost — exact facility fees from hospital price transparency files (legally mandated, updated 2025) combined with surgeon fees from the CMS 2026 Physician Fee Schedule
  • Travel logistics — traffic-aware routing via Google Maps, cab vs. flight decision based on distance, cost estimates, and three Google Calendar events created automatically
  • Insurance claim packets — pre-filled PDF claim forms ready to submit

How we built it

FastAPI backend orchestrating four specialized agents, each with a distinct data source and tool stack:

  • Analyser — Groq llama-3.3-70b-versatile with structured JSON extraction from 1-5 uploaded PDFs
  • Agent 1 (Medicines) — browser-use cloud SDK navigating GoodRx directly via drug slug URLs, optimized to under 75k tokens per session
  • Agent 2 (Surgery Cost) — CPT code mapping via Groq, surgeon fees from CMS PPRRVU2026 CSV, facility fees from 800MB hospital price transparency JSON pre-indexed into a lookup cache
  • Agent 3 (Travel) — Google Geocoding, Distance Matrix, and Static Maps APIs for routing; browser-use with Composio for flight search on long-distance trips; Google Calendar API for event creation

All agents run with human-in-the-loop checkpoints — nothing executes without patient confirmation.

Challenges we ran into

The 800MB problem. Hospital price transparency files are legally required but brutally large. Cedars-Sinai's JSON alone is 800MB. We built a one-time preprocessing step that indexes CPT codes into a fast lookup cache — first run takes 30 seconds, every run after is instant.

Browser-use token explosion. Our first GoodRx search consumed 675k tokens and took 5 minutes per drug. By switching from open-ended search tasks to direct URL navigation (goodrx.com/{drug-slug}) with max_steps=8, we dropped to 75k tokens and 44 seconds for two drugs simultaneously.

Composio flight search. The travel_class parameter expects an integer, not a string. A single type mismatch caused silent failures for an hour before we traced it through the browser-use logs.

Google Calendar OAuth. The redirect URI mismatch on first run blocked authentication entirely — required manual registration of localhost URIs in Google Cloud Console.

Accomplishments that we're proud of

Surgery cost accuracy using real data. When we ran a laparoscopic appendectomy at Scripps Memorial, the system returned $23,031–$34,788 — sourced entirely from Scripps' own 2025 price transparency filing and the 2026 CMS fee schedule. No estimates, no multipliers, no guesswork. A knee replacement at UC San Diego came back at $37,524–$40,231. These numbers are real.

The full pipeline — PDF upload to calendar events created — runs end to end with working agents, real API integrations, and accurate data.

What we learned

Real healthcare data exists and is legally public — but nobody has made it usable. CMS publishes exact physician fees for every CPT code. Every hospital in America is required to publish their prices. GoodRx shows real pharmacy prices without an API key. The data problem in healthcare isn't availability, it's accessibility. MedSurge AI is an accessibility layer on top of data that already exists.

We also learned that browser-use prompt engineering is its own discipline. The difference between "search for this drug on GoodRx" and "navigate to goodrx.com/meloxicam and read the price table on first load" is the difference between 675k tokens and 75k tokens.

What's next for MedSurge AI

  • Frontend — patient dashboard and doctor upload portal in React
  • Insurance agent — auto-fill claim PDFs from patient insurance DB and submit
  • Loan coverage agent — surface medical financing options based on total cost
  • Multi-hospital comparison — show cost across nearby facilities so patients can choose
  • Nationwide expansion — we have one hospital's price file. There are 6,000 hospitals in America, all with public price files.

Built With

Share this project:

Updates