Skip to content

Add xAI patient intake example - #86

Open
tinalenguyen wants to merge 2 commits into
mainfrom
tina/xai-patient-intake
Open

Add xAI patient intake example#86
tinalenguyen wants to merge 2 commits into
mainfrom
tina/xai-patient-intake

Conversation

@tinalenguyen

Copy link
Copy Markdown
Contributor

Summary

Adds complex-agents/xai-patient-intake/: a family-medicine front-desk voice agent running the full xAI speech stack, plus the browser frontend for it.

Stage Model
Speech to text xai/stt-1
Reasoning xai/grok-4.20-0309-non-reasoning
Text to speech xai/tts-1 (voice carina)

Laid out like complex-agents/drive-thru: a Python worker (patient-intake-agent/) and a Next.js app (frontend/), each with its own README, and a top-level README carrying the layout table and quick start.

What it demonstrates

The agent identifies a caller against a chart, books and moves appointments, answers practice-policy questions from a published guide, collects pre-visit clinical intake, routes refill/results/billing/referral messages, and escalates possible emergencies.

The design is deliberately flat — one agent, one conversation, one fixed tool surface. No handoffs, no AgentTask, no workflow state machine. The model holds the conversation in its own context and passes what it has learned to eight typed tools:

read_practice_information · find_open_times · book_appointment · manage_appointment · take_message · update_insurance · record_previsit_intake · record_emergency_escalation

Every tool re-verifies identity from its own arguments instead of trusting remembered state, so a caller can book a visit, report a symptom, and update insurance in any order without a phase machine deciding what is allowed next. It is a useful counterpoint to the handoff-based examples here — worth comparing with medical_office_triage, which solves an adjacent problem with a triage/handoff structure.

Practice policy stays out of the prompt: src/clinic/practice_info/ holds the published guide as small Markdown files, and one argument-free tool returns all of it, leaving interpretation to the model rather than a category table.

Notes

  • The clinic is an in-memory fake — no real patient data, and nothing here is a medical device or a source of medical advice.
  • uv run python src/agent.py console gives a full voice conversation in the terminal with no frontend at all.
  • Unit tests cover the tool surface plus booking, rescheduling, message routing, intake, and emergency handling, with no network: uv run pytest tests/unit -q.
  • Both .env.example files are blank; no credentials are committed.

A family-medicine front-desk voice agent running the full xAI speech stack —
xai/stt-1, grok-4.20, and xai/tts-1 — with LiveKit Agents for transport and
turn detection. Laid out like the drive-thru example: a Python worker plus a
Next.js frontend, each with its own README.

complex-agents/xai-patient-intake/
  patient-intake-agent/  One agent, one conversation, eight typed tools over an
                         in-memory practice. No handoffs or workflow state
                         machine; every tool re-verifies identity from its
                         arguments, so a caller can book a visit, report a
                         symptom, and update insurance in any order.
  frontend/              Dispatches the worker and renders the conversation,
                         transcript, and tool calls.
@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
anam-healthcare-demo Ready Ready Preview Aug 21, 2026 8:56pm
lemonslice-demo Ready Ready Preview Aug 21, 2026 8:56pm

Request Review

Three unrelated cleanups to the xAI patient intake example.

Model: xai/grok-4.20-0309-non-reasoning -> xai/grok-4.3 with
reasoning_effort="none". 4.3 controls reasoning by parameter rather than
by model variant, so the non-reasoning behavior the front desk wants is
now a kwarg. Verified against the inference gateway on a live call.

Fonts: TWK Everett is licensed per-seat from weltkern, and shipping the
five woff2 files here redistributed it to everyone who clones a public
repo. Replaced with Space Grotesk over next/font/google, so no binary
and no license to breach. The --font-lk-display variable is unchanged,
so every font-display heading picks it up with no call-site edits.
fonts/README.md records what is left and why.

Audio: the browser enabled Krisp while the worker was already running
the ai-coustics enhancer, so two denoisers ran in series on the same
signal. The second one receives audio outside its training distribution
and the usual result is over-suppressed quiet speech -- exactly what
this agent's endpointing config exists to wait for. Kept the server
stage, which also covers SIP callers who never load the frontend.

Also expanded the endpointing comment to record the defaults it departs
from, and that min_delay is the knob to lower first because dynamic mode
only ever adapts upward from the floor.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant