Utilities & Energy

High-Usage Alerts & Conservation

Alert customers when usage is tracking significantly above their typical pattern, provide conservation tips, and offer a free energy audit to prevent bill shock.

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 high-usage alerts & conservation 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 HighUsageAlertBot(guava.CallController):
    def __init__(self, account_name: str, current_usage_kwh: float, typical_usage_kwh: float,
                 projected_bill: float, billing_period_end: str):
        super().__init__()
        pct_over = int((current_usage_kwh / typical_usage_kwh - 1) * 100)
        self.set_persona(
            organization_name="Metro Power & Light",
            agent_name="Jordan",
        )
        self.set_task(
            objective=f"Alert {account_name} of {pct_over}% above-average usage and offer conservation help",
            checklist=[
                f"Greet {account_name} with a friendly heads-up about their energy usage this month.",
                guava.Say(f"Current usage: {current_usage_kwh:.0f} kWh — {pct_over}% above typical. Projected bill: ${projected_bill:.2f} by {billing_period_end}."),
                guava.Field(
                    key="aware_of_increased_usage",
                    field_type="bool",
                    description="Is the customer aware of what might be causing increased usage?",
                ),
                guava.Field(
                    key="usage_reason",
                    field_type="choice",
                    description="Known reason for increased usage",
                    choices=["guests visiting", "new appliance", "HVAC issue suspected",
                             "pool/spa heating", "no idea"],
                    required=False,
                ),
                guava.Field(
                    key="wants_free_audit",
                    field_type="bool",
                    description="Interested in a free energy efficiency audit?",
                ),
                guava.Field(
                    key="wants_usage_alerts",
                    field_type="bool",
                    description="Want to enroll in daily usage text alerts?",
                ),
                "Provide tips for the top energy users (HVAC, water heater, EV charging) and audit scheduling link.",
            ],
            on_complete=lambda fields: print(f"High usage alert delivered: {account_name}"),
        )

guava.dial(
    controller=HighUsageAlertBot,
    controller_args={"account_name": "The Hartwell Family", "current_usage_kwh": 1847,
                     "typical_usage_kwh": 1100, "projected_bill": 312.00,
                     "billing_period_end": "the 28th"},
    to=os.environ["ACCOUNT_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 HighUsageAlertBot(guava.CallController):
    def __init__(self, account_name: str, current_usage_kwh: float, typical_usage_kwh: float,
                 projected_bill: float, billing_period_end: str):
        super().__init__()
        pct_over = int((current_usage_kwh / typical_usage_kwh - 1) * 100)
        self.set_persona(
            organization_name="Metro Power & Light",
            agent_name="Jordan",
        )
        self.set_task(
            objective=f"Alert {account_name} of {pct_over}% above-average usage and offer conservation help",
            checklist=[
                f"Greet {account_name} with a friendly heads-up about their energy usage this month.",
                guava.Say(f"Current usage: {current_usage_kwh:.0f} kWh — {pct_over}% above typical. Projected bill: ${projected_bill:.2f} by {billing_period_end}."),
                guava.Field(
                    key="aware_of_increased_usage",
                    field_type="bool",
                    description="Is the customer aware of what might be causing increased usage?",
                ),
                guava.Field(
                    key="usage_reason",
                    field_type="choice",
                    description="Known reason for increased usage",
                    choices=["guests visiting", "new appliance", "HVAC issue suspected",
                             "pool/spa heating", "no idea"],
                    required=False,
                ),
                guava.Field(
                    key="wants_free_audit",
                    field_type="bool",
                    description="Interested in a free energy efficiency audit?",
                ),
                guava.Field(
                    key="wants_usage_alerts",
                    field_type="bool",
                    description="Want to enroll in daily usage text alerts?",
                ),
                "Provide tips for the top energy users (HVAC, water heater, EV charging) and audit scheduling link.",
            ],
            on_complete=lambda fields: print(f"High usage alert delivered: {account_name}"),
        )

guava.dial(
    controller=HighUsageAlertBot,
    controller_args={"account_name": "The Hartwell Family", "current_usage_kwh": 1847,
                     "typical_usage_kwh": 1100, "projected_bill": 312.00,
                     "billing_period_end": "the 28th"},
    to=os.environ["ACCOUNT_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