Inspiration

Basil loved to travel. He also had cancer. He died in February 2024, at 33.

The trips were never the problem. Planning them was. Which day is too long. Is his medication legal at the border. Will insurance pay. Which pharmacy is open. He did that research across government advisories, drug databases, insurer pages, and clinic PDFs.

Basil is why I started. He is not the whole market. PlanMyTrip.health is a general-health product: five condition profiles today, cancer next, and the same engine for any condition that changes what a day can hold.

He is not an edge case.

  • In 2021, 45.1% of Canadians lived with at least one major chronic disease, and 1 in 12 lived with three or more (Statistics Canada).
  • 64% of adults 50 and older expect at least one leisure trip in 2026 (AARP).
  • In a review of Google Travel, Tripadvisor, Expedia, Booking.com, and Kayak, none asked for a health condition during trip planning.

The tools that plan travel optimise for sights. They do not know what your body can do on day three, whether your medication is legal in the country, or whether your insurer requires a call before you go.

What it does

PlanMyTrip.health is a planning aid, not medical advice. It does five jobs:

  1. Plan the trip. Six research specialists find stays, tables, trails, culture, transit, and care. A lead concierge sequences their verified picks into days.
  2. Pace it. A deterministic engine turns the condition into daily step and walking ceilings, required recovery, and a modeled score. The agents work inside those caps; they cannot lift them.
  3. Check the live pages. TinyFish opens real pages in real browsers. The venue pass reads selected menus and booking pages for live prices and dishes. The verification pass reads the current travel advisory, a drug database, and the insurer's coverage page. Every finding carries its source URL and the time it was read.
  4. Make it usable. The finished plan becomes a numbered map and a day-by-day route with a Google Maps handoff. The care card is plain text for a clinician and an insurer.
  5. Learn from the trip. A consented outcome loop records what actually happened, computes the dose from the plan, and calibrates the pacing estimate.

The onboarding collects:

  • Destination with autocomplete, current location, or a map pin
  • An optional start date and traveller count
  • 2-20 days
  • Budget and transport
  • Condition, medication name, Sun Life coverage, and research consent

Planning requires a Clerk account. Saved trips are account-owned snapshots; the research capture stays anonymous.

How it works

The core design decision is a split between probabilistic work and deterministic safety.

The engine is deterministic. buildHealthTripPlan is pure TypeScript. It does not read the clock, call a model, or use randomness. It maps one of five condition profiles to a daily step ceiling, a walking ceiling, required recovery, and a health safety score. Day one is planned at 45% of the ceiling, middle days at 80%, the final day at 40%. The plan is conservative by construction. Trips are supported from 2 to 20 days.

The agents are probabilistic. Seven OpenCode sessions do the research. Each specialist has its own system prompt, source rules, and JSON shape, and can only use websearch and webfetch (no shell, file writes, or subagents). The lead concierge receives the verified research plus the engine's day ceilings and returns one sequenced plan. Specialists have 420 seconds and 20 steps; the concierge has 300 seconds and 12 steps; /api/agent-plan declares maxDuration = 900. The runtime warms at server start so a first trip does not pay service and agent-registration latency.

TinyFish is the live browser layer. It is used in two ways.

  • The venue pass is the new centrepiece.
    • POST /api/venue-research is an authenticated SSE route. A stay job opens bookingUrl ?? sourceUrl; an eat job opens menuUrl ?? sourceUrl.
    • A plan checks at most two hotels and three restaurants, three browsers at a time, with a 75-second job timeout, 45 seconds of run-record recovery, a 255-second run budget inside a 300-second route, one retry, and a fallback from the preferred URL to the plan's source page.
    • It requests no recording. It returns strict menu and hotel JSON: items, sections, descriptions, prices, allergens stated by the page, nightly rate, total, taxes, cancellation, and booking URL.
    • The venue stream is the full contract: venue_started, venue_status, venue_activity, venue_streaming_url, venue_sources, venue_result, venue_error, and venue_done. The frame guard rejects unsafe preview URLs, bad worker ids, and malformed evidence.
    • The UI keeps one iframe per venue mounted, shows the live preview while the browser runs, and replaces it with the checked facts when the page settles. A four-cell run bar shows pages, clock, evidence, and sources/actions. The right rail shows timestamped activity and the source ledger. The finished facts also appear on the plan's selected-place rows.
  • The verification pass remains available.
    • Three TinyFish workers run in parallel against the travel advisory, Drugs.com, and Sun Life. Each streams its live browser URL, progress, and a strict JSON result over SSE.
    • The current limits are a 100-second browser run, the provider's 150-step default, a 280-second client budget and a 300-second route.
    • A stream that ends before COMPLETE reconciles through GET /v1/runs/{id}. A transient failure retries once, a blocked site retries once with the stealth profile, and one worker's failure never aborts its siblings.
    • When recording is enabled, the WebM is archived locally and served only to signed-in users.

