Skip to content

Commit 144c712

Browse files
committed
feat: add warm transfer agent with tool, structured output and demo recordings
1 parent 2971bdf commit 144c712

9 files changed

Lines changed: 497 additions & 0 deletions

File tree

Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
# VAPI Stack - Warm Transfer Agent
2+
3+
[![Install](https://vapi.ai/button.svg)](https://vapi.ai/install?agent=warm_transfer_agent)
4+
5+
## Overview
6+
7+
This agent demonstrates VAPI's **warm transfer** capabilities by acting as an intelligent call routing assistant for VAPI Stack. The assistant, **Alex**, triages inbound calls, determines intent (Support vs. Billing), collects issue summaries, and performs warm transfers to the appropriate team with context. If no agent is available, it creates support tickets with verified customer information.
8+
9+
## Purpose
10+
11+
The agent showcases:
12+
- **Call routing and triage**: Intelligent intent identification (Support vs. Billing)
13+
- **Warm transfer**: Context-aware transfers with issue summaries passed to human operators
14+
- **Transfer assistant**: AI-powered intermediary that speaks to operators before connecting customers
15+
- **Ticket creation**: Fallback when transfers fail or agents unavailable
16+
- **Structured data extraction**: Automatic capture of call details and customer information
17+
18+
## System Architecture
19+
20+
```
21+
Caller → VAPI AI (Alex) → Intent Identification → Issue Summary → Warm Transfer Attempt →
22+
├─ Success → Transfer to Human Agent (with context)
23+
└─ Failure → Ticket Collection → Structured Data Capture → Close
24+
```
25+
26+
27+
## Tools
28+
29+
### 1. `transfer_call_tool`
30+
31+
**Type**: Transfer call tool
32+
**Purpose**: Performs warm transfers to Support or Billing teams
33+
34+
**Configuration**:
35+
- **Mode**: `warm-transfer-experimental`
36+
- **SIP Verb**: `refer`
37+
- **Two Destinations**:
38+
- **Billing**: `+15555555555` (when `<billing_issue_summary>`) < change to your number >
39+
- **Support**: `+15555555555` (when `<support_issue_summary>`) < change to your number >
40+
41+
**Transfer Assistant**:
42+
- **Model**: GPT-4o
43+
- **Role**: Speaks ONLY to the operator (never the customer)
44+
- **Function**: Summarizes customer concern and confirms operator availability
45+
- **Max Duration**: 120 seconds
46+
- **Silence Timeout**: 30 seconds
47+
48+
**Transfer Flow**:
49+
1. Transfer assistant contacts operator
50+
2. Provides summary: *"Hi! I have a customer on the other line having issues with uh <issue_summary>. Would you be able to help us with this?"*
51+
3. Waits for operator response
52+
4. If operator accepts → Completes transfer using `transferSuccessful` tool
53+
5. If operator declines → Cancels transfer using `transferCancel` tool
54+
55+
**Fallback Plan**:
56+
- **Billing**: *"Unfortunately, there's no one available from our billing team right now. I can create a ticket so someone can follow up with you shortly."*
57+
- **Support**: *"Unfortunately, there's no one available from our support team right now. I can create a ticket so someone can follow up with you shortly."*
58+
59+
**Audio**: Plays soothing sound (`https://desert-horse-9859.twil.io/assets/soothing-sound.mp3`) during transfer
60+
61+
### 2. `end_call_tool`
62+
63+
**Type**: End call tool
64+
**Purpose**: Terminates the conversation when appropriate
65+
66+
**Usage**:
67+
- After successful warm transfer
68+
- After ticket collection and confirmation
69+
- After closing message
70+
71+
## Structured Data Extraction
72+
73+
The agent automatically extracts structured data from conversations using the **VAPI Stack** structured output.
74+
75+
### Schema
76+
77+
**Required Fields**:
78+
- `issue_type` (string) - Type of issue given by customer (support or billing)
79+
- `customer_name` (string) - Full name of the customer
80+
- `issue_summary` (string) - Summary of the issue mentioned by customer
81+
- `customer_email_raw` (string) - Raw spoken email of the customer
82+
- `customer_email_confirmed` (string) - Spelled out email of the customer
83+
- `customer_email_polished` (string) - Polished written email (e.g., "jonas@vapi.ai")
84+
85+
**Extraction Method**: Uses AI-powered structured output that analyzes the call transcript to automatically extract all required fields. The structured output is configured in `structured_outputs/VAPIStack_outputs.json` and referenced via `artifactPlan.structuredOutputIds`.
86+
87+
## Conversation Examples
88+
89+
### Example 1: Support Issue (Successful Warm Transfer)
90+
91+
**Alex**: "Hi, you've reached VAPI Stack. This is Alex, um, How may I help you?"
92+
93+
**Customer**: "Hi, I'm having trouble accessing my dashboard."
94+
95+
~log `<issue_type>` = support
96+
97+
**Alex**: "Got it. Could you briefly explain what's going on? I'll try to pop you through to uh someone who can help."
98+
99+
**Customer**: "Every time I log in, it just keeps loading and never finishes."
100+
101+
~log `<support_issue_summary>`
102+
103+
**Alex**: "Got it! I will now be transferring you over to the appropriate department."
104+
105+
*(Transfer assistant contacts support operator)*
106+
107+
**Transfer Assistant**: "Hi! I have a customer on the other line having issues with uh every time I log in, it just keeps loading and never finishes. Would you be able to help us with this?"
108+
109+
**Operator**: "Yes, I can help."
110+
111+
**Transfer Assistant**: "Great! I will now be connecting you with the customer."
112+
113+
*(Transfer completes)*
114+
115+
---
116+
117+
### Example 2: Billing Issue (Successful Warm Transfer)
118+
119+
**Alex**: "Hi, you've reached VAPI Stack. This is Alex, um, How may I help you?"
120+
121+
**Customer**: "Hi, can you help me with my invoice issue."
122+
123+
~log `<issue_type>` = billing
124+
125+
**Alex**: "Got it. Could you briefly explain what's going on? I'll try to pop you through to uh someone who can help."
126+
127+
**Customer**: "I see two identical charges on my statement."
128+
129+
~log `<billing_issue_summary>`
130+
131+
**Alex**: "Got it! I will now be transferring you over to the appropriate department."
132+
133+
*(Transfer assistant contacts billing operator)*
134+
135+
**Transfer Assistant**: "Hi! I have a customer on the other line having issues with uh I see two identical charges on my statement. Would you be able to help us with this?"
136+
137+
**Operator**: "Sure, I can help."
138+
139+
**Transfer Assistant**: "Great! I will now be connecting you with the customer."
140+
141+
*(Transfer completes)*
142+
143+
---
144+
145+
### Example 3: Unclear Issue → Clarified as Support
146+
147+
**Alex**: "Hi, you've reached VAPI Stack. This is Alex, um, How may I help you?"
148+
149+
**Customer**: "Uh, I'm not really sure, something isn't working right."
150+
151+
**Alex**: "No problem — uh would you say this is more of a support issue or a billing question?"
152+
153+
**Customer**: "It's a support issue."
154+
155+
~log `<issue_type>` = support
156+
157+
**Alex**: "Got it. Could you briefly explain what's going on? I'll try to pop you through to uh someone who can help."
158+
159+
**Customer**: "Our webhook stopped firing after yesterday."
160+
161+
~log `<support_issue_summary>`
162+
163+
*(Proceeds with transfer)*
164+
165+
---
166+
167+
### Example 4: Support Issue → Transfer Fails → Ticket Created
168+
169+
**Alex**: "Hi, you've reached VAPI Stack. This is Alex, um, How may I help you?"
170+
171+
**Customer**: "Hi, our API requests are failing."
172+
173+
~log `<issue_type>` = support
174+
175+
**Alex**: "Got it. Could you briefly explain what's going on? I'll try to pop you through to uh someone who can help."
176+
177+
**Customer**: "We keep getting 500 errors."
178+
179+
~log `<support_issue_summary>`
180+
181+
**Alex**: "Got it! I will now be transferring you over to the appropriate department."
182+
183+
*(Transfer attempt - no agent available)*
184+
185+
**Alex**: "Unfortunately, there's no one available from our support team right now. I can create a ticket so someone can follow up with you shortly."
186+
187+
**Alex**: "Great! may I have your full name, please?"
188+
189+
**Customer**: "Jordan Reyes."
190+
191+
~log `<customer_name>`
192+
193+
**Alex**: "And uh what's the best email address for updates on this?"
194+
195+
**Customer**: "jordan.reyes@acmeco.io"
196+
197+
~log `<customer_email_raw>`
198+
199+
**Alex**: "Just to make sure I've got it right, could you uh spell out that email for me?"
200+
201+
**Customer**: "J-O-R-D-A-N dot R-E-Y-E-S at A-C-M-E-C-O dot I-O."
202+
203+
~log `<customer_email_confirmed>`, `<customer_email_polished>`
204+
205+
**Alex**: "Perfect. I've logged your ticket report under Jordan Reyes. Our team will follow up with you by email. Is there anything else I can assist you with?"
206+
207+
**Customer**: "No, that's all."
208+
209+
~log `<ticket_created>`
210+
211+
**Alex**: "Thanks for your time today. We appreciate you reaching out, and uh someone will be in touch soon. Have a great rest of your day!"
212+
213+
*(Call ends)*
214+
215+
216+
### Transfer Destinations
217+
218+
Both destinations use the same phone number (`+15555555555`) but are differentiated by:
219+
- **Description**: "Use this destination when the customer has a billing-related issue" vs. "Use this destination when the customer has a support-related issue"
220+
- **Transfer Assistant Prompt**: Different prompts for billing vs. support contexts
221+
222+
## Configuration Files
223+
224+
- `assistant.json`: Main agent configuration with system prompt
225+
- `tools/transfer_call_tool.json`: Warm transfer tool with two destinations
226+
- `tools/end_call_tool.json`: Call termination tool
227+
- `structured_outputs/VAPIStack_outputs.json`: Structured output schema for automatic data extraction
228+
229+
## Important Notes
230+
231+
- The agent acts as a **triage and routing assistant**, not a problem solver
232+
- Warm transfers include **context** (issue summary) passed to operators
233+
- Transfer assistant speaks **only to operators**, never customers
234+
- Email verification includes **spelling confirmation** to ensure accuracy
235+
- Structured data extraction captures all conversation details automatically
236+
- Background denoising is enabled for better audio quality
237+
- Key terms in transcription help improve intent classification accuracy
238+
- Transfer attempts have fallback plans when agents are unavailable
239+
- All ticket information is captured as structured data for follow-up
240+
241+
## Use Cases
242+
243+
This agent is ideal for demonstrating:
244+
245+
1. **Call Routing**: Intelligent triage of Support vs. Billing issues
246+
2. **Warm Transfers**: Context-aware transfers with issue summaries
247+
3. **Transfer Assistant**: AI-powered intermediary for operator communication
248+
4. **Ticket Creation**: Fallback when transfers fail
249+
5. **Structured Data Capture**: Automatic extraction of call details and customer information
250+
6. **Email Verification**: Spelling confirmation for accurate email capture
251+

0 commit comments

Comments
 (0)