Case study / 01

Tether Health

How I built a HIPAA-compliant agentic AI platform as the sole engineer, from zero to production, in eight months.

Role: Co-Founder & CTOTeam: Sole engineerTimeframe: Dec 2025 – PresentStack: Next.js 15, TypeScript, AWS Bedrock, Supabase, Postgres

The problem

Primary care referrals to specialists still move by fax and phone call. The sending clinic loses visibility the moment the fax goes out. The receiving clinic gets a stack of paper with no structure. Patients fall through the cracks. Tether closes that loop: it structures the referral, routes it into the receiving EHR, and tracks it through the specialist's workflow until the note comes back.

What I built

Everything below shipped to production, running on real patient referrals.

Agentic AI System

  • Full Anthropic tool-use loop on AWS Bedrock (Claude Sonnet + Haiku), engineered for HIPAA compliance via the AWS BAA
  • 8 registered tools spanning directory search, referral state, practice analytics, insurance compatibility, scheduling, and memory recall
  • Dynamic per-view system prompts so the model behaves differently on the dashboard, the referral detail page, and the analytics view
  • PHI-scrubbed logging on every model call: tool names and argument keys are logged, values are not
  • Server-side patient-name auto-linking rewrites free-text model output into clickable in-app links without leaking IDs into the prompt

Multi-Tenant Agent Runtime

  • Atomic Postgres task claiming via a custom claim_agent_tasks RPC using FOR UPDATE SKIP LOCKED, so multiple runtime ticks can safely process tasks in parallel
  • Per-practice fair queueing (5 tasks per practice per tick) prevents one busy practice from starving others
  • Per-dependency circuit breakers on Bedrock, Athena, Telnyx, Vapi, and Resend, with exponential backoff and half-open recovery
  • Per-practice USD budgets (daily, monthly, hard-cap) with a reserve-commit-release pattern, so a runaway agent can't burn through a customer's spend
  • Scoped LLM response cache keyed by SHA256 of inputs, per-handler namespace, PHI-flag aware, 24-hour TTL
  • Human-in-the-loop approval gates with a trust gradient: never | always | first_n_runs

11 Production Agent Handlers

  • Clinical Synthesizer: parallel Sonnet narrative + Haiku structured extraction, merged before persistence
  • 5 referral-lifecycle pollers: await-delivery, await-acknowledgment, await-scheduled, await-visit, await-consult-note
  • 2 practice-insights handlers derived from Encounter, DocumentReference, and Condition FHIR resources
  • 4 Slack-facing Scrum Master handlers for morning briefings, nudges, reminders, and evening digests

athenahealth EHR Integration

  • FHIR R4 adapter (1,355 LOC) covering 13 resource types: Patient, Coverage, Condition, MedicationRequest, AllergyIntolerance, DocumentReference, DiagnosticReport, Observation, Immunization, Procedure, Encounter, Practitioner, Organization
  • OAuth 2.0 client-credentials with per-practice token caching and 10-second timeouts
  • HTML-to-PDF visit summary write-back via the athenaOne v1 API (chose v1 after documenting why system/Binary isn't available under 2-legged CCG)
  • Practice-insights derived from Encounter and DocumentReference since ServiceRequest is not available under CCG scope

Auth & Security

  • Custom SAML 2.0 Service Provider built on @node-saml/node-saml, embeddable inside athena's clinical iframe
  • Config-driven attribute mapping: every SAML attribute name reads from an env var, so mock-to-prod cutover is a config change, not a redeploy
  • Iframe-safe Supabase sessions using service-role magic links + verifyOtp, with SameSite=None; Secure; HttpOnly; Partitioned cookies for Chrome 115+ third-party cookie blocking
  • Fail-closed error handling on any SAML validation error, with typed error reasons: expired, invalid_signature, wrong_audience, malformed, unknown_issuer

Testing & Data

  • Real-signature SAML integration tests that build actual SHA256-signed SAML responses and run them through the production ACS route
  • In-memory FakeSupabase test harness with a thenable query-builder chain and registerable RPC handlers, so runtime tests exercise budget, circuit breaker, cache, and executor logic against production code paths without a live DB
  • 51+ Postgres migrations covering the agent runtime, referral state machine (19 states, 7 terminal outcomes), memory system, and BAA/Part 2 compliance schema
  • 6 Vercel cron jobs with Bearer $CRON_SECRET auth, explicitly rejecting the spoofable x-vercel-cron-only header pattern

Patent

Provisional patent / Filed April 2026

Co-inventor on a provisional patent covering four core innovations: practice-specific adaptive memory, fax-bridge network acquisition, multi-context AI agent orchestration, and corporate network intelligence aggregation.

What I learned

You can build production healthcare software as one person if you're willing to hold every layer of the stack in your head at once. AI-assisted development doesn't remove the need to understand what you're building, it removes the need to type it out. The hardest part of Tether wasn't the code. It was making the code useful inside a clinic that had never used software like it before.