The route is derived, not re-planned. lib/route turns the finished plan into one ordered route per day. It drops places without verified coordinates, pins meals and stay check-ins to their slots, and orders the rest with nearest neighbour, 2-opt, and Or-opt. The traveller's transport mode (walk, transit, car, mixed) decides each leg. Each day gets a Google Maps link, at most nine waypoints. The route never moves a place to another day and never changes the dose.

Verification can only tighten. A heat or air-quality notice on a sensitive condition extends that day's recovery by 30 minutes. An advisory note is appended to the checkpoint. A coverage rule becomes a checklist item. Step ceilings, walking ceilings, scores, and the Sun Life alert never change. Every adjustment has a source and a retrieved time, and the reader can switch it off.

Caching results, not progress. Plans live 30 days, verification 14 days, menus 7 days, and room rates 12 hours. A cached hit replays real recorded telemetry with cached: true: the same agent results, same sources, same activity, no percentage or invented ETA. Venue cache keys are place-scoped, so two restaurants that share a city listing cannot overwrite each other. A cached plan stays fast while the venue deck loads, replays, or refreshes independently.

Accounts and captures are separate. Clerk owns identity. saved_trips is scoped by Clerk user id and stores a validated trip and plan snapshot. The research capture is consent-gated, keyed only by a random install id, and never stores the Clerk user id.

The data loop is the long game. A consented run writes a dossier: the request, the engine plan, the computed dose, the features, the specialist summaries, the browser findings, and the consent version. After the trip, the traveller records one explicit outcome: flare, care sought, adherence. PostgreSQL stores it. There is no account link, cookie, email, or free text. An unanswered follow-up is excluded, never treated as a negative.

The model learns the residual, not the medicine. The engine's modeled risk is the prior log-odds. A penalized logistic regression learns the residual with three features: peak exposure, recovery coverage, and trip length. Standardisation, coefficients, and the isotonic map are fitted inside nested grouped folds, so the reported numbers are honest out-of-fold. With zero labels the coefficients are zero and the model is exactly the engine.

The model is trained on 900 synthetic trips with 195 flares. Out-of-fold results:

Metric Value
Brier 0.1612 (engine: 0.1674)
Log loss 0.4966
ECE 0.0238
AUROC 0.6620
Calibration slope 0.9549

The point is calibration and the pipeline, not a headline AUC. Tiers are engine, synthetic, pooled (50+ real labels), and condition (200+ labels for that condition). A synthetic artifact is visible on /model but can never change a live plan. A shipped model may only tighten a cap, never widen one; today it changes no cap at all.

How I built it

Layer Stack
App Next.js 16.4.6, React 19.3, strict TypeScript, Tailwind 4.3.3, Vitest 4.1.12
Agent runtime @opencode/client 2.3.2 against an OpenCode service; the app writes a temporary seven-agent config outside the repo and never touches provider credentials
Live browsers TinyFish SSE Web Agent API with strict output schemas
Store PostgreSQL with pg; schema and training/export CLIs are scripts
Map Leaflet, grayscale OpenStreetMap tiles, Photon/Nominatim geocoding
Accounts Clerk 7.10.7 (accounts and saved trips)
Deploy nginx, Certbot TLS, systemd service

This is my second travel product. IsMyTripSafe.com, a destination-safety site, now serves 2,000+ monthly users; PlanMyTrip.health is its health-first counterpart.

The design is Paper and Ink: Instrument Serif, Hanken Grotesk, IBM Plex Mono, hairlines, no photography, no gradients, no shadows. The pacing strip and the numbered map are the signature elements. The point is to make a medical-adjacent product feel like a clinical chart, not a travel brochure.

