Alyssa

AI Care Companion for MD Well

Conversational API endpoint that generates SMS and voice responses for MD Well patient interactions. Two workflows: booking first coaching calls (sales) and weekly check-ins with enrolled patients (care). Every response passes inline quality gates (HIPAA, TCPA, crisis detection) before it reaches your system.

You send a patient message and conversation history. Alyssa returns the response. Your system handles delivery, scheduling, and escalation routing.

Quick Start

Send a patient message, get Alyssa's response:

curl -X POST https://{instance}.culturedcomputer.com/api/chat \
  -H "Authorization: Bearer {api_key}" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "How much does this cost?",
    "userId": "patient-mike-001",
    "model": "mercury",
    "toneName": "alyssa",
    "avatarName": "Alyssa",
    "conversationHistory": [
      { "role": "assistant", "content": "Hi Mike, it'\''s Alyssa from MD Well" }
    ],
    "templateParams": {
      "first_name": "Mike",
      "doctor_name": "Chen",
      "clinic_name": "MD Well",
      "booking_link": "https://mdwell.com/book"
    }
  }'

Response (Server-Sent Events):

data: {"choices":[{"delta":{"content":"Good news"}}]}
data: {"choices":[{"delta":{"content":", it's covered"}}]}
data: {"choices":[{"delta":{"content":" by your insurance."}}]}
data: {"choices":[{"delta":{"content":" Want to set up"}}]}
data: {"choices":[{"delta":{"content":" a quick call to get started?"}}]}
data: [DONE]

802ms to first character, 861ms to completion.

Concepts

TermDefinition
Patient ContextPatient-specific variables (templateParams) resolved into every response: name, doctor, clinic, booking link.
Conversation HistoryArray of prior messages you pass on each call. Alyssa uses this for continuity and personalization.
Quality GatesInline checks on every response: HIPAA, crisis detection, TCPA, AI tells, sentence limits. Failures block the response.
Escalation FlagWhen Alyssa detects crisis language, the response includes escalation.required: true and no coaching content. Your system routes to a human.
Sales ModeOutreach to new patients. Doctor framing, objection handling, insurance positioning. Goal: book a coaching call.
Care ModeWeekly check-ins with enrolled patients. Micro-habits, life moments, mood, condition-specific coaching.
Voice ModeTwo-call pattern: short acknowledgment streams to TTS immediately, full response follows.

Sales

Alyssa follows the MD Well outreach SOP. Every response uses the Younes framing and the patient's doctor name from templateParams.

Objection Handling

ObjectionApproach
“What is this exactly?”Names Dr. Younes and patient's doctor, explains coaching, states insurance coverage, asks for a call.
“How much does this cost?”Insurance coverage. Asks for a call.
“I already have a doctor”Coaching sits between visits, not a replacement. References their doctor by name.
“I don't have time”15-minute check-ins, rest is over text. Asks about schedule.
“I've tried things before”Coach has their health info from their doctor already. Not starting from scratch.
“Not interested”Acknowledges. Leaves the door open.
“Who is this?”Identifies as a coach at the clinic. Offers opt-out.

Production output

“What is this exactly?” PASS
Dr. Younes set up a coaching program for patients like you at MD Well, giving you a dedicated coach who checks in weekly, helps you build a simple plan, and it's covered by your insurance. Would this week work for a quick call?
787ms TTFC, 842ms total
“How much does this cost?” PASS
Good news, it's covered by your insurance. Want to set up a quick call to get started?
802ms TTFC, 861ms total
First outreach (no prior messages) PASS
Your doctor at MD Well has set up a coaching program for you. It's covered by your insurance, book your first call here: https://mdwell.com/book.
1140ms TTFC, 1144ms total

Care

Alyssa adapts based on the patient message and conversation history you provide.

Response Patterns

Patient message typeWhat Alyssa generates
Life moment (birthday, family event)Responds to the event. Health comes later or next message.
Low moodAcknowledges. One small action. Does not diagnose.
Health progress with side effectsSpecific to their situation. One adjustment.
Medical question outside scopeRoutes to their doctor by name.
ER visit or acute eventDrops casual tone. Gathers info. Returns escalation flag.

Production output

“We went to golden corral yesterday. Today was one of my grandkids birthdays” PASS
Happy birthday to the little one! How old is he turning? I bet the Golden Corral feast was a fun way to celebrate.
703ms TTFC, 763ms total
“honestly not great. everything feels like a lot right now” PASS
Sounds like a lot. A quick 5-minute breathing pause before bed might help reset. Want to try it tonight?
750ms TTFC, 808ms total
“I tried cutting caffeine after noon for 3 days and the 3am wakeups stopped but now I crash hard around 2pm” PASS
Sounds like your body is adjusting, 2 pm crashes are common when you cut caffeine. Maybe try a 5-minute walk or a glass of water right after lunch to push through.
768ms TTFC, 827ms total

