Flight/Itinerary Disruption Handling
Proactively reach affected travelers when their flight or itinerary is disrupted, present rebooking options, and confirm new arrangements before they reach the airport.
Why this matters
Deliver white-glove guest experiences at scale with automated reservation management, upsells, and disruption handling. This example shows you how to automate flight/itinerary disruption handling 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 DisruptionHandlingBot(guava.CallController):
def __init__(self, traveler_name: str, original_flight: str, disruption_type: str,
alternative_options: list[str]):
super().__init__()
self.set_persona(
organization_name="Meridian Airlines",
agent_name="Avery",
)
self.set_task(
objective=f"Handle {disruption_type} for {traveler_name} on flight {original_flight}",
checklist=[
f"Reach {traveler_name} urgently about a {disruption_type} affecting flight {original_flight}.",
guava.Say(f"Available alternatives: {'; '.join(alternative_options)}."),
guava.Field(
key="chosen_alternative",
field_type="choice",
description="Which alternative does the traveler prefer?",
choices=alternative_options + ["full refund", "travel voucher"],
),
guava.Field(
key="meal_voucher_needed",
field_type="bool",
description="Does the traveler need a meal voucher for the delay?",
),
guava.Field(
key="hotel_needed",
field_type="bool",
description="Does the traveler need overnight hotel accommodation?",
),
guava.Field(
key="updated_contact",
field_type="phone",
description="Best number for further updates during travel",
),
"Confirm new itinerary, send updated boarding pass, and provide gate information.",
],
on_complete=lambda fields: print(f"Disruption resolved for {traveler_name}: {fields.get('chosen_alternative')}"),
)
guava.dial(
controller=DisruptionHandlingBot,
controller_args={
"traveler_name": "Dr. Alan Cho",
"original_flight": "MR 447 JFK→LAX 6:30pm",
"disruption_type": "3-hour delay due to mechanical issue",
"alternative_options": ["MR 449 at 9:45pm", "MR 201 via Chicago arriving 11pm", "next morning MR 101 at 7am"],
},
to=os.environ["TRAVELER_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
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 DisruptionHandlingBot(guava.CallController):
def __init__(self, traveler_name: str, original_flight: str, disruption_type: str,
alternative_options: list[str]):
super().__init__()
self.set_persona(
organization_name="Meridian Airlines",
agent_name="Avery",
)
self.set_task(
objective=f"Handle {disruption_type} for {traveler_name} on flight {original_flight}",
checklist=[
f"Reach {traveler_name} urgently about a {disruption_type} affecting flight {original_flight}.",
guava.Say(f"Available alternatives: {'; '.join(alternative_options)}."),
guava.Field(
key="chosen_alternative",
field_type="choice",
description="Which alternative does the traveler prefer?",
choices=alternative_options + ["full refund", "travel voucher"],
),
guava.Field(
key="meal_voucher_needed",
field_type="bool",
description="Does the traveler need a meal voucher for the delay?",
),
guava.Field(
key="hotel_needed",
field_type="bool",
description="Does the traveler need overnight hotel accommodation?",
),
guava.Field(
key="updated_contact",
field_type="phone",
description="Best number for further updates during travel",
),
"Confirm new itinerary, send updated boarding pass, and provide gate information.",
],
on_complete=lambda fields: print(f"Disruption resolved for {traveler_name}: {fields.get('chosen_alternative')}"),
)
guava.dial(
controller=DisruptionHandlingBot,
controller_args={
"traveler_name": "Dr. Alan Cho",
"original_flight": "MR 447 JFK→LAX 6:30pm",
"disruption_type": "3-hour delay due to mechanical issue",
"alternative_options": ["MR 449 at 9:45pm", "MR 201 via Chicago arriving 11pm", "next morning MR 101 at 7am"],
},
to=os.environ["TRAVELER_PHONE"],
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