Triage is a multi-agent clinical decision support copilot for emergency department triage nurses. It listens to a normal triage interview, extracts a structured clinical snapshot from the conversation, runs that snapshot through a battery of validated bedside scoring rules (qSOFA, NEWS2, BE-FAST, HEART, Wells, ESI), and produces a one-screen packet that the receiving physician sees before the patient leaves the triage room. The packet recommends an Emergency Severity Index level, flags high-acuity differentials, lists every scoring rule that fired with the data it consumed, and persists the audit trail. The nurse retains full clinical authority. The system is decision support, not decision automation.
The browser layer is a Next.js 14 App Router application written in
TypeScript using React 18, Tailwind CSS, and shadcn-style component
primitives. It records microphone audio, streams it directly to the
Deepgram live transcription WebSocket via the official Deepgram browser
SDK, displays the live diarized transcript as it arrives, and posts the
final transcript to the backend when the nurse ends the interview.
Direct browser-to-Deepgram streaming avoids serverless body size limits
and gives a visibly live demo. The Deepgram project key never leaves the
server: a Next.js route at /api/deepgram-key mints a 60-second
ephemeral token for each session.
The backend layer is a set of Python serverless functions in api/,
deployed by Vercel's automatic Python runtime. The functions handle
agent orchestration, scoring, persistence, and packet retrieval. The
clinical scoring engine in api/_lib/scoring/ is pure Python with
standard-library dependencies only — every threshold is taken from the
original validation literature and unit-tested against boundary cases.
Anthropic's Claude Sonnet 4.6 is called via tool use to enforce
schema-conformant JSON output; one agent extracts the clinical snapshot
and a second agent proposes a ranked differential. Vercel KV stores each
packet under triage:packet:{id} with a 30-day TTL, accessed through
the redis Python client. Packets are retrievable by ID at
/packet/{id}.
- Node 20+
- Python 3.11+
- Accounts at Anthropic, Deepgram, and Vercel
git clone <your-repo-url> triage
cd triage
npm install
pip3 install -r requirements.txt
cp .env.example .env.local
# Fill in: ANTHROPIC_API_KEY, DEEPGRAM_API_KEY, KV_URL, KV_REST_API_TOKEN
npm run devOpen http://localhost:3000. Tap Start interview, conduct a
short triage conversation, then tap End interview. The packet
appears within five to eight seconds.
To run the unit tests:
python3 -m pytest tests/The unit tests cover every scoring module against boundary cases drawn
from the original validation literature. Live-API integration tests are
gated behind @pytest.mark.integration and skipped automatically when
ANTHROPIC_API_KEY is not set; run them explicitly with
python3 -m pytest -m integration.
- Push the repo to GitHub.
- In Vercel, click Add New Project and import the repo.
- Vercel detects Next.js automatically. Before clicking Deploy,
expand Environment Variables and add:
ANTHROPIC_API_KEY— from the Anthropic consoleDEEPGRAM_API_KEY— from the Deepgram consoleKV_URL— from a Vercel KV store you create under StorageKV_REST_API_TOKEN— from the same KV store
- Click Deploy. The first build takes two to three minutes.
After deployment, verify under the Functions tab that
api/finalize.py and api/packet.py appear with the Python runtime
and a 30-second max duration; both are configured by vercel.json.
Triage is a research prototype. It is not a regulated medical device, has not been validated in clinical trials, and must not be used to make clinical decisions outside an explicit research or educational context. The system is decision support, not decision automation; the nurse retains full clinical authority.