Inspiration
Prior authorization is one of healthcare's most broken workflows. Physicians spend an average of 13 hours per week on PA paperwork - time stolen from patients. A clinician has to manually pull patient records, decode payer policies, and write a justification letter that may take days to get approved. We built PriorAuth AI to collapse that 13-hour process into 30 seconds.
What It Does
PriorAuth AI is an agentic pipeline that automates the entire prior authorization workflow. A clinician types one sentence - the agent returns a complete, ready-to-submit PA letter.
Under the hood, three MCP tools run in sequence:
- FHIR Patient Fetcher - pulls structured clinical data (diagnoses, medications, encounters) from a SMART Health IT R4 FHIR server
- Coverage Checker - validates payer requirements using the Da Vinci CRD/DTR workflow and maps matched vs. unmet criteria
- Justification Writer - generates a clinical-grade PA letter via Gemini 2.5 Flash, grounded entirely in the patient's actual FHIR data
The agent runs on PromptOpinion's A2A platform with full FHIR Context Extension support, and is also accessible via a Next.js dashboard.
How We Built It
- MCP Servers: Three FastMCP services (Streamable HTTP) each exposing one tool, running in Docker on ports 8001-8003
- FHIR Context Extension: Implemented
ai.promptopinion/fhir-contextvia capability monkey-patching on each MCP server, with pure ASGI middleware to inject patient context from platform headers - Orchestrator: FastAPI service that chains the three tools sequentially and exposes a
/generate-authendpoint for the frontend - LLM: Google Gemini 2.5 Flash with a detailed clinical prompt - no placeholders, every sentence grounded in real FHIR data
- Frontend: Next.js + Tailwind CSS dashboard with live step visualization and auto-scroll
- Platform: Published as a BYO Agent on PromptOpinion Marketplace with A2A and FHIR Context Extension enabled
- Infrastructure: Docker Compose + nginx reverse proxy + ngrok static domain
Challenges
- MCP spec compliance: Getting
ai.promptopinion/fhir-contextto appear in the initialize response required monkey-patching FastMCP's internalget_capabilities- no direct API existed in the current version - FHIR integration: Handling fallback gracefully when the SMART sandbox is unavailable, without degrading the letter quality
- Gemini free tier limits: Multiple API key rotations during development - learned to build quota-aware workflows fast
- nginx upstream caching: Container recreation during hot-reloads caused 502s; fixed by always restarting nginx after recreating dependent containers
What We Learned
Building on the MCP spec taught us how powerful standardized tool interfaces are for agentic healthcare workflows. The FHIR Context Extension is a genuinely useful primitive - it lets the platform pass patient context without the agent needing to re-fetch it on every call.
Log in or sign up for Devpost to join the conversation.