Utilities & Energy

Service Connection Scheduling

Coordinate new service connection appointments for move-ins, ensuring technicians arrive at the right time and all required steps are completed.

Why this matters

Keep customers informed and engaged with automated outage updates, smart meter enrollment, conservation alerts, and satisfaction surveys. This example shows you how to automate service connection scheduling 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 ServiceConnectionBot(guava.CallController):
    def __init__(self, customer_name: str, service_address: str, service_type: str,
                 requested_date: str):
        super().__init__()
        self.set_persona(
            organization_name="Metro Power & Light New Services",
            agent_name="Dana",
        )
        self.set_task(
            objective=f"Schedule {service_type} connection at {service_address} for {customer_name}",
            checklist=[
                f"Greet {customer_name} and confirm new service connection request at {service_address}.",
                guava.Field(
                    key="connection_date",
                    field_type="calendar_slot",
                    description=f"Confirm or adjust connection date (originally requested: {requested_date})",
                    choice_generator=lambda: ["Mon 8am-12pm", "Mon 1pm-5pm", "Wed 8am-12pm",
                                              "Thu 8am-12pm", "Fri 8am-12pm"],
                ),
                guava.Field(
                    key="access_confirmed",
                    field_type="bool",
                    description="Will someone 18+ be present at the property during the appointment?",
                ),
                guava.Field(
                    key="meter_location_clear",
                    field_type="bool",
                    description="Is the meter box accessible and clear of obstructions?",
                ),
                guava.Field(
                    key="electrical_inspection_complete",
                    field_type="bool",
                    description="Has the electrical inspection been completed and approved? (required for new construction)",
                ),
                guava.Field(
                    key="contact_day_of",
                    field_type="phone",
                    description="Best number for the technician to call day-of",
                ),
                "Confirm appointment and advise the technician will call 30 minutes before arrival.",
            ],
            on_complete=lambda fields: print(f"Connection scheduled: {service_address} on {fields.get('connection_date')}"),
        )

guava.dial(
    controller=ServiceConnectionBot,
    controller_args={"customer_name": "The Okafor Family", "service_address": "1204 Birchwood Lane",
                     "service_type": "electric", "requested_date": "Monday"},
    to=os.environ["CUSTOMER_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 ServiceConnectionBot(guava.CallController):
    def __init__(self, customer_name: str, service_address: str, service_type: str,
                 requested_date: str):
        super().__init__()
        self.set_persona(
            organization_name="Metro Power & Light New Services",
            agent_name="Dana",
        )
        self.set_task(
            objective=f"Schedule {service_type} connection at {service_address} for {customer_name}",
            checklist=[
                f"Greet {customer_name} and confirm new service connection request at {service_address}.",
                guava.Field(
                    key="connection_date",
                    field_type="calendar_slot",
                    description=f"Confirm or adjust connection date (originally requested: {requested_date})",
                    choice_generator=lambda: ["Mon 8am-12pm", "Mon 1pm-5pm", "Wed 8am-12pm",
                                              "Thu 8am-12pm", "Fri 8am-12pm"],
                ),
                guava.Field(
                    key="access_confirmed",
                    field_type="bool",
                    description="Will someone 18+ be present at the property during the appointment?",
                ),
                guava.Field(
                    key="meter_location_clear",
                    field_type="bool",
                    description="Is the meter box accessible and clear of obstructions?",
                ),
                guava.Field(
                    key="electrical_inspection_complete",
                    field_type="bool",
                    description="Has the electrical inspection been completed and approved? (required for new construction)",
                ),
                guava.Field(
                    key="contact_day_of",
                    field_type="phone",
                    description="Best number for the technician to call day-of",
                ),
                "Confirm appointment and advise the technician will call 30 minutes before arrival.",
            ],
            on_complete=lambda fields: print(f"Connection scheduled: {service_address} on {fields.get('connection_date')}"),
        )

guava.dial(
    controller=ServiceConnectionBot,
    controller_args={"customer_name": "The Okafor Family", "service_address": "1204 Birchwood Lane",
                     "service_type": "electric", "requested_date": "Monday"},
    to=os.environ["CUSTOMER_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