The suite has 627 tests: 595 pass without a database, 32 PostgreSQL integration tests skip when DATABASE_URL is absent. Tests cover the engine across every condition and 2-20 days, the SSE routes, the agent parsers, the route optimiser, the overlay, the model math, the data loop, the design guard, and 13 WCAG contrast pairs.

Challenges we ran into

Making agents safe without making them useless. A model can plan a beautiful day that is wrong for the body. The answer was not a better prompt; it was a hard boundary. The engine owns the ceiling, the agents plan inside it, and the verification overlay only tightens. The interface says this on the page.

Live sites are not a mock. TinyFish runs real browsers, so the failures are real: slow booking engines, blocked sites, empty findings, step limits. In the London venue pass, the hotel rate came from Synxis, Udupi Dosa from Toast, and Organique from its own menu. Locomotive Espresso initially failed after its HappyCow listing and official site exposed no priced menu; the tile kept a retry and the other facts stayed usable. A later retry found a third-party menu page and returned 12 priced items. The UI shows that source verbatim.

Structured output from a browser agent. The workers return JSON against a strict schema. The parser accepts balanced objects, repairs trailing commas, unwraps single-element arrays, and normalises placeholders to null. A malformed result keeps the raw text and a parse error; it never becomes a guess.

Calibration without labels. I could have trained a model on synthetic data and called it calibrated. That would be dishonest. The pipeline is real, the artifact is labelled synthetic, and the tier gate refuses it for live use. The next step is a consented pilot, not a bigger model.

One page, not tabs. The first version used tabs; they hid the live work and made the listener click. The current workspace is one scroll: mission, route, venues, safety, verification. Every surface stays mounted so both streams keep running.

Medical safety. No doses, no diagnosis, no medication changes. The five profiles carry a VERIFY flag and a residual-risk floor. The insurer rules are one constant with the stability window left null because it was not supplied. The care card says: planning aid only; confirm with your clinician and insurer.

Accomplishments that I'm proud of

  • A real end-to-end run: seven specialists completed in about six minutes on a production four-day plan; three TinyFish verification workers ran against live sites; the route, caps, care card, and citations all came from the same run.
  • A complete venue pass on a cached London plan: four pages checked, three menus, one room quote, 36 items, 10 sources, and 45 recorded actions. The hotel rate was CA$199.00 a night; the menus came from Toast, Organique, and a checked third-party page.
  • A one-page demo that shows the work while it happens: the seven-agent deck, the live browser preview, the source ledger, the venue evidence cards, and the mission band.
  • 627 tests and a design system that holds under a strict guard.
  • A calibration pipeline with nested folds and an honest ship gate, not a fake AUC.
  • A data contract that is consented, install-scoped, and free of free text.
  • Account-owned saved trips that reopen the concierge snapshot while rebuilding the current safety envelope.

What I learned

  • The safety ceiling should be deterministic. The model is for research, sequencing, and calibration, not for deciding what is safe.
  • Calibration is not prediction. The engine already carries the physiology; the model's job is to correct the scale, and only after real outcomes exist.
  • Compute the dose from the plan, not from the agent's self-report. The concierge's step estimate is a claim; the block model is the record.
  • "Not found" is a feature. A missing answer is better than an invented one.
  • The live site is the test. Mock runs prove the UI; they do not prove the integration.
  • A one-page workspace beats tabs for a demo and for a traveller.
  • Cache results, not progress. Replaying real recorded telemetry is honest; replaying a fake percentage is not.

What's next

  • A consented pilot to collect real outcomes and replace the synthetic artifact. The first gate is 50 labelled trips for pooled calibration; 200 per condition for condition intercepts.
  • A cancer profile, reviewed by a clinician, because that is the story that started this.
  • Feed a bounded venue-evidence summary into the concierge before it chooses places, so a missing rate or priced menu can influence the plan.
  • Retire the legacy video-verification section now that the venue deck is the primary TinyFish surface.
  • A returning-traveller flow: reopen a saved run and record the outcome without the live plan on screen.
  • Real transit schedules, opening hours, and cross-day pacing rebalancing.
  • Rate limiting, a retention/deletion path, database backups, and a privacy review before charging.
  • A clinician review of the dose mapping, the overlay keywords, and cumulative load on 8-20 day trips.

Try it out

The site is a planning aid, not medical advice. Confirm with your clinician and insurer before you travel.

Built With

Share this project:

Updates

Submission history