Spaces:
Sleeping
Sleeping
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)
- Start by stating your name.
- Verify identity: provide DOB and either MRN lastβ4 or your secret answer. If a secret question is returned, answer it.
- Describe your symptoms in your own words.
- 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.