Mental Model

Ed Donner

Five layers for Healthcare Assistant — Sign-in through Present — plus which Anthropic workflows the Consultation agent uses.

FastAPI · Clerk JWT · OpenAI stream · SSE

Overview

One consultation is easiest to hold as five layers. AI sits in Consult; Sign-in, Gate, Capture, and Present are product and delivery. Anthropic names from Building effective agents (PDF).

Applied workflows

  • Routing. Clerk plan check routes premium clinicians to the form; others see the PricingTable before any model call. See Consultation.
  • Prompt Chaining. System prompt plus visit fields → streamed three-section reply (summary, next steps, patient email).
  • Not used here (yet). Parallelization, Orchestrator-Worker, Evaluator-Optimizer.

Layers

  • 1 Sign-in. Clinician opens the product page; Clerk session establishes identity.
  • 2 Gate. UI checks premium_subscription; without it, PricingTable is shown and consultation stays blocked.
  • 3 Capture. Clinician submits patient name, visit date, and notes; UI fetches a Clerk JWT.
  • 4 Consult. FastAPI verifies JWT via JWKS, then streams gpt-5-nano over SSE for Consultation.
  • 5 Present. Client renders SSE deltas as markdown (summary, next steps, draft email).

Layer map

Layer stack for one signed-in consultation. Diagram key: ✦ AI agent · second line = Anthropic workflow · purple = actor · white = service.

---
config:
  theme: default
  themeVariables:
    background: "#ffffff"
    fontSize: "14px"
---
flowchart TB
    person[Clinician]
    signin["1 Sign-in
Clerk session"] gate["2 Gate
Routing"] capture["3 Capture
visit notes"] consult["✦ 4 Consult
Prompt Chaining"] present["5 Present
SSE markdown"] person --> signin --> gate gate -->|premium| capture --> consult --> present gate -->|no plan| person present --> person classDef agent fill:#e8f0ee,stroke:#0f3d36,stroke-width:2px,color:#0d0d0d classDef service fill:#fafaf8,stroke:#c8c8c2,stroke-width:1px,color:#0d0d0d classDef actor fill:#f3eef8,stroke:#6b4f9a,stroke-width:2px,color:#0d0d0d class consult agent class signin,gate,capture,present service class person actor

Read layers top to bottom; drill into Consultation for SSE and prompts.

Use this tab as the layer map and Anthropic workflow callout for Consultation. Product overview stays on Project.