Voice

Two-call pattern: a short acknowledgment (call 1) streams to TTS immediately so the patient hears something fast, then a full response (call 2) follows.

“...the 3am wakeups stopped but now I crash hard around 2pm” PASS
Call 1: “That 2pm crash is common after caffeine cut. A quick walk or snack might help.”
832ms TTFC
Call 2: “Sounds like a normal shift, caffeine cut can swing your energy. Try a 10-minute walk or a small protein-carb snack around 2 pm and see if it steadies things.”
774ms TTFC
Combined end-to-end: 1662ms

Integration Guide

The API generates responses. Your system handles everything else.

Conversation History

Store each exchange and pass the full array back on every /chat call. Alyssa uses this for continuity, tone adaptation, and personalization.

"conversationHistory": [
  { "role": "assistant", "content": "Hi Mike, it's Alyssa from MD Well" },
  { "role": "user", "content": "who is this?" },
  { "role": "assistant", "content": "Dr. Younes set up a coaching program..." }
]

Patient Context

Provide templateParams from your patient records on every call. Alyssa resolves these into responses automatically.

ParameterDescriptionExample
first_namePatient first name"Mike"
doctor_nameReferring doctor (without “Dr.” prefix, added automatically)"Chen"
clinic_nameClinic name"MD Well"
booking_linkScheduling URL"https://mdwell.com/book"
coach_nameAssigned coach name"Alyssa"

Follow-Up Scheduling (sales)

When a patient does not reply, your scheduler triggers follow-up calls to /chat. The API generates the content; you control the timing.

Your system triggers atWhat Alyssa generates
Day 2, 10-11 AMYounes framing, insurance mention, booking link.
Day 3-5, 5-6 PMSofter nudge.
Day 5-7, 10:30 AMFinal note. Link when ready.
After no-showReschedule offer.

If the API returns no response (TCPA trigger), stop the sequence.

Check-In Cadence (care)

Your system initiates check-ins by calling /chat. Alyssa adapts her tone based on conversation history.

Patient stateYour system should
Active (replying regularly)Send weekly check-in.
Quiet (7+ days no reply)Reduce frequency. Alyssa adjusts tone when you do send.
Silent (21+ days)Shift to monthly.

Alyssa's coaching focus evolves over a 12-week arc based on conversation depth.

WeeksFocus
1Onboarding, belief-building.
2-3Engagement cadence, learning loops.
4-6SDOH screening, preventive nudges.
7-9Progress celebrations, streaks.
10-12Reflection, re-enrollment.

Escalation Routing

When the API returns escalation.required: true, route the conversation to a human coach or clinician. Alyssa does not generate coaching content for these messages.

Opt-Out Management

When the API returns no response (patient sent STOP, unsubscribe, or scam), mark the patient as opted out in your system and stop sending.

API Reference

Base URL: https://{instance}.culturedcomputer.com/api
Authentication: Authorization: Bearer {api_key}

POST/chat

Send a patient message. Returns Alyssa's response as Server-Sent Events.

FieldTypeRequiredDescription
messagestringyesPatient's message text.
userIdstringyesUnique patient identifier. Used for session tracking.
modelstringyes"mercury"
toneNamestringyes"alyssa"
avatarNamestringno"Alyssa"
conversationHistoryarraynoPrior messages. Each: { role, content }.
templateParamsobjectnoPatient context. See Patient Context above.

Response: SSE stream. Each chunk: data: {"choices":[{"delta":{"content":"..."}}]}. Final: data: [DONE].

POST/eval-explain

Score a response against quality gates.

FieldTypeDescription
responsestringThe response text to score.
personaKeystring"alyssa"
userMessagestringThe patient message that prompted the response.

GET/model-status?model=mercury

Returns model availability and current latency.

GET/qa-latency?mode=production

Runs all test scenarios (3 care + 4 sales + 1 voice) with full quality gates.

POST/session/save

Persists a completed conversation with metadata: turns, duration, quality scores, escalation flags.

Safety

Every response is checked inline. Tier 1 failures block the response before it reaches your system.

TierRuleEnforcement
1HIPAANo diagnoses, medications, or lab values. Generic terms only (“your blood sugar,” “your blood pressure”).
1No Medical AdviceNever diagnoses, prescribes, or interprets labs. Routes to patient's doctor.
1Crisis EscalationReturns escalation.required: true. No coaching content.
1TCPAReturns no response. Your system handles opt-out.
1Identity LockCannot be overridden by patient messages or prompt injection.
1Doctor FramingAttributes program to Dr. Younes and patient's doctor.
2SMS LengthMax 3 sentences. No lists, bullets, or markdown.
2Voice LengthMax 5 sentences.
2AI Tell DetectionBlocks “I understand,” “Great question!,” “I'm sorry to hear that.”
2Forbidden TermsBlocks “free,” “$0,” “no cost,” “verify eligibility,” “Reply YES.”

