@@ -65,6 +65,9 @@ echo "VAPI_TOKEN=your-token-here" > .env.dev
6565| ` npm run pull:prod ` | Pull resources from prod |
6666| ` npm run apply:dev ` | Push local YAML files to Vapi (dev) |
6767| ` npm run apply:prod ` | Push local YAML files to Vapi (prod) |
68+ | ` npm run call:dev -- -a <name> ` | Start a WebSocket call to an assistant (dev) |
69+ | ` npm run call:dev -- -s <name> ` | Start a WebSocket call to a squad (dev) |
70+ | ` npm run call:prod -- -a <name> ` | Start a WebSocket call to an assistant (prod) |
6871
6972### Basic Workflow
7073
@@ -82,6 +85,111 @@ npm run apply:dev
8285
8386## How-To Guides
8487
88+ ### How to Make a WebSocket Call to an Assistant or Squad
89+
90+ Test your assistants and squads directly from the terminal using real-time voice calls.
91+
92+ ** Prerequisites (Optional but recommended for audio):**
93+
94+ ``` bash
95+ # For microphone input and audio playback
96+ npm install mic speaker
97+
98+ # macOS may require additional setup:
99+ brew install sox
100+ ```
101+
102+ > ** Note:** The call script works without these dependencies but will only show transcripts (no audio I/O).
103+
104+ ** Step 1:** Ensure your assistant/squad is deployed
105+
106+ ``` bash
107+ npm run apply:dev
108+ ```
109+
110+ ** Step 2:** Start the call
111+
112+ ``` bash
113+ # Call an assistant
114+ bun run call:dev -a my-assistant
115+
116+ # Call a nested assistant (in subdirectory)
117+ bun run call:dev -a company-1/inbound-support
118+
119+ # Call a squad
120+ bun run call:dev -s my-squad
121+
122+ # Call in production
123+ bun run call:prod -a my-assistant
124+ ```
125+
126+ ** CLI Options:**
127+
128+ | Flag | Description |
129+ | ------| -------------|
130+ | ` -a <name> ` | Call an assistant by name |
131+ | ` -s <name> ` | Call a squad by name |
132+
133+ ** Step 3:** Grant microphone permissions
134+
135+ On first run, the script will check for microphone permissions:
136+ - ** macOS** : You may see a system permission prompt. Grant access in System Preferences > Security & Privacy > Privacy > Microphone
137+ - ** Linux** : Ensure ALSA is configured and your user has access to audio devices
138+ - ** Windows** : You may be prompted to grant microphone access
139+
140+ ** Step 4:** Speak into your microphone
141+
142+ The terminal will show:
143+ - 🎤 Your speech transcripts
144+ - 🤖 Assistant responses
145+ - 📞 Call status updates
146+
147+ ** Step 5:** End the call
148+
149+ Press ` Ctrl+C ` to gracefully end the call.
150+
151+ ** Example output:**
152+
153+ ```
154+ 🚀 Starting WebSocket call
155+ Environment: dev
156+ assistant: my-assistant
157+
158+ 🎤 Checking microphone permissions...
159+ ✅ Microphone permission granted
160+
161+ UUID: 88d807a0-854a-4a95-960f-6b69921ff877
162+
163+ 📞 Creating call...
164+ 📞 Call ID: abc123-def456
165+ 🔌 Connecting to WebSocket...
166+ ✅ Connected!
167+ 🎤 Speak into your microphone...
168+ Press Ctrl+C to end the call
169+
170+ 💬 Assistant started speaking...
171+ 🤖 Assistant: Hi there, this is Alex from TechSolutions customer support. How can I help you today?
172+ 🎤 You: I need help with my account
173+ 🤖 Assistant: I'd be happy to help you with your account. Could you tell me a bit more about what's happening?
174+
175+ ^C
176+ 👋 Ending call...
177+ 📴 Call ended (code: 1000)
178+ ```
179+
180+ ** Troubleshooting:**
181+
182+ | Issue | Solution |
183+ | -------| ----------|
184+ | ` Assistant not found ` | Run ` npm run apply:dev ` first to deploy |
185+ | ` Squad not found ` | Ensure squads are added to the state file |
186+ | ` mic module not installed ` | Run ` npm install mic ` |
187+ | ` speaker module not installed ` | Run ` npm install speaker ` |
188+ | No audio on macOS | Install sox: ` brew install sox ` |
189+ | Microphone permission denied | Check system privacy settings |
190+
191+ ---
192+
85193### How to Add a New Tool
86194
87195** Step 1:** Create a new YAML file in ` resources/tools/ `
@@ -460,6 +568,7 @@ vapi-gitops/
460568├── src/
461569│ ├── apply.ts # Apply entry point & functions
462570│ ├── pull.ts # Pull entry point & functions
571+ │ ├── call.ts # WebSocket call script
463572│ ├── types.ts # TypeScript interfaces
464573│ ├── config.ts # Environment & configuration
465574│ ├── api.ts # Vapi HTTP client
0 commit comments