hangup()
call.hangup() is a soft hangup. Rather than cutting the call immediately, it hands the agent a final instruction and lets it close the conversation naturally before ending the call. Callers hear a proper goodbye.
signature
call.hangup(final_instructions: str = "")| Parameter | Type | Default | Description |
|---|---|---|---|
| final_instructions | str | — | What the agent should do before hanging up. If omitted, the agent ends the conversation naturally with no special instructions. |
Example
example.py
@agent.on_task_complete("collect_order")
def on_order_collected(call: guava.Call):
call.hangup(
final_instructions="Thank them for their time, mention the confirmation number, then hang up."
)Tip: Be specific in your final instructions. The agent will try to fulfill them naturally — including mentioning a confirmation number, scheduling next steps, or expressing appropriate warmth.
Questions? hi@goguava.ai
@agent.on_task_complete("collect_order")
def on_order_collected(call: guava.Call):
call.hangup(
final_instructions="Thank them for their time, mention the confirmation number, then hang up."
)