Pass Rates (production, 7 SMS scenarios)

GateRate
HIPAA100%
AI Tell Detection100%
Garble Detection100%
Sentence Count86%

Performance

ChannelMetricMedianp95
SMSFirst character760ms1140ms
SMSFull response830ms1186ms
VoiceAcknowledgment832ms~1000ms
VoiceEnd-to-end1662ms~2000ms
StandardProduction
Requests/sec30100
Concurrent sessions50500
Daily tokens200KUnlimited
Retry3x exponential backoff3x exponential backoff
FailoverMercury to GeminiMercury to Gemini

32K token context window per conversation (~20 turns).

v2: State and Context Enrichment PLANNED

Everything above works today. This section describes the next iteration: richer patient context, conversation state tracking, and goal-oriented care workflows. These features use infrastructure that already exists in the platform.

Extended Patient Context

The current templateParams accepts 5 fields. v2 expands this so Alyssa can generate track-specific, condition-aware, arc-appropriate responses.

"templateParams": {
  "first_name": "Mike",
  "doctor_name": "Chen",
  "clinic_name": "MD Well",
  "booking_link": "https://mdwell.com/book",
  "coach_name": "Alyssa",

  "track": "ccm",
  "conditions": ["type_2_diabetes", "hypertension"],
  "goals": ["lower A1C", "walk 10 min/day"],
  "chosen_microhabit": "10-minute walk after dinner",
  "medications": ["Metformin", "Lisinopril"],
  "insurance_status": "covered",
  "last_visit_date": "2026-02-15"
}
ParameterDescription
track"cocm" (behavioral/mood) or "ccm" (lifestyle/chronic). Determines message category selection.
conditionsDiagnosed conditions. Alyssa uses generic terms in SMS but tailors advice to the condition.
goalsPatient's stated goals from intake. Referenced in check-ins.
chosen_microhabitThe micro-habit they picked during onboarding.
medicationsCurrent medication list. Used for reconciliation prompts. Never included in SMS text (HIPAA).
insurance_statusWhether the patient is covered. Drives “covered by your insurance” framing.
last_visit_dateDate of last doctor visit. Enables “after your last visit” references.

Conversation State

v2 adds conversationContext to each call. This lets Alyssa track engagement depth and adapt behavior without your system needing to interpret conversation content.

"conversationContext": {
  "eval": {
    "state": "ENGAGED",
    "depth": 4
  }
}
StateMeaningAlyssa's behavior
SURFACEInitial contact, shallow exchange.Gentle, low-pressure. Builds rapport.
ENGAGEDSubstantive back-and-forth.Full coaching mode. Condition-specific, actionable.
SHIFTEDInflection point. Deeper reveal.Adjusts tone. May trigger escalation flag.
RESOLVEDAction taken, natural close.Wraps up. Sets up next check-in.

Goal-Oriented Workflows

v2 adds goalId to steer Alyssa toward specific care objectives. Each goal defines success signals, failure signals, and state-specific behavior.

Goal IDWorkflowSuccess signal
sales_outreachNew patient outreach, objection handling, booking.Patient books a call.
care_checkinWeekly check-in, mood/habit/life moment.Patient replies with engagement.
medication_reconciliationConfirm med list accuracy. Monthly CCM activity.Patient confirms or updates list.
screener_phq2PHQ-2 depression screen (2 questions).Both scores captured.
screener_gad2GAD-2 anxiety screen (2 questions).Both scores captured.
sdoh_screenSingle social determinant question, rotated across domains.Patient answers.
onboardingFirst 4 messages. Belief-building, value delivery.Patient engages by message 4.

What This Enables

Capabilityv1 (current)v2
Sales objection handlingYesYes
Care check-ins (general)YesYes
Condition-specific coachingGenericTargeted (conditions in templateParams)
Track-specific behavior (CoCM/CCM)NoYes (track param + goal steering)
Medication reconciliationNoYes (medications param + goal)
Clinical screeners (PHQ-2/GAD-2)NoYes (screener goals)
SDOH screeningNoYes (sdoh_screen goal)
Structured onboardingNoYes (onboarding goal)
Arc-aware coachingInferred from historyExplicit (state + depth)
Engagement state trackingManualAutomatic (state in response metadata)

Your system remains the orchestrator: scheduling, delivery, cadence, opt-out management, clinical routing. The API becomes a richer conversational engine that understands where each patient is in their care journey.

For integration support or production deployment: contact the Cultured Computer team.