fciannella's picture
Added the healthcare example
2f49513

Healthcare Telehealth Nurse Agent

This agent is a 24/7 AI voice nurse for existing patients. It authenticates callers, retrieves mock patient profiles (medications, allergies, recent visits), recognizes common symptoms, performs contextual triage using decision rules, offers self‑care guidance, escalates urgent cases, and books appointments. All interactions aim to be clear, compassionate, and brief.

✨ Recent Improvements: Tool docstrings and system prompts have been significantly enhanced with:

  • Clear step-by-step instructions for each tool
  • Explicit guidance on the secret question authentication flow
  • Detailed examples showing expected inputs/outputs
  • Better error handling instructions
  • Improved conversation flow structure

What it does

  • Authenticate the caller (name + DOB + MRN last‑4 or secret answer)
  • Look up patient profile, allergies, medications, recent visits, preferred pharmacy
  • Recognize symptoms (e.g., "I have a headache") and identify red flags
  • Risk stratify and triage (self‑care, soon, urgent) using rules in mock_data/triage_rules.json
  • Provide tailored advice based on symptoms and medication history
  • Escalate urgent cases with clear instructions
  • Offer scheduling with available providers from mock_data/providers.json
  • Confirm preferred pharmacy for prescriptions if needed

How to use (typical flow)

  1. Start by stating your name.
  2. Verify identity: provide DOB and either MRN last‑4 or your secret answer. If a secret question is returned, answer it.
  3. Describe your symptoms in your own words.
  4. The agent will ask brief, focused follow‑ups (one question at a time), provide guidance, and book if needed.

Tool Call Flow Diagram

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  1. GREETING & NAME                                         β”‚
β”‚     User: "My name is John Marshall"                        β”‚
β”‚     β†’ find_patient(full_name="John Marshall")               β”‚
β”‚     ← {patient_id: "pt_jmarshall"}                          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  2. IDENTITY VERIFICATION (CRITICAL)                        β”‚
β”‚     Agent: "Please confirm your date of birth"              β”‚
β”‚     User: "January 1st, 1960"                               β”‚
β”‚     β†’ verify_identity(dob="January 1st, 1960")              β”‚
β”‚     ← {verified: false, question: "What is your favorite    β”‚
β”‚        color?", needs: ["mrn_last4_or_secret"]}             β”‚
β”‚                                                              β”‚
β”‚     Agent: "For security, what is your favorite color?"     β”‚
β”‚     User: "Blue"                                            β”‚
β”‚     β†’ verify_identity(dob="...", secret_answer="Blue")      β”‚
β”‚     ← {verified: true, needs: []}                           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  3. PROFILE RETRIEVAL                                       β”‚
β”‚     β†’ get_patient_profile_tool()                            β”‚
β”‚     ← {allergies: ["Penicillin"],                           β”‚
β”‚        medications: [{name: "Acetaminophen", ...}], ...}    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  4. SYMPTOM COLLECTION & TRIAGE                             β”‚
β”‚     Agent: "What brings you in today?"                      β”‚
β”‚     User: "I have a headache and feel tired"                β”‚
β”‚     β†’ triage_symptoms_tool(symptoms_text="headache and      β”‚
β”‚        fatigue, no red flags")                              β”‚
β”‚     ← {risk: "self_care", advice: "Try rest...",            β”‚
β”‚        red_flags: []}                                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  5. APPOINTMENT BOOKING (if needed)                         β”‚
β”‚     β†’ list_providers_tool()                                 β”‚
β”‚     ← [{provider_id: "prov_smith_md", ...}]                 β”‚
β”‚                                                              β”‚
β”‚     β†’ get_provider_slots_tool(provider_id="prov_smith_md")  β”‚
β”‚     ← ["2025-10-09T08:30:00", "2025-10-09T16:00:00"]        β”‚
β”‚                                                              β”‚
β”‚     Agent: "Tomorrow at 8:30am or 4pm. Which works?"        β”‚
β”‚     User: "8:30am"                                          β”‚
β”‚     β†’ schedule_appointment_tool(slot_iso="2025-10-09T08:30")β”‚
β”‚     ← {appointment_id: "A-abc123", status: "booked"}        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  6. PHARMACY CONFIRMATION                                   β”‚
β”‚     β†’ get_preferred_pharmacy_tool()                         β”‚
β”‚     ← {name: "CVS", address: "1010 El Camino Real..."}      β”‚
β”‚     Agent: "Keep pharmacy at 1010 El Camino Real?"          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  7. CALL LOGGING & CLOSING                                  β”‚
β”‚     β†’ log_call_tool(notes="...", triage_json="...")         β”‚
β”‚     ← {logged: true, log_id: "L-xyz789"}                    β”‚
β”‚     Agent: "If symptoms worsen, seek urgent care. Take care"β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Points:

  • Step 2 is the most critical: The secret question requires a TWO-call pattern
  • Always retrieve profile (Step 3) before giving medical advice
  • Triage (Step 4) determines whether to proceed with booking or direct to ER
  • Logging (Step 7) documents the entire encounter

Example conversation

  • Agent: Welcome back to our clinic. I’m your nurse assistant. May I have your full name?
  • You: John Marshall.
  • Agent: Thanks, John. Please confirm your date of birth and either your MRN last‑4 or answer to your secret question.
  • You: January 1st, 1960. MRN last‑4 is 0001.
  • Agent: Thank you. You’re verified. What’s going on today?
  • You: I have a headache and feel really fatigued.
  • Agent: I’m sorry you’re feeling that way. Any red flag symptoms like worst headache of your life, head injury, stiff neck, weakness, vision changes, seizure, or fever over 102Β°F?
  • You: No, none of those.
  • Agent: Thanks for checking. You’re on acetaminophen as needed and have a penicillin allergy. Since symptoms are mild with no red flags, try hydration, rest, and acetaminophen as directed. Would you like a telehealth appointment in the next day or two?
  • You: Yes, please.
  • Agent: I can book with Alex Chang, NP. Next openings are today at 8:00 pm, or tomorrow at 8:30 am or 4:00 pm. Which do you prefer?
  • You: Tomorrow at 8:30 am.
  • Agent: Booked. I’ll send details to your phone ending in 0101. Should we keep the pharmacy at 1010 El Camino Real, Santa Clara for any prescriptions?
  • You: Yes, that’s fine.
  • Agent: Great. I’ve logged your symptoms, advice provided, and appointment. If anything worsensβ€”especially fever over 102Β°F, neck stiffness, confusion, weakness, vision loss, or severe headacheβ€”seek urgent care or call emergency services.

Mock data

  • Patients: mock_data/patients.json
  • Providers: mock_data/providers.json
  • Pharmacies: mock_data/pharmacies.json
  • Triage rules: mock_data/triage_rules.json

Notes

  • The agent prioritizes empathy and brevity. It asks one question at a time and avoids medical jargon.
  • All data are mock fixtures for demo purposes only and are not real medical records.