Emergency & Safety Notifications
Rapidly broadcast emergency notifications to affected residents, confirm receipt, and gather damage or safety status in real time.
Why this matters
Reach constituents at scale for benefits enrollment, permit follow-ups, public health outreach, and emergency notifications. This example shows you how to automate emergency & safety notifications calls end-to-end with Guava's SDK — no telephony plumbing, no prompt engineering, just Python.
Installation
Install from Guava's private PyPI index. A public package is coming soon — the install command will simplify to pip install guava.
# 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="..."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.
Imports
Import the Guava SDK and any helpers you need. guava.CallController is the base class for every voice agent.
# Install: pip install gridspace-guava --extra-index-url https://guava-pypi.gridspace.com
import guava
import osAgent 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.
class EmergencyNotificationBot(guava.CallController):
def __init__(self, emergency_type: str, affected_area: str, instructions: str, agency: str):
super().__init__()
self.set_persona(
organization_name=f"{agency} Emergency Management",
agent_name="Official Notification System",
)
self.set_task(
objective=f"Notify residents of {affected_area} about {emergency_type} and gather status",
checklist=[
f"This is an urgent automated message from {agency} Emergency Management.",
guava.Say(f"ALERT: {emergency_type} affecting {affected_area}."),
guava.Say(f"Official instructions: {instructions}"),
guava.Field(
key="message_received",
field_type="bool",
description="Press 1 or say yes to confirm you received this message.",
),
guava.Field(
key="needs_assistance",
field_type="bool",
description="Do you or anyone in your household need emergency assistance?",
),
guava.Field(
key="assistance_type",
field_type="choice",
description="What type of assistance is needed?",
required=False,
choices=["medical", "evacuation help", "shelter", "welfare check on elderly", "other"],
),
"Provide emergency hotline number and advise to call 911 for immediate threats.",
],
on_complete=lambda fields: print(f"Emergency notification delivered — needs_assistance: {fields.get('needs_assistance')}"),
)
# Broadcast to all affected residents
for phone in os.environ.get("AFFECTED_PHONES", "").split(","):
guava.dial(
controller=EmergencyNotificationBot,
controller_args={"emergency_type": "mandatory evacuation order",
"affected_area": "Zone A coastal areas",
"instructions": "Evacuate immediately via Highway 1 north. Do not return until lifted.",
"agency": "County"},
to=phone.strip(),
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
Full example
The complete file — copy it, save it as example.py, and run it.
# Install: pip install gridspace-guava --extra-index-url https://guava-pypi.gridspace.com
import guava
import os
class EmergencyNotificationBot(guava.CallController):
def __init__(self, emergency_type: str, affected_area: str, instructions: str, agency: str):
super().__init__()
self.set_persona(
organization_name=f"{agency} Emergency Management",
agent_name="Official Notification System",
)
self.set_task(
objective=f"Notify residents of {affected_area} about {emergency_type} and gather status",
checklist=[
f"This is an urgent automated message from {agency} Emergency Management.",
guava.Say(f"ALERT: {emergency_type} affecting {affected_area}."),
guava.Say(f"Official instructions: {instructions}"),
guava.Field(
key="message_received",
field_type="bool",
description="Press 1 or say yes to confirm you received this message.",
),
guava.Field(
key="needs_assistance",
field_type="bool",
description="Do you or anyone in your household need emergency assistance?",
),
guava.Field(
key="assistance_type",
field_type="choice",
description="What type of assistance is needed?",
required=False,
choices=["medical", "evacuation help", "shelter", "welfare check on elderly", "other"],
),
"Provide emergency hotline number and advise to call 911 for immediate threats.",
],
on_complete=lambda fields: print(f"Emergency notification delivered — needs_assistance: {fields.get('needs_assistance')}"),
)
# Broadcast to all affected residents
for phone in os.environ.get("AFFECTED_PHONES", "").split(","):
guava.dial(
controller=EmergencyNotificationBot,
controller_args={"emergency_type": "mandatory evacuation order",
"affected_area": "Zone A coastal areas",
"instructions": "Evacuate immediately via Highway 1 north. Do not return until lifted.",
"agency": "County"},
to=phone.strip(),
agent_number=os.environ["GUAVA_AGENT_NUMBER"],
api_key=os.environ["GUAVA_API_KEY"],
)Run it
Start the agent. It will connect to Guava's infrastructure and begin accepting calls on your assigned number.
python example.py