convoai 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +862 -0
  3. package/bin/convoai.ts +3 -0
  4. package/dist/bin/convoai.d.ts +2 -0
  5. package/dist/bin/convoai.js +4 -0
  6. package/dist/bin/convoai.js.map +1 -0
  7. package/dist/src/api/agents.d.ts +24 -0
  8. package/dist/src/api/agents.js +51 -0
  9. package/dist/src/api/agents.js.map +1 -0
  10. package/dist/src/api/calls.d.ts +53 -0
  11. package/dist/src/api/calls.js +22 -0
  12. package/dist/src/api/calls.js.map +1 -0
  13. package/dist/src/api/client.d.ts +10 -0
  14. package/dist/src/api/client.js +63 -0
  15. package/dist/src/api/client.js.map +1 -0
  16. package/dist/src/api/types.d.ts +207 -0
  17. package/dist/src/api/types.js +20 -0
  18. package/dist/src/api/types.js.map +1 -0
  19. package/dist/src/commands/agent/_helpers.d.ts +7 -0
  20. package/dist/src/commands/agent/_helpers.js +32 -0
  21. package/dist/src/commands/agent/_helpers.js.map +1 -0
  22. package/dist/src/commands/agent/history.d.ts +2 -0
  23. package/dist/src/commands/agent/history.js +78 -0
  24. package/dist/src/commands/agent/history.js.map +1 -0
  25. package/dist/src/commands/agent/interrupt.d.ts +2 -0
  26. package/dist/src/commands/agent/interrupt.js +32 -0
  27. package/dist/src/commands/agent/interrupt.js.map +1 -0
  28. package/dist/src/commands/agent/join.d.ts +2 -0
  29. package/dist/src/commands/agent/join.js +168 -0
  30. package/dist/src/commands/agent/join.js.map +1 -0
  31. package/dist/src/commands/agent/list.d.ts +2 -0
  32. package/dist/src/commands/agent/list.js +67 -0
  33. package/dist/src/commands/agent/list.js.map +1 -0
  34. package/dist/src/commands/agent/speak.d.ts +2 -0
  35. package/dist/src/commands/agent/speak.js +48 -0
  36. package/dist/src/commands/agent/speak.js.map +1 -0
  37. package/dist/src/commands/agent/start.d.ts +2 -0
  38. package/dist/src/commands/agent/start.js +212 -0
  39. package/dist/src/commands/agent/start.js.map +1 -0
  40. package/dist/src/commands/agent/status.d.ts +2 -0
  41. package/dist/src/commands/agent/status.js +42 -0
  42. package/dist/src/commands/agent/status.js.map +1 -0
  43. package/dist/src/commands/agent/stop.d.ts +2 -0
  44. package/dist/src/commands/agent/stop.js +107 -0
  45. package/dist/src/commands/agent/stop.js.map +1 -0
  46. package/dist/src/commands/agent/turns.d.ts +2 -0
  47. package/dist/src/commands/agent/turns.js +99 -0
  48. package/dist/src/commands/agent/turns.js.map +1 -0
  49. package/dist/src/commands/agent/update.d.ts +2 -0
  50. package/dist/src/commands/agent/update.js +74 -0
  51. package/dist/src/commands/agent/update.js.map +1 -0
  52. package/dist/src/commands/agent/watch.d.ts +2 -0
  53. package/dist/src/commands/agent/watch.js +291 -0
  54. package/dist/src/commands/agent/watch.js.map +1 -0
  55. package/dist/src/commands/auth/login.d.ts +2 -0
  56. package/dist/src/commands/auth/login.js +118 -0
  57. package/dist/src/commands/auth/login.js.map +1 -0
  58. package/dist/src/commands/auth/logout.d.ts +2 -0
  59. package/dist/src/commands/auth/logout.js +84 -0
  60. package/dist/src/commands/auth/logout.js.map +1 -0
  61. package/dist/src/commands/auth/status.d.ts +2 -0
  62. package/dist/src/commands/auth/status.js +114 -0
  63. package/dist/src/commands/auth/status.js.map +1 -0
  64. package/dist/src/commands/call/_helpers.d.ts +7 -0
  65. package/dist/src/commands/call/_helpers.js +32 -0
  66. package/dist/src/commands/call/_helpers.js.map +1 -0
  67. package/dist/src/commands/call/hangup.d.ts +2 -0
  68. package/dist/src/commands/call/hangup.js +29 -0
  69. package/dist/src/commands/call/hangup.js.map +1 -0
  70. package/dist/src/commands/call/initiate.d.ts +2 -0
  71. package/dist/src/commands/call/initiate.js +137 -0
  72. package/dist/src/commands/call/initiate.js.map +1 -0
  73. package/dist/src/commands/call/status.d.ts +2 -0
  74. package/dist/src/commands/call/status.js +50 -0
  75. package/dist/src/commands/call/status.js.map +1 -0
  76. package/dist/src/commands/completion.d.ts +2 -0
  77. package/dist/src/commands/completion.js +542 -0
  78. package/dist/src/commands/completion.js.map +1 -0
  79. package/dist/src/commands/config/get.d.ts +2 -0
  80. package/dist/src/commands/config/get.js +79 -0
  81. package/dist/src/commands/config/get.js.map +1 -0
  82. package/dist/src/commands/config/init.d.ts +2 -0
  83. package/dist/src/commands/config/init.js +176 -0
  84. package/dist/src/commands/config/init.js.map +1 -0
  85. package/dist/src/commands/config/path.d.ts +2 -0
  86. package/dist/src/commands/config/path.js +22 -0
  87. package/dist/src/commands/config/path.js.map +1 -0
  88. package/dist/src/commands/config/set.d.ts +2 -0
  89. package/dist/src/commands/config/set.js +115 -0
  90. package/dist/src/commands/config/set.js.map +1 -0
  91. package/dist/src/commands/config/show.d.ts +2 -0
  92. package/dist/src/commands/config/show.js +147 -0
  93. package/dist/src/commands/config/show.js.map +1 -0
  94. package/dist/src/commands/preset/list.d.ts +2 -0
  95. package/dist/src/commands/preset/list.js +39 -0
  96. package/dist/src/commands/preset/list.js.map +1 -0
  97. package/dist/src/commands/preset/use.d.ts +2 -0
  98. package/dist/src/commands/preset/use.js +89 -0
  99. package/dist/src/commands/preset/use.js.map +1 -0
  100. package/dist/src/commands/quickstart.d.ts +2 -0
  101. package/dist/src/commands/quickstart.js +595 -0
  102. package/dist/src/commands/quickstart.js.map +1 -0
  103. package/dist/src/commands/repl.d.ts +2 -0
  104. package/dist/src/commands/repl.js +391 -0
  105. package/dist/src/commands/repl.js.map +1 -0
  106. package/dist/src/commands/template/delete.d.ts +2 -0
  107. package/dist/src/commands/template/delete.js +54 -0
  108. package/dist/src/commands/template/delete.js.map +1 -0
  109. package/dist/src/commands/template/list.d.ts +2 -0
  110. package/dist/src/commands/template/list.js +48 -0
  111. package/dist/src/commands/template/list.js.map +1 -0
  112. package/dist/src/commands/template/save.d.ts +2 -0
  113. package/dist/src/commands/template/save.js +86 -0
  114. package/dist/src/commands/template/save.js.map +1 -0
  115. package/dist/src/commands/template/show.d.ts +2 -0
  116. package/dist/src/commands/template/show.js +98 -0
  117. package/dist/src/commands/template/show.js.map +1 -0
  118. package/dist/src/commands/template/use.d.ts +2 -0
  119. package/dist/src/commands/template/use.js +109 -0
  120. package/dist/src/commands/template/use.js.map +1 -0
  121. package/dist/src/commands/token.d.ts +2 -0
  122. package/dist/src/commands/token.js +75 -0
  123. package/dist/src/commands/token.js.map +1 -0
  124. package/dist/src/config/manager.d.ts +22 -0
  125. package/dist/src/config/manager.js +130 -0
  126. package/dist/src/config/manager.js.map +1 -0
  127. package/dist/src/config/paths.d.ts +9 -0
  128. package/dist/src/config/paths.js +28 -0
  129. package/dist/src/config/paths.js.map +1 -0
  130. package/dist/src/config/schema.d.ts +396 -0
  131. package/dist/src/config/schema.js +57 -0
  132. package/dist/src/config/schema.js.map +1 -0
  133. package/dist/src/index.d.ts +1 -0
  134. package/dist/src/index.js +157 -0
  135. package/dist/src/index.js.map +1 -0
  136. package/dist/src/presets/defaults.d.ts +20 -0
  137. package/dist/src/presets/defaults.js +195 -0
  138. package/dist/src/presets/defaults.js.map +1 -0
  139. package/dist/src/providers/catalog.d.ts +103 -0
  140. package/dist/src/providers/catalog.js +247 -0
  141. package/dist/src/providers/catalog.js.map +1 -0
  142. package/dist/src/templates/manager.d.ts +24 -0
  143. package/dist/src/templates/manager.js +77 -0
  144. package/dist/src/templates/manager.js.map +1 -0
  145. package/dist/src/ui/colors.d.ts +9 -0
  146. package/dist/src/ui/colors.js +36 -0
  147. package/dist/src/ui/colors.js.map +1 -0
  148. package/dist/src/ui/output.d.ts +17 -0
  149. package/dist/src/ui/output.js +27 -0
  150. package/dist/src/ui/output.js.map +1 -0
  151. package/dist/src/ui/spinner.d.ts +5 -0
  152. package/dist/src/ui/spinner.js +23 -0
  153. package/dist/src/ui/spinner.js.map +1 -0
  154. package/dist/src/ui/table.d.ts +8 -0
  155. package/dist/src/ui/table.js +38 -0
  156. package/dist/src/ui/table.js.map +1 -0
  157. package/dist/src/utils/errors.d.ts +11 -0
  158. package/dist/src/utils/errors.js +38 -0
  159. package/dist/src/utils/errors.js.map +1 -0
  160. package/dist/src/utils/format.d.ts +16 -0
  161. package/dist/src/utils/format.js +87 -0
  162. package/dist/src/utils/format.js.map +1 -0
  163. package/dist/src/utils/hints.d.ts +7 -0
  164. package/dist/src/utils/hints.js +22 -0
  165. package/dist/src/utils/hints.js.map +1 -0
  166. package/dist/src/utils/token.d.ts +6 -0
  167. package/dist/src/utils/token.js +26 -0
  168. package/dist/src/utils/token.js.map +1 -0
  169. package/package.json +65 -0
  170. package/src/web/client.html +136 -0
package/README.md ADDED
@@ -0,0 +1,862 @@
1
+ ```
2
+ ____ _ ___ ____ _ ___
3
+ / ___|___ _ ____ _____ / \ |_ _| / ___| | |_ _|
4
+ | | / _ \| '_ \ \ / / _ \/ _ \ | | | | | | | |
5
+ | |__| (_) | | | \ V / (_) / ___ \ | | | |___| |___ | |
6
+ \____\___/|_| |_|\_/ \___/_/ \_\___| \____|_____|___|
7
+ ```
8
+
9
+ # ConvoAI CLI
10
+
11
+ **The developer-friendly CLI for Agora Conversational AI Engine**
12
+
13
+ [![npm version](https://img.shields.io/npm/v/convoai.svg)](https://www.npmjs.com/package/convoai)
14
+ [![license](https://img.shields.io/npm/l/convoai.svg)](https://github.com/AgoraIO/convoai-cli/blob/main/LICENSE)
15
+ [![node](https://img.shields.io/node/v/convoai.svg)](https://nodejs.org)
16
+
17
+ Start, manage, and monitor conversational AI agents from your terminal. One command to launch a voice agent. Full control over its lifecycle, conversation history, and real-time performance.
18
+
19
+ ---
20
+
21
+ ## Features
22
+
23
+ - **Full Agora ConvoAI REST API coverage** -- every endpoint, one CLI
24
+ - **Interactive and non-interactive modes** -- prompts when you're exploring, flags when you're scripting
25
+ - **Real-time agent monitoring** -- watch status, latency, and conversation turns live
26
+ - **Built-in presets** -- start with OpenAI, Anthropic, Gemini, or Realtime in one flag
27
+ - **Profile management** -- switch between dev, staging, and prod with a single option
28
+ - **JSON output for scripting** -- pipe `--json` into `jq` for CI/CD pipelines
29
+ - **Shell completions** -- tab-complete commands in bash, zsh, and fish
30
+ - **Project-level config** -- drop a `.convoai.json` in your repo for team-shared defaults
31
+ - **Telephony support (beta)** -- initiate and manage phone calls through ConvoAI
32
+
33
+ ---
34
+
35
+ ## Quick Start
36
+
37
+ ```bash
38
+ # Install globally
39
+ npm install -g convoai
40
+
41
+ # Authenticate with your Agora credentials
42
+ convoai auth login
43
+
44
+ # Start an agent on a channel using a preset
45
+ convoai agent start --channel my-first-agent --preset openai-mini
46
+
47
+ # See what's running
48
+ convoai agent list
49
+
50
+ # Check the conversation so far
51
+ convoai agent history <agent-id>
52
+
53
+ # View turn-level latency analytics
54
+ convoai agent turns <agent-id>
55
+
56
+ # Done for now
57
+ convoai agent stop <agent-id>
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Installation
63
+
64
+ ### npm (recommended)
65
+
66
+ ```bash
67
+ npm install -g convoai
68
+ ```
69
+
70
+ ### npx (no install)
71
+
72
+ ```bash
73
+ npx convoai auth login
74
+ npx convoai agent start --channel demo --preset openai-mini
75
+ ```
76
+
77
+ ### From source
78
+
79
+ ```bash
80
+ git clone https://github.com/AgoraIO/convoai-cli.git
81
+ cd convoai-cli
82
+ npm install
83
+ npm run build
84
+ npm link
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Authentication
90
+
91
+ ConvoAI CLI needs three credentials from [Agora Console](https://console.agora.io):
92
+
93
+ | Credential | Description |
94
+ |---|---|
95
+ | **App ID** | Your Agora project's application ID |
96
+ | **Customer ID** | REST API customer identifier |
97
+ | **Customer Secret** | REST API customer secret |
98
+
99
+ ### Interactive login
100
+
101
+ ```bash
102
+ convoai auth login
103
+ ```
104
+
105
+ The CLI will prompt for each value, verify connectivity, and save credentials to `~/.config/convoai/config.json`.
106
+
107
+ ### Non-interactive login
108
+
109
+ ```bash
110
+ convoai auth login \
111
+ --app-id YOUR_APP_ID \
112
+ --customer-id YOUR_CUSTOMER_ID \
113
+ --customer-secret YOUR_CUSTOMER_SECRET
114
+ ```
115
+
116
+ ### Login to a named profile
117
+
118
+ ```bash
119
+ convoai auth login --profile staging
120
+ ```
121
+
122
+ ### Environment variables
123
+
124
+ Credentials can also be provided via environment variables. These override any saved config.
125
+
126
+ ```bash
127
+ export CONVOAI_APP_ID="your-app-id"
128
+ export CONVOAI_CUSTOMER_ID="your-customer-id"
129
+ export CONVOAI_CUSTOMER_SECRET="your-customer-secret"
130
+ ```
131
+
132
+ ### Check auth status
133
+
134
+ ```bash
135
+ convoai auth status
136
+ ```
137
+
138
+ ### Clear credentials
139
+
140
+ ```bash
141
+ convoai auth logout
142
+ ```
143
+
144
+ ---
145
+
146
+ ## Commands Reference
147
+
148
+ Every command supports `--json` for machine-readable output and `--profile <name>` to target a specific configuration profile.
149
+
150
+ ### Agent Management
151
+
152
+ #### `agent start` -- Start a new conversational AI agent
153
+
154
+ ```bash
155
+ convoai agent start --channel <name> [options]
156
+ ```
157
+
158
+ | Flag | Description |
159
+ |---|---|
160
+ | `-c, --channel <name>` | RTC channel name (required) |
161
+ | `-n, --name <name>` | Agent name (auto-generated if omitted) |
162
+ | `--preset <name>` | Use a built-in preset (e.g. `openai-mini`, `anthropic-claude`) |
163
+ | `--model <model>` | LLM model name (e.g. `gpt-4o`, `claude-sonnet-4-20250514`) |
164
+ | `--llm-url <url>` | Custom LLM API endpoint |
165
+ | `--llm-key <key>` | LLM API key |
166
+ | `--tts <vendor>` | TTS vendor (e.g. `microsoft`, `elevenlabs`) |
167
+ | `--asr <vendor>` | ASR vendor (e.g. `deepgram`) |
168
+ | `--system-message <msg>` | System prompt for the LLM |
169
+ | `--greeting <msg>` | Greeting message spoken when the agent joins |
170
+ | `--uid <uid>` | Agent RTC UID (default: `"Agent"`) |
171
+ | `--remote-uids <uids>` | Comma-separated remote UIDs (default: `"*"`) |
172
+ | `--idle-timeout <seconds>` | Idle timeout in seconds (default: `30`) |
173
+ | `--dry-run` | Print the request payload without sending it |
174
+
175
+ **Examples:**
176
+
177
+ ```bash
178
+ # Quickest start -- use a preset
179
+ convoai agent start --channel demo --preset openai-mini
180
+
181
+ # Custom model with a system prompt
182
+ convoai agent start \
183
+ --channel support-line \
184
+ --model gpt-4o \
185
+ --system-message "You are a customer support agent for Acme Corp." \
186
+ --greeting "Hello! How can I help you today?"
187
+
188
+ # Use Anthropic Claude
189
+ convoai agent start --channel research --preset anthropic-claude
190
+
191
+ # OpenAI Realtime (multimodal voice-to-voice)
192
+ convoai agent start --channel realtime-demo --preset realtime-openai
193
+
194
+ # Dry run to inspect the request payload
195
+ convoai agent start --channel test --preset openai-mini --dry-run
196
+
197
+ # Interactive mode -- just run without flags and answer the prompts
198
+ convoai agent start
199
+ ```
200
+
201
+ ---
202
+
203
+ #### `agent stop` -- Stop a running agent
204
+
205
+ ```bash
206
+ convoai agent stop <agent-id>
207
+ convoai agent stop --all
208
+ ```
209
+
210
+ | Flag | Description |
211
+ |---|---|
212
+ | `-a, --all` | Stop all running agents |
213
+ | `-f, --force` | Skip confirmation when using `--all` |
214
+
215
+ **Examples:**
216
+
217
+ ```bash
218
+ # Stop a single agent
219
+ convoai agent stop abc123
220
+
221
+ # Stop everything (with confirmation prompt)
222
+ convoai agent stop --all
223
+
224
+ # Stop everything without confirmation (for scripts)
225
+ convoai agent stop --all --force
226
+ ```
227
+
228
+ ---
229
+
230
+ #### `agent status` -- Query the status of an agent
231
+
232
+ ```bash
233
+ convoai agent status <agent-id>
234
+ ```
235
+
236
+ Returns the agent's current status, channel, start time, and stop time (if applicable).
237
+
238
+ ---
239
+
240
+ #### `agent list` -- List agents
241
+
242
+ ```bash
243
+ convoai agent list [options]
244
+ ```
245
+
246
+ | Flag | Description |
247
+ |---|---|
248
+ | `-s, --state <state>` | Filter by state: `running`, `stopped`, `failed`, `all` (default: `running`) |
249
+ | `-c, --channel <name>` | Filter by channel name |
250
+ | `-l, --limit <n>` | Maximum results (default: `20`) |
251
+
252
+ Alias: `agent ls`
253
+
254
+ **Examples:**
255
+
256
+ ```bash
257
+ # List running agents (default)
258
+ convoai agent list
259
+
260
+ # List all agents regardless of state
261
+ convoai agent list --state all
262
+
263
+ # List agents on a specific channel
264
+ convoai agent list --channel my-channel
265
+
266
+ # List failed agents
267
+ convoai agent list --state failed --limit 50
268
+ ```
269
+
270
+ ---
271
+
272
+ #### `agent update` -- Update a running agent's configuration
273
+
274
+ ```bash
275
+ convoai agent update <agent-id> [options]
276
+ ```
277
+
278
+ | Flag | Description |
279
+ |---|---|
280
+ | `--system-message <msg>` | Update the system prompt |
281
+ | `--model <model>` | Update the LLM model |
282
+ | `--max-tokens <n>` | Update max tokens |
283
+ | `--temperature <n>` | Update temperature |
284
+ | `--token <token>` | Update the RTC token |
285
+
286
+ **Examples:**
287
+
288
+ ```bash
289
+ # Change the system prompt on the fly
290
+ convoai agent update abc123 --system-message "You are now a French tutor."
291
+
292
+ # Adjust generation parameters
293
+ convoai agent update abc123 --temperature 0.3 --max-tokens 256
294
+ ```
295
+
296
+ ---
297
+
298
+ #### `agent speak` -- Instruct an agent to speak
299
+
300
+ ```bash
301
+ convoai agent speak <agent-id> <text> [options]
302
+ ```
303
+
304
+ | Flag | Description |
305
+ |---|---|
306
+ | `--priority <priority>` | `INTERRUPT`, `APPEND`, or `IGNORE` (default: `INTERRUPT`) |
307
+ | `--no-interrupt` | Prevent user from voice-interrupting this message |
308
+
309
+ **Examples:**
310
+
311
+ ```bash
312
+ # Interrupt current speech and say something
313
+ convoai agent speak abc123 "We'll be closing in 5 minutes."
314
+
315
+ # Append to the speech queue
316
+ convoai agent speak abc123 "One more thing..." --priority APPEND
317
+
318
+ # Non-interruptible announcement
319
+ convoai agent speak abc123 "Important: scheduled maintenance at midnight." --no-interrupt
320
+ ```
321
+
322
+ ---
323
+
324
+ #### `agent interrupt` -- Interrupt an agent that is currently speaking
325
+
326
+ ```bash
327
+ convoai agent interrupt <agent-id>
328
+ ```
329
+
330
+ ---
331
+
332
+ #### `agent history` -- View conversation history
333
+
334
+ ```bash
335
+ convoai agent history <agent-id> [options]
336
+ ```
337
+
338
+ | Flag | Description |
339
+ |---|---|
340
+ | `--limit <n>` | Show only the last N entries |
341
+
342
+ **Examples:**
343
+
344
+ ```bash
345
+ # Full conversation history
346
+ convoai agent history abc123
347
+
348
+ # Last 5 messages
349
+ convoai agent history abc123 --limit 5
350
+
351
+ # Export as JSON
352
+ convoai agent history abc123 --json > conversation.json
353
+ ```
354
+
355
+ ---
356
+
357
+ #### `agent turns` -- View turn-level latency analytics
358
+
359
+ ```bash
360
+ convoai agent turns <agent-id> [options]
361
+ ```
362
+
363
+ | Flag | Description |
364
+ |---|---|
365
+ | `--limit <n>` | Number of turns to show (default: `20`) |
366
+
367
+ Displays a table of each conversation turn with end-to-end latency and per-component breakdown (ASR, LLM, TTS), plus averages. Latency values are color-coded: green (<1s), yellow (1-2s), red (>2s).
368
+
369
+ **Examples:**
370
+
371
+ ```bash
372
+ # See the latest turns
373
+ convoai agent turns abc123
374
+
375
+ # Export turn analytics as JSON for further analysis
376
+ convoai agent turns abc123 --json | jq '.turns[] | {turn_id, e2e_latency_ms}'
377
+ ```
378
+
379
+ ---
380
+
381
+ ### Call Management (Beta)
382
+
383
+ Telephony integration for initiating and managing phone calls through ConvoAI agents.
384
+
385
+ #### `call initiate` -- Start a phone call
386
+
387
+ ```bash
388
+ convoai call initiate [options]
389
+ ```
390
+
391
+ #### `call hangup` -- End a phone call
392
+
393
+ ```bash
394
+ convoai call hangup <call-id>
395
+ ```
396
+
397
+ #### `call status` -- Check call status
398
+
399
+ ```bash
400
+ convoai call status <call-id>
401
+ ```
402
+
403
+ > **Note:** Call commands are in beta. The API surface may change in future releases.
404
+
405
+ ---
406
+
407
+ ### Configuration
408
+
409
+ #### `config init` -- Interactive setup wizard
410
+
411
+ ```bash
412
+ convoai config init
413
+ ```
414
+
415
+ Walks you through setting up your Agora credentials, LLM provider, and TTS vendor with an interactive wizard. Verifies connectivity when done.
416
+
417
+ ---
418
+
419
+ #### `config set` -- Set a configuration value
420
+
421
+ ```bash
422
+ convoai config set <key> <value> [--profile <name>]
423
+ ```
424
+
425
+ Supports dot-notation for nested values.
426
+
427
+ **Examples:**
428
+
429
+ ```bash
430
+ # Set the default LLM model
431
+ convoai config set llm.model gpt-4o
432
+
433
+ # Set ASR language for a profile
434
+ convoai config set asr.language en-US --profile production
435
+
436
+ # Set the TTS voice
437
+ convoai config set tts.params.voice_name en-US-AndrewMultilingualNeural
438
+
439
+ # Set the default region
440
+ convoai config set region global
441
+ ```
442
+
443
+ **Valid keys:**
444
+
445
+ | Category | Keys |
446
+ |---|---|
447
+ | Credentials | `app_id`, `customer_id`, `customer_secret`, `base_url`, `region`, `default_profile` |
448
+ | LLM | `llm.url`, `llm.api_key`, `llm.vendor`, `llm.style`, `llm.model`, `llm.greeting_message`, `llm.failure_message`, `llm.max_history` |
449
+ | TTS | `tts.vendor`, `tts.params.key`, `tts.params.region`, `tts.params.voice_name`, `tts.params.speed`, `tts.params.volume` |
450
+ | ASR | `asr.vendor`, `asr.language`, `asr.params.key`, `asr.params.model`, `asr.params.language` |
451
+
452
+ ---
453
+
454
+ #### `config get` -- Read a configuration value
455
+
456
+ ```bash
457
+ convoai config get <key> [--profile <name>]
458
+ ```
459
+
460
+ ```bash
461
+ convoai config get llm.model
462
+ # gpt-4o
463
+
464
+ convoai config get region --profile staging
465
+ # cn
466
+ ```
467
+
468
+ ---
469
+
470
+ #### `config show` -- Display the full configuration
471
+
472
+ ```bash
473
+ convoai config show [--profile <name>] [--json]
474
+ ```
475
+
476
+ Secrets are automatically masked in the output.
477
+
478
+ ---
479
+
480
+ #### `config path` -- Print the config file path
481
+
482
+ ```bash
483
+ convoai config path
484
+ # ~/.config/convoai/config.json
485
+
486
+ convoai config path --dir
487
+ # ~/.config/convoai
488
+ ```
489
+
490
+ ---
491
+
492
+ ### Presets
493
+
494
+ Presets are built-in configurations that bundle an LLM, TTS, and ASR stack into a single name.
495
+
496
+ #### Available presets
497
+
498
+ | Preset | LLM | TTS | ASR |
499
+ |---|---|---|---|
500
+ | `openai-gpt4o` | OpenAI GPT-4o | Microsoft TTS | Deepgram |
501
+ | `openai-mini` | OpenAI GPT-4o-mini | Microsoft TTS | Deepgram |
502
+ | `anthropic-claude` | Anthropic Claude | Microsoft TTS | Deepgram |
503
+ | `gemini` | Google Gemini 2.0 Flash | Microsoft TTS | Deepgram |
504
+ | `realtime-openai` | OpenAI Realtime (multimodal) | Built-in (MLLM) | Built-in (MLLM) |
505
+
506
+ #### `preset list` -- List all presets
507
+
508
+ ```bash
509
+ convoai preset list
510
+ ```
511
+
512
+ #### `preset use` -- Apply a preset to your profile
513
+
514
+ ```bash
515
+ convoai preset use <name> [--profile <name>]
516
+ ```
517
+
518
+ Saves the preset's LLM, TTS, and ASR settings as your profile defaults. After applying, `agent start` will use these settings automatically.
519
+
520
+ ```bash
521
+ # Apply to your default profile
522
+ convoai preset use openai-mini
523
+
524
+ # Apply to a named profile
525
+ convoai preset use anthropic-claude --profile research
526
+ ```
527
+
528
+ ---
529
+
530
+ ### Other Commands
531
+
532
+ #### `auth status` -- Check authentication status
533
+
534
+ ```bash
535
+ convoai auth status
536
+ ```
537
+
538
+ #### `auth logout` -- Remove saved credentials
539
+
540
+ ```bash
541
+ convoai auth logout
542
+ ```
543
+
544
+ ---
545
+
546
+ ## Configuration
547
+
548
+ ### Precedence
549
+
550
+ Configuration is resolved in this order (highest priority first):
551
+
552
+ ```
553
+ CLI flags > Environment variables > Project .convoai.json > Profile config > Base config
554
+ ```
555
+
556
+ ### Config file
557
+
558
+ The global configuration lives at `~/.config/convoai/config.json`:
559
+
560
+ ```json
561
+ {
562
+ "app_id": "your-app-id",
563
+ "customer_id": "your-customer-id",
564
+ "customer_secret": "your-customer-secret",
565
+ "region": "global",
566
+ "default_profile": "default",
567
+ "profiles": {
568
+ "default": {
569
+ "llm": {
570
+ "vendor": "openai",
571
+ "style": "openai",
572
+ "api_key": "sk-...",
573
+ "model": "gpt-4o-mini"
574
+ },
575
+ "tts": {
576
+ "vendor": "microsoft",
577
+ "params": {
578
+ "voice_name": "en-US-AndrewMultilingualNeural",
579
+ "speed": 1.0
580
+ }
581
+ },
582
+ "asr": {
583
+ "vendor": "deepgram",
584
+ "language": "en-US",
585
+ "params": {
586
+ "model": "nova-2"
587
+ }
588
+ }
589
+ }
590
+ }
591
+ }
592
+ ```
593
+
594
+ ### Project config
595
+
596
+ Drop a `.convoai.json` in your project root to share settings across your team. Project config overrides profile settings.
597
+
598
+ ```json
599
+ {
600
+ "llm": {
601
+ "vendor": "openai",
602
+ "model": "gpt-4o",
603
+ "system_messages": [
604
+ {
605
+ "role": "system",
606
+ "content": "You are the Acme Corp support assistant. Be helpful and concise."
607
+ }
608
+ ]
609
+ },
610
+ "tts": {
611
+ "vendor": "microsoft",
612
+ "params": {
613
+ "voice_name": "en-US-JennyNeural"
614
+ }
615
+ }
616
+ }
617
+ ```
618
+
619
+ Commit `.convoai.json` to version control. Keep secrets out of it -- use environment variables or your personal config profile for credentials.
620
+
621
+ ---
622
+
623
+ ## Profiles
624
+
625
+ Profiles let you maintain separate configurations for different environments.
626
+
627
+ ### Setup
628
+
629
+ ```bash
630
+ # Create a development profile
631
+ convoai auth login --profile dev
632
+
633
+ # Create a staging profile
634
+ convoai auth login --profile staging
635
+
636
+ # Create a production profile
637
+ convoai auth login --profile prod
638
+ ```
639
+
640
+ ### Usage
641
+
642
+ ```bash
643
+ # Start an agent using staging credentials
644
+ convoai agent start --channel test --preset openai-mini --profile staging
645
+
646
+ # List agents in production
647
+ convoai agent list --profile prod
648
+
649
+ # Set the default profile so you don't need --profile every time
650
+ convoai config set default_profile staging
651
+ ```
652
+
653
+ ### Switch via environment variable
654
+
655
+ ```bash
656
+ export CONVOAI_PROFILE=prod
657
+ convoai agent list # uses prod profile automatically
658
+ ```
659
+
660
+ ---
661
+
662
+ ## Scripting and CI/CD
663
+
664
+ Every command supports `--json` for machine-readable output, making it straightforward to integrate with pipelines.
665
+
666
+ ### Parse output with jq
667
+
668
+ ```bash
669
+ # Get the agent ID from a start command
670
+ AGENT_ID=$(convoai agent start --channel ci-test --preset openai-mini --json | jq -r '.agent_id')
671
+ echo "Started agent: $AGENT_ID"
672
+
673
+ # Check status
674
+ convoai agent status "$AGENT_ID" --json | jq '.status'
675
+
676
+ # Clean up
677
+ convoai agent stop "$AGENT_ID"
678
+ ```
679
+
680
+ ### List running agents and extract IDs
681
+
682
+ ```bash
683
+ convoai agent list --json | jq -r '.data.list[].agent_id'
684
+ ```
685
+
686
+ ### Export conversation history
687
+
688
+ ```bash
689
+ convoai agent history "$AGENT_ID" --json | jq '.contents[] | "\(.role): \(.content)"'
690
+ ```
691
+
692
+ ### CI/CD pipeline example
693
+
694
+ ```bash
695
+ #!/bin/bash
696
+ set -euo pipefail
697
+
698
+ # Credentials from CI secrets
699
+ export CONVOAI_APP_ID="$AGORA_APP_ID"
700
+ export CONVOAI_CUSTOMER_ID="$AGORA_CUSTOMER_ID"
701
+ export CONVOAI_CUSTOMER_SECRET="$AGORA_CUSTOMER_SECRET"
702
+
703
+ # Start a test agent
704
+ AGENT_ID=$(convoai agent start \
705
+ --channel "ci-${CI_BUILD_ID}" \
706
+ --preset openai-mini \
707
+ --json | jq -r '.agent_id')
708
+
709
+ echo "Agent started: $AGENT_ID"
710
+
711
+ # Run your integration tests here...
712
+
713
+ # Tear down
714
+ convoai agent stop "$AGENT_ID"
715
+
716
+ # Stop any orphaned agents from failed runs
717
+ convoai agent stop --all --force
718
+ ```
719
+
720
+ ---
721
+
722
+ ## Environment Variables
723
+
724
+ | Variable | Description |
725
+ |---|---|
726
+ | `CONVOAI_APP_ID` | Agora App ID (overrides config) |
727
+ | `CONVOAI_CUSTOMER_ID` | Customer ID (overrides config) |
728
+ | `CONVOAI_CUSTOMER_SECRET` | Customer Secret (overrides config) |
729
+ | `CONVOAI_PROFILE` | Active profile name |
730
+ | `CONVOAI_BASE_URL` | Custom API base URL |
731
+ | `NO_COLOR` | Disable colored output (any value) |
732
+
733
+ ---
734
+
735
+ ## Template Files
736
+
737
+ ### `.convoai.json` -- project configuration
738
+
739
+ Place this file in your project root for team-shared agent defaults.
740
+
741
+ ```json
742
+ {
743
+ "llm": {
744
+ "vendor": "openai",
745
+ "model": "gpt-4o",
746
+ "system_messages": [
747
+ {
748
+ "role": "system",
749
+ "content": "You are a helpful voice assistant for our application."
750
+ }
751
+ ],
752
+ "greeting_message": "Hi there! How can I help you today?",
753
+ "max_history": 20,
754
+ "params": {
755
+ "temperature": 0.7,
756
+ "max_tokens": 512
757
+ }
758
+ },
759
+ "tts": {
760
+ "vendor": "microsoft",
761
+ "params": {
762
+ "voice_name": "en-US-AndrewMultilingualNeural",
763
+ "speed": 1.0
764
+ }
765
+ },
766
+ "asr": {
767
+ "vendor": "deepgram",
768
+ "language": "en-US",
769
+ "params": {
770
+ "model": "nova-2"
771
+ }
772
+ }
773
+ }
774
+ ```
775
+
776
+ ---
777
+
778
+ ## Troubleshooting
779
+
780
+ ### `Missing required credentials: app_id, customer_id, customer_secret`
781
+
782
+ You haven't authenticated yet. Run:
783
+
784
+ ```bash
785
+ convoai auth login
786
+ ```
787
+
788
+ Or set the environment variables `CONVOAI_APP_ID`, `CONVOAI_CUSTOMER_ID`, and `CONVOAI_CUSTOMER_SECRET`.
789
+
790
+ ### `--channel is required`
791
+
792
+ The `agent start` command requires a channel name. Provide it as a flag:
793
+
794
+ ```bash
795
+ convoai agent start --channel my-channel --preset openai-mini
796
+ ```
797
+
798
+ Or run `convoai agent start` without flags in an interactive terminal to get prompted.
799
+
800
+ ### Agent starts but immediately shows `FAILED` status
801
+
802
+ Check your LLM API key and TTS credentials. Use `config show` to inspect:
803
+
804
+ ```bash
805
+ convoai config show
806
+ ```
807
+
808
+ Verify the LLM key is set in your profile:
809
+
810
+ ```bash
811
+ convoai config get llm.api_key
812
+ ```
813
+
814
+ ### Connection errors or timeouts
815
+
816
+ - Confirm your region is correct: `convoai config get region`
817
+ - Check if you need a custom base URL for your deployment
818
+ - Verify your network can reach the Agora ConvoAI API
819
+
820
+ ### Agent stops after `idle_timeout` seconds
821
+
822
+ By default, agents time out after 30 seconds of inactivity. Increase it:
823
+
824
+ ```bash
825
+ convoai agent start --channel demo --preset openai-mini --idle-timeout 300
826
+ ```
827
+
828
+ ### How do I see the raw API request?
829
+
830
+ Use `--dry-run` to print the request payload without sending it:
831
+
832
+ ```bash
833
+ convoai agent start --channel test --preset openai-mini --dry-run
834
+ ```
835
+
836
+ ### Colors not showing / garbled output
837
+
838
+ If your terminal doesn't support ANSI colors, disable them:
839
+
840
+ ```bash
841
+ NO_COLOR=1 convoai agent list
842
+ ```
843
+
844
+ ---
845
+
846
+ ## Contributing
847
+
848
+ 1. Fork the repository
849
+ 2. Create a feature branch: `git checkout -b my-feature`
850
+ 3. Install dependencies: `npm install`
851
+ 4. Run in dev mode: `npm run dev -- agent list`
852
+ 5. Check types: `npm run lint`
853
+ 6. Build: `npm run build`
854
+ 7. Submit a pull request
855
+
856
+ The project uses TypeScript with strict mode, Commander.js for command parsing, and Zod for config validation.
857
+
858
+ ---
859
+
860
+ ## License
861
+
862
+ [MIT](LICENSE)