Healthcare

Prescription Refill Coordination

Proactively reach patients whose prescriptions are due for refill, verify adherence, and route requests to the pharmacy — all without a human call.

Why this matters

HIPAA-compliant voice automation for patient engagement, scheduling, and clinical workflows. This example shows you how to automate prescription refill coordination calls end-to-end with Guava's SDK — no telephony plumbing, no prompt engineering, just Python.

How to set persona & task
Working with Fields and Say items
Handling callbacks
Running the agent
Step 01

Installation

Install from Guava's private PyPI index. A public package is coming soon — the install command will simplify to pip install guava.

terminal
# Step 1: Install Guava
pip install gridspace-guava --extra-index-url https://guava-pypi.gridspace.com

# Public PyPI package coming soon — the install command will simplify to:
# pip install guava

# Step 2: Set your credentials
export GUAVA_API_KEY="..."
export GUAVA_AGENT_NUMBER="..."
Step 02

How it's built

Every Guava agent is a Python class. Walk through the key sections below, then grab the complete file at the end.

01

Imports

Import the Guava SDK and any helpers you need. guava.CallController is the base class for every voice agent.

example.py
# Install: pip install gridspace-guava --extra-index-url https://guava-pypi.gridspace.com
import guava
import os
02

Agent setup

set_persona() defines how the agent presents itself. set_task() gives it its mission in plain English. The checklist drives the conversation — Guava works through it top-to-bottom, collecting Field values and speaking Say items as it goes.

example.py
class PrescriptionRefillBot(guava.CallController):
    def __init__(self, patient_name: str, medication: str, pharmacy: str):
        super().__init__()
        self.medication = medication
        self.set_persona(
            organization_name="Riverside Family Practice",
            agent_name="Alex",
        )
        self.set_task(
            objective=f"Help {patient_name} refill their {medication} prescription",
            checklist=[
                f"Greet {patient_name} and confirm identity with date of birth.",
                guava.Field(
                    key="date_of_birth",
                    field_type="date",
                    description="Patient's date of birth for verification",
                ),
                guava.Field(
                    key="wants_refill",
                    field_type="bool",
                    description=f"Does the patient want to refill {medication}?",
                ),
                guava.Field(
                    key="having_side_effects",
                    field_type="bool",
                    description="Is the patient experiencing any side effects?",
                ),
                guava.Field(
                    key="preferred_pharmacy",
                    field_type="text",
                    description="Preferred pickup pharmacy",
                    default=pharmacy,
                ),
                "Confirm the refill request and estimated ready time.",
            ],
            on_complete=self.submit_refill,
        )

    def submit_refill(self, fields):
        if fields.get("wants_refill") and not fields.get("having_side_effects"):
            print(f"Submitting refill for {self.medication} to {fields['preferred_pharmacy']}")
        elif fields.get("having_side_effects"):
            print("Flagging for pharmacist review — side effects reported")

guava.dial(
    controller=PrescriptionRefillBot,
    controller_args={"patient_name": "Linda Torres", "medication": "Metformin 500mg",
                     "pharmacy": "CVS on Main Street"},
    to=os.environ["PATIENT_PHONE"],
    agent_number=os.environ["GUAVA_AGENT_NUMBER"],
    api_key=os.environ["GUAVA_API_KEY"],
)

Platform performance

<1s

Response time

99.99%

Uptime SLA

13+

Industries served

Step 03

Full example

The complete file — copy it, save it as example.py, and run it.

example.py
# Install: pip install gridspace-guava --extra-index-url https://guava-pypi.gridspace.com
import guava
import os

class PrescriptionRefillBot(guava.CallController):
    def __init__(self, patient_name: str, medication: str, pharmacy: str):
        super().__init__()
        self.medication = medication
        self.set_persona(
            organization_name="Riverside Family Practice",
            agent_name="Alex",
        )
        self.set_task(
            objective=f"Help {patient_name} refill their {medication} prescription",
            checklist=[
                f"Greet {patient_name} and confirm identity with date of birth.",
                guava.Field(
                    key="date_of_birth",
                    field_type="date",
                    description="Patient's date of birth for verification",
                ),
                guava.Field(
                    key="wants_refill",
                    field_type="bool",
                    description=f"Does the patient want to refill {medication}?",
                ),
                guava.Field(
                    key="having_side_effects",
                    field_type="bool",
                    description="Is the patient experiencing any side effects?",
                ),
                guava.Field(
                    key="preferred_pharmacy",
                    field_type="text",
                    description="Preferred pickup pharmacy",
                    default=pharmacy,
                ),
                "Confirm the refill request and estimated ready time.",
            ],
            on_complete=self.submit_refill,
        )

    def submit_refill(self, fields):
        if fields.get("wants_refill") and not fields.get("having_side_effects"):
            print(f"Submitting refill for {self.medication} to {fields['preferred_pharmacy']}")
        elif fields.get("having_side_effects"):
            print("Flagging for pharmacist review — side effects reported")

guava.dial(
    controller=PrescriptionRefillBot,
    controller_args={"patient_name": "Linda Torres", "medication": "Metformin 500mg",
                     "pharmacy": "CVS on Main Street"},
    to=os.environ["PATIENT_PHONE"],
    agent_number=os.environ["GUAVA_AGENT_NUMBER"],
    api_key=os.environ["GUAVA_API_KEY"],
)
Step 04

Run it

Start the agent. It will connect to Guava's infrastructure and begin accepting calls on your assigned number.

terminal
python example.py
Get Started