retell-cli 1.0.0 → 1.0.1
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.
- package/CHANGELOG.md +362 -0
- package/README.md +196 -12
- package/dist/index.js +796 -94
- package/package.json +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,368 @@ All notable changes to the Retell AI CLI will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [Unreleased] - v1.0.1
|
|
9
|
+
|
|
10
|
+
### Added - Phase 1: Foundation & Utilities
|
|
11
|
+
|
|
12
|
+
#### Security
|
|
13
|
+
- Prototype pollution protection in field path handling
|
|
14
|
+
- Rejects `__proto__`, `constructor`, and `prototype` keys
|
|
15
|
+
- Prevents object prototype manipulation attacks
|
|
16
|
+
- Comprehensive test coverage for security scenarios
|
|
17
|
+
|
|
18
|
+
#### TypeScript Types
|
|
19
|
+
- `DiffResult` and `ChangeDetail` - Types for prompt diffing functionality
|
|
20
|
+
- `HotspotIssue` and `HotspotsResult` - Types for hotspot detection
|
|
21
|
+
- `SearchOptions` and `SearchResult` - Types for search functionality
|
|
22
|
+
- `FieldFilterOptions` and `FilteredResult` - Types for field filtering
|
|
23
|
+
|
|
24
|
+
#### Utility Functions
|
|
25
|
+
|
|
26
|
+
**Field Filtering (`src/services/output-formatter.ts`)**
|
|
27
|
+
- `filterFields()` - Filter objects to include only specified fields
|
|
28
|
+
- Support for dot notation (e.g., `"user.profile.name"`)
|
|
29
|
+
- Handles nested objects and arrays gracefully
|
|
30
|
+
- Strict and non-strict modes for error handling
|
|
31
|
+
- Preserves data types when filtering (including `undefined` and `null`)
|
|
32
|
+
- Distinguishes between missing fields and `undefined` values
|
|
33
|
+
- Generic types for improved type inference
|
|
34
|
+
- Prototype pollution protection
|
|
35
|
+
- Comprehensive error messages for invalid fields
|
|
36
|
+
|
|
37
|
+
**Prompt Diffing (`src/services/prompt-diff.ts`)**
|
|
38
|
+
- `generateDiff()` - Compare local and remote prompt versions
|
|
39
|
+
- Supports retell-llm and conversation-flow agent types
|
|
40
|
+
- Detects added, removed, and modified fields
|
|
41
|
+
- Handles deeply nested objects and arrays
|
|
42
|
+
- Type-safe integration with existing PromptSource types
|
|
43
|
+
- Uses `microdiff` for reliable, maintained diffing
|
|
44
|
+
- Preserves primitive types without unnecessary conversion
|
|
45
|
+
- `formatDiffSummary()` - Format diff results as human-readable summary
|
|
46
|
+
|
|
47
|
+
#### Testing
|
|
48
|
+
- 27 unit tests for `filterFields()` utility
|
|
49
|
+
- Top-level and nested field selection
|
|
50
|
+
- Array handling
|
|
51
|
+
- Invalid field handling (strict and non-strict modes)
|
|
52
|
+
- Edge cases (null, undefined, empty data)
|
|
53
|
+
- Real-world scenarios (Retell API objects)
|
|
54
|
+
- Security: Prototype pollution protection (4 tests)
|
|
55
|
+
- Undefined vs missing field distinction
|
|
56
|
+
|
|
57
|
+
- 15 unit tests for `generateDiff()` utility
|
|
58
|
+
- Retell-LLM prompt changes
|
|
59
|
+
- Conversation-flow prompt changes
|
|
60
|
+
- No changes detection
|
|
61
|
+
- Error handling (type mismatches, custom-llm)
|
|
62
|
+
- Summary formatting
|
|
63
|
+
|
|
64
|
+
- 1 helper function test
|
|
65
|
+
- `hasNestedPath()` with security validation
|
|
66
|
+
|
|
67
|
+
- **Total: 43 tests passing** ✅
|
|
68
|
+
|
|
69
|
+
#### Dependencies
|
|
70
|
+
- `microdiff` - For detecting changes in prompt objects
|
|
71
|
+
- Actively maintained (vs. unmaintained `deep-diff`)
|
|
72
|
+
- Smaller bundle size
|
|
73
|
+
- Simpler, more modern API
|
|
74
|
+
- Better TypeScript support
|
|
75
|
+
|
|
76
|
+
#### Developer Tools
|
|
77
|
+
- `npm test` - Run all tests once
|
|
78
|
+
- `npm run test:watch` - Run tests in watch mode
|
|
79
|
+
- `npm run test:coverage` - Generate coverage report
|
|
80
|
+
|
|
81
|
+
### Technical Details
|
|
82
|
+
|
|
83
|
+
**Phase 1** provides foundation utilities that will be used by upcoming features:
|
|
84
|
+
- Field selection (`--fields` flag) - Uses `filterFields()`
|
|
85
|
+
- Raw output mode (`--raw` flag) - Will use field filtering
|
|
86
|
+
- Hotspots detection (`--hotspots-only`) - Will use types and field filtering
|
|
87
|
+
- Search command - Will use SearchOptions types and filtering
|
|
88
|
+
- Diff & dry-run - Uses `generateDiff()` and `formatDiffSummary()`
|
|
89
|
+
|
|
90
|
+
These utilities are designed to be:
|
|
91
|
+
- **Performant** - Handle large objects efficiently
|
|
92
|
+
- **Type-safe** - Full TypeScript support with generics
|
|
93
|
+
- **Well-tested** - Comprehensive unit test coverage
|
|
94
|
+
- **Documented** - JSDoc comments for all public APIs
|
|
95
|
+
- **Reusable** - Clean, focused functions for multiple use cases
|
|
96
|
+
- **Secure** - Protection against prototype pollution attacks
|
|
97
|
+
|
|
98
|
+
### Added - Phase 2: Field Selection
|
|
99
|
+
|
|
100
|
+
#### Field Selection Flag (`--fields`)
|
|
101
|
+
- Added `--fields` option to transcript commands:
|
|
102
|
+
- `retell transcripts list --fields <fields>`
|
|
103
|
+
- `retell transcripts get <call_id> --fields <fields>`
|
|
104
|
+
- `retell transcripts analyze <call_id> --fields <fields>`
|
|
105
|
+
|
|
106
|
+
- Added `--fields` option to agent commands:
|
|
107
|
+
- `retell agents list --fields <fields>`
|
|
108
|
+
- `retell agents info <agent_id> --fields <fields>`
|
|
109
|
+
|
|
110
|
+
**Features:**
|
|
111
|
+
- Comma-separated field list: `call_id,status,metadata.duration`
|
|
112
|
+
- Dot notation for nested fields: `metadata.duration`
|
|
113
|
+
- Handles whitespace in field lists
|
|
114
|
+
- Graceful handling of invalid field names (warns, continues)
|
|
115
|
+
- Reduces output size by 50-90% for typical AI workflows
|
|
116
|
+
- Fully backward compatible (no --fields = full output)
|
|
117
|
+
|
|
118
|
+
**Examples:**
|
|
119
|
+
```bash
|
|
120
|
+
# Select specific fields
|
|
121
|
+
retell transcripts list --fields call_id,call_status
|
|
122
|
+
|
|
123
|
+
# Nested field selection
|
|
124
|
+
retell transcripts get abc123 --fields metadata.duration,analysis.summary
|
|
125
|
+
|
|
126
|
+
# Combined with other options
|
|
127
|
+
retell agents list --limit 10 --fields agent_id,agent_name
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
#### Documentation Updates
|
|
131
|
+
- Added "Field Selection" section to README.md
|
|
132
|
+
- Usage examples with dot notation
|
|
133
|
+
- Supported commands list
|
|
134
|
+
- Token reduction benefits for AI workflows
|
|
135
|
+
- Updated command examples in CLI help text
|
|
136
|
+
|
|
137
|
+
#### Testing
|
|
138
|
+
- All existing tests still passing (46/46) ✅
|
|
139
|
+
- Backward compatibility verified
|
|
140
|
+
- Manual testing completed for all edge cases
|
|
141
|
+
|
|
142
|
+
### Added - Phase 3: Raw Output Mode
|
|
143
|
+
|
|
144
|
+
#### Raw Output Flag (`--raw`)
|
|
145
|
+
- Added `--raw` option to `transcripts analyze` command:
|
|
146
|
+
- `retell transcripts analyze <call_id> --raw`
|
|
147
|
+
|
|
148
|
+
**Features:**
|
|
149
|
+
- Returns unmodified [Call Object](https://docs.retellai.com/api-references/retrieve-call) from Retell API (bypasses enrichment)
|
|
150
|
+
- Works seamlessly with `--fields` for combined filtering: `--raw --fields call_id,transcript`
|
|
151
|
+
- Useful for debugging, API schema alignment, and accessing new fields
|
|
152
|
+
- Fully backward compatible (no `--raw` = enriched analysis output)
|
|
153
|
+
|
|
154
|
+
**Examples:**
|
|
155
|
+
```bash
|
|
156
|
+
# Get raw API response (official Retell schema)
|
|
157
|
+
retell transcripts analyze abc123 --raw
|
|
158
|
+
|
|
159
|
+
# Raw response with field filtering
|
|
160
|
+
retell transcripts analyze abc123 --raw --fields call_id,transcript_object
|
|
161
|
+
|
|
162
|
+
# Compare raw vs enriched
|
|
163
|
+
diff <(retell transcripts analyze abc123 --raw) <(retell transcripts analyze abc123)
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Use Cases:**
|
|
167
|
+
- Debugging: Compare raw API response to enriched output
|
|
168
|
+
- API Schema Alignment: Tools expecting [official Retell API schema](https://docs.retellai.com/api-references/list-calls)
|
|
169
|
+
- Future-proofing: Access new API fields before CLI enriches them
|
|
170
|
+
- Token Efficiency: Combine with `--fields` for precise extraction
|
|
171
|
+
|
|
172
|
+
#### Testing
|
|
173
|
+
- All existing tests still passing (46/46) ✅
|
|
174
|
+
- New integration tests added for raw mode (8 test cases)
|
|
175
|
+
- Backward compatibility verified (no `--raw` = enriched output)
|
|
176
|
+
- Manual testing completed for all use cases
|
|
177
|
+
|
|
178
|
+
### Added - Phase 4: Hotspot Detection
|
|
179
|
+
|
|
180
|
+
#### Hotspot Detection Flag (`--hotspots-only`)
|
|
181
|
+
- Added `--hotspots-only` option to `transcripts analyze` command:
|
|
182
|
+
- `retell transcripts analyze <call_id> --hotspots-only`
|
|
183
|
+
|
|
184
|
+
**Features:**
|
|
185
|
+
- Detects conversation issues using Retell API metrics
|
|
186
|
+
- Returns structured array of hotspots with turn indices and timestamps
|
|
187
|
+
- Configurable thresholds for latency and silence detection
|
|
188
|
+
- Works seamlessly with `--fields` for token efficiency
|
|
189
|
+
- Fully backward compatible
|
|
190
|
+
|
|
191
|
+
**Detected Issues:**
|
|
192
|
+
- Latency spikes (p90 > configurable threshold, default 2000ms)
|
|
193
|
+
- Long silences (gaps > configurable threshold, default 5000ms)
|
|
194
|
+
- Sentiment issues (negative sentiment indicators)
|
|
195
|
+
|
|
196
|
+
**Examples:**
|
|
197
|
+
```bash
|
|
198
|
+
# Detect all hotspots
|
|
199
|
+
retell transcripts analyze abc123 --hotspots-only
|
|
200
|
+
|
|
201
|
+
# Custom thresholds
|
|
202
|
+
retell transcripts analyze abc123 --hotspots-only --latency-threshold 1500
|
|
203
|
+
|
|
204
|
+
# Minimal output
|
|
205
|
+
retell transcripts analyze abc123 --hotspots-only --fields hotspots
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**Use Cases:**
|
|
209
|
+
- Rapid troubleshooting: Identify problem areas in failed calls
|
|
210
|
+
- Prompt iteration: See exactly where agent responses failed
|
|
211
|
+
- Performance monitoring: Track latency issues across calls
|
|
212
|
+
- AI workflows: Feed hotspots into prompt refinement pipelines
|
|
213
|
+
|
|
214
|
+
#### Documentation
|
|
215
|
+
- Added `localdocs/retell-api-metrics-reference.md` - API research findings
|
|
216
|
+
- Updated README.md with "Hotspot Detection" section
|
|
217
|
+
- Updated CLI help text with examples
|
|
218
|
+
|
|
219
|
+
#### Testing
|
|
220
|
+
- All existing tests still passing (59/59) ✅
|
|
221
|
+
- Manual testing completed for all hotspot types
|
|
222
|
+
- Edge cases verified (empty transcripts, missing metrics)
|
|
223
|
+
- Backward compatibility verified
|
|
224
|
+
|
|
225
|
+
### Added - Phase 5: Transcripts Search Command
|
|
226
|
+
|
|
227
|
+
#### Advanced Search with Hybrid Filtering
|
|
228
|
+
- Added `retell transcripts search` command with multiple filter options:
|
|
229
|
+
- `--status` - Filter by call status (error, ended, ongoing)
|
|
230
|
+
- `--agent-id` - Filter by agent ID
|
|
231
|
+
- `--since` - Filter calls after date (YYYY-MM-DD or ISO format)
|
|
232
|
+
- `--until` - Filter calls before date (YYYY-MM-DD or ISO format)
|
|
233
|
+
- `--limit` - Maximum results (default: 50)
|
|
234
|
+
- `--fields` - Select specific fields (Phase 2 integration)
|
|
235
|
+
|
|
236
|
+
**Features:**
|
|
237
|
+
- API-based filtering (100% server-side) for maximum performance
|
|
238
|
+
- Structured output with results, total_count, and filters_applied
|
|
239
|
+
- Input validation with helpful error messages
|
|
240
|
+
- Seamless integration with `--fields` for token efficiency
|
|
241
|
+
- Eliminates need for jq/grep in AI agent workflows
|
|
242
|
+
- ISO date format support (YYYY-MM-DD and full ISO 8601)
|
|
243
|
+
|
|
244
|
+
**Examples:**
|
|
245
|
+
```bash
|
|
246
|
+
# Find error calls for specific agent
|
|
247
|
+
retell transcripts search --status error --agent-id agent_123
|
|
248
|
+
|
|
249
|
+
# Date range filtering
|
|
250
|
+
retell transcripts search --since 2025-11-01 --until 2025-11-15
|
|
251
|
+
|
|
252
|
+
# Minimal output with field selection
|
|
253
|
+
retell transcripts search --status error --fields call_id,call_status
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
**Use Cases:**
|
|
257
|
+
- Batch analysis: Find and analyze problematic calls
|
|
258
|
+
- Performance monitoring: Track errors by agent or time period
|
|
259
|
+
- AI workflows: Automated issue detection without shell scripting
|
|
260
|
+
- Debugging: Quickly locate specific call patterns
|
|
261
|
+
|
|
262
|
+
#### Documentation
|
|
263
|
+
- Added `localdocs/retell-api-search-capabilities.md` - API research findings
|
|
264
|
+
- Updated README.md with "Search Transcripts" section
|
|
265
|
+
- Updated CLI help text with comprehensive examples
|
|
266
|
+
|
|
267
|
+
#### Testing
|
|
268
|
+
- All existing tests still passing (78/78) ✅
|
|
269
|
+
- 31 new unit tests for search validation and filtering
|
|
270
|
+
- Manual testing completed for all filter combinations
|
|
271
|
+
- Edge cases verified (empty results, invalid inputs)
|
|
272
|
+
- Integration with `--fields` verified
|
|
273
|
+
|
|
274
|
+
**Total: 109 tests passing** ✅
|
|
275
|
+
|
|
276
|
+
### Fixed - Phase 1: Code Review Improvements
|
|
277
|
+
|
|
278
|
+
#### Critical Bug Fixes
|
|
279
|
+
- Fixed index bug in `setNestedValue()` helper function
|
|
280
|
+
- Was using `keys.indexOf(key)` which returns first occurrence, not current iteration index
|
|
281
|
+
- Now uses proper loop index variable for correct array/object type detection
|
|
282
|
+
- Fixed undefined value handling in `filterFields()`
|
|
283
|
+
- Now correctly distinguishes between fields that don't exist vs. fields with `undefined` values
|
|
284
|
+
- Uses `hasNestedPath()` to check existence before checking value
|
|
285
|
+
- Preserves `undefined` values in filtered results when field exists
|
|
286
|
+
|
|
287
|
+
#### Security Fixes
|
|
288
|
+
- Added prototype pollution protection
|
|
289
|
+
- Validates field paths before processing
|
|
290
|
+
- Rejects dangerous keys: `__proto__`, `constructor`, `prototype`
|
|
291
|
+
- Prevents object prototype manipulation attacks
|
|
292
|
+
- Applies to both `hasNestedPath()` and `setNestedValue()` functions
|
|
293
|
+
|
|
294
|
+
#### Dependency Updates
|
|
295
|
+
- Replaced `deep-diff` with `microdiff`
|
|
296
|
+
- `deep-diff` hasn't been updated since 2018 (unmaintained)
|
|
297
|
+
- `microdiff` is actively maintained with regular updates
|
|
298
|
+
- Smaller bundle size and simpler API
|
|
299
|
+
- Better TypeScript support
|
|
300
|
+
- Preserves primitive types without unnecessary string conversion
|
|
301
|
+
|
|
302
|
+
#### Type Safety Improvements
|
|
303
|
+
- Added generic types to `filterFields()`
|
|
304
|
+
- Better type inference for return values
|
|
305
|
+
- Conditional return type based on input (array vs object)
|
|
306
|
+
- Maintains type safety while keeping flexibility
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
### Added - Phase 6: Diff Command & Dry Run
|
|
310
|
+
|
|
311
|
+
#### Prompt Diff & Dry Run
|
|
312
|
+
- **`retell prompts diff <agent_id>`** - New command to show differences between local and remote prompts
|
|
313
|
+
- Compare prompts before applying updates
|
|
314
|
+
- Structured diff output with old/new values and change types
|
|
315
|
+
- Supports both retell-llm and conversation-flow agent types
|
|
316
|
+
- `--source` option for custom prompt directories
|
|
317
|
+
- `--fields` option for filtering diff output
|
|
318
|
+
- **`--dry-run` flag for `retell prompts update`** - Preview changes without applying them
|
|
319
|
+
- Shows same structured diff as `prompts diff` command
|
|
320
|
+
- Prevents accidental prompt updates
|
|
321
|
+
- Useful for validating changes before publishing
|
|
322
|
+
|
|
323
|
+
#### Shared Prompt Loading
|
|
324
|
+
- **`loadLocalPrompts()` utility** - Centralized prompt loading from local files
|
|
325
|
+
- Eliminates code duplication between diff and update commands (112 lines removed)
|
|
326
|
+
- Validates prompt directory structure
|
|
327
|
+
- Handles both retell-llm and conversation-flow formats
|
|
328
|
+
|
|
329
|
+
#### Enhanced Prompt Update Command
|
|
330
|
+
- Added dry-run capability to preview changes
|
|
331
|
+
- Improved error messages for type mismatches
|
|
332
|
+
- Better validation of local prompt files
|
|
333
|
+
|
|
334
|
+
#### AI Agent Workflows Documentation
|
|
335
|
+
- **`docs/ai-agent-workflows.md`** - Comprehensive best practices guide
|
|
336
|
+
- Safe prompt update workflows
|
|
337
|
+
- Token efficiency strategies
|
|
338
|
+
- Call analysis patterns
|
|
339
|
+
- Iterative refinement workflows
|
|
340
|
+
- Error handling guidelines
|
|
341
|
+
- Common automation patterns
|
|
342
|
+
|
|
343
|
+
**Use Cases:**
|
|
344
|
+
- **Prevent Accidental Updates** - See exactly what will change before pushing
|
|
345
|
+
- **AI Justification** - AI agents can explain changes by showing diffs
|
|
346
|
+
- **Code Review for Prompts** - Review prompt changes like code PRs
|
|
347
|
+
- **Debugging Support** - Compare local vs remote when troubleshooting
|
|
348
|
+
- **Audit Trail** - Document what changed and when
|
|
349
|
+
|
|
350
|
+
**Examples:**
|
|
351
|
+
```bash
|
|
352
|
+
# Compare local and remote prompts
|
|
353
|
+
retell prompts diff agent_123
|
|
354
|
+
|
|
355
|
+
# Preview changes before applying
|
|
356
|
+
retell prompts update agent_123 --dry-run
|
|
357
|
+
|
|
358
|
+
# Apply changes after review
|
|
359
|
+
retell prompts update agent_123
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
**Technical Details:**
|
|
363
|
+
- New services: `prompt-diff.ts`, `prompt-loader.ts`
|
|
364
|
+
- New command: `prompts/diff.ts`
|
|
365
|
+
- Enhanced: `prompts/update.ts` with dry-run support
|
|
366
|
+
- Code deduplication: Removed 112 duplicate lines
|
|
367
|
+
- No breaking changes - all new features are opt-in
|
|
368
|
+
|
|
369
|
+
|
|
8
370
|
## [1.0.0] - 2025-11-15
|
|
9
371
|
|
|
10
372
|
### Added
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/retell-cli)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Community-built command-line tool for Retell AI - designed to give AI assistants efficient access to transcripts, agents, and prompts without using context-expensive MCP servers.
|
|
7
7
|
|
|
8
8
|
## Features
|
|
9
9
|
|
|
@@ -94,15 +94,18 @@ retell transcripts analyze call_abc123
|
|
|
94
94
|
|
|
95
95
|
```bash
|
|
96
96
|
# Pull current prompts
|
|
97
|
-
retell prompts pull agent_123abc
|
|
97
|
+
retell prompts pull agent_123abc
|
|
98
|
+
|
|
99
|
+
# Edit .retell-prompts/agent_123abc/general_prompt.md with your changes
|
|
98
100
|
|
|
99
|
-
#
|
|
101
|
+
# Check what changed
|
|
102
|
+
retell prompts diff agent_123abc
|
|
100
103
|
|
|
101
|
-
#
|
|
102
|
-
retell prompts update agent_123abc --
|
|
104
|
+
# Dry run to preview changes
|
|
105
|
+
retell prompts update agent_123abc --dry-run
|
|
103
106
|
|
|
104
107
|
# Apply changes
|
|
105
|
-
retell prompts update agent_123abc
|
|
108
|
+
retell prompts update agent_123abc
|
|
106
109
|
|
|
107
110
|
# Publish the updated agent
|
|
108
111
|
retell agent-publish agent_123abc
|
|
@@ -234,6 +237,42 @@ retell prompts pull agent_123abc
|
|
|
234
237
|
retell prompts pull agent_123abc --output my-prompts.json
|
|
235
238
|
```
|
|
236
239
|
|
|
240
|
+
#### `retell prompts diff <agent_id> [options]`
|
|
241
|
+
|
|
242
|
+
Show differences between local and remote prompts before applying updates.
|
|
243
|
+
|
|
244
|
+
**Options:**
|
|
245
|
+
- `-s, --source <path>` - Source directory path (default: `.retell-prompts`)
|
|
246
|
+
- `-f, --fields <fields>` - Comma-separated list of fields to return
|
|
247
|
+
|
|
248
|
+
**Examples:**
|
|
249
|
+
```bash
|
|
250
|
+
# Compare local and remote prompts
|
|
251
|
+
retell prompts diff agent_123abc
|
|
252
|
+
|
|
253
|
+
# Use custom source directory
|
|
254
|
+
retell prompts diff agent_123abc --source ./custom-prompts
|
|
255
|
+
|
|
256
|
+
# Show only specific fields
|
|
257
|
+
retell prompts diff agent_123abc --fields has_changes,changes.general_prompt
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
**Output:**
|
|
261
|
+
```json
|
|
262
|
+
{
|
|
263
|
+
"agent_id": "agent_123abc",
|
|
264
|
+
"agent_type": "retell-llm",
|
|
265
|
+
"has_changes": true,
|
|
266
|
+
"changes": {
|
|
267
|
+
"general_prompt": {
|
|
268
|
+
"old": "You are a helpful assistant...",
|
|
269
|
+
"new": "You are a helpful assistant specializing in...",
|
|
270
|
+
"change_type": "modified"
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
237
276
|
#### `retell prompts update <agent_id> [options]`
|
|
238
277
|
|
|
239
278
|
Update agent prompts from a local file.
|
|
@@ -265,6 +304,134 @@ Publish a draft agent to make changes live.
|
|
|
265
304
|
retell agent-publish agent_123abc
|
|
266
305
|
```
|
|
267
306
|
|
|
307
|
+
### Field Selection
|
|
308
|
+
|
|
309
|
+
Reduce output size and token usage by selecting specific fields:
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
# Get only call_id and status
|
|
313
|
+
retell transcripts list --fields call_id,call_status
|
|
314
|
+
|
|
315
|
+
# Select nested fields with dot notation
|
|
316
|
+
retell transcripts get abc123 --fields metadata.duration,analysis.summary
|
|
317
|
+
|
|
318
|
+
# Combine with other options
|
|
319
|
+
retell agents list --limit 10 --fields agent_id,agent_name
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
**Supported commands:**
|
|
323
|
+
- All transcript commands (`list`, `get`, `analyze`)
|
|
324
|
+
- All agent commands (`list`, `info`)
|
|
325
|
+
|
|
326
|
+
**Features:**
|
|
327
|
+
- Dot notation for nested fields (e.g., `metadata.duration`)
|
|
328
|
+
- Works with arrays
|
|
329
|
+
- Reduces token usage by 50-90% for AI workflows
|
|
330
|
+
- Backward compatible (no --fields = full output)
|
|
331
|
+
|
|
332
|
+
### Raw Output Mode
|
|
333
|
+
|
|
334
|
+
Get the unmodified API response instead of enriched analysis:
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
# Raw API response (useful for debugging)
|
|
338
|
+
retell transcripts analyze abc123 --raw
|
|
339
|
+
|
|
340
|
+
# Combine with field selection for minimal output
|
|
341
|
+
retell transcripts analyze abc123 --raw --fields call_id,transcript_object
|
|
342
|
+
|
|
343
|
+
# Compare raw vs enriched
|
|
344
|
+
retell transcripts analyze abc123 --raw > raw.json
|
|
345
|
+
retell transcripts analyze abc123 > enriched.json
|
|
346
|
+
diff raw.json enriched.json
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
**When to use:**
|
|
350
|
+
- Debugging issues with API responses
|
|
351
|
+
- When tools expect the official Retell API schema
|
|
352
|
+
- Accessing new API fields before CLI enrichment support
|
|
353
|
+
- Comparing raw data to enriched output for validation
|
|
354
|
+
|
|
355
|
+
**Supported commands:**
|
|
356
|
+
- `transcripts analyze` - returns the raw [Call Object](https://docs.retellai.com/api-references/retrieve-call) exactly as documented in the Retell API reference
|
|
357
|
+
|
|
358
|
+
**Note:** The `--raw` flag works seamlessly with `--fields` for precise data extraction. Raw output returns the official Retell API schema, allowing you to access all fields documented in the [API reference](https://docs.retellai.com/api-references/list-calls).
|
|
359
|
+
|
|
360
|
+
### Hotspot Detection
|
|
361
|
+
|
|
362
|
+
Identify conversation issues for focused troubleshooting:
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
# Find all issues in a call
|
|
366
|
+
retell transcripts analyze abc123 --hotspots-only
|
|
367
|
+
|
|
368
|
+
# Combine with field selection
|
|
369
|
+
retell transcripts analyze abc123 --hotspots-only --fields hotspots
|
|
370
|
+
|
|
371
|
+
# Set custom thresholds
|
|
372
|
+
retell transcripts analyze abc123 --hotspots-only --latency-threshold 1500
|
|
373
|
+
retell transcripts analyze abc123 --hotspots-only --silence-threshold 3000
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
**Detected issues:**
|
|
377
|
+
- **Latency spikes** - When p90 latency exceeds threshold (default: 2000ms)
|
|
378
|
+
- **Long silences** - Gaps between turns exceeding threshold (default: 5000ms)
|
|
379
|
+
- **Sentiment** - Negative sentiment indicators
|
|
380
|
+
|
|
381
|
+
**Use cases:**
|
|
382
|
+
- Rapid troubleshooting of failed calls
|
|
383
|
+
- Prompt iteration and refinement
|
|
384
|
+
- Performance monitoring across calls
|
|
385
|
+
- AI agent workflow optimization
|
|
386
|
+
|
|
387
|
+
**Note:** The `--hotspots-only` flag works seamlessly with `--fields` for token efficiency.
|
|
388
|
+
|
|
389
|
+
### Search Transcripts
|
|
390
|
+
|
|
391
|
+
Find calls with advanced filtering - no need for jq or grep:
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
# Find all error calls
|
|
395
|
+
retell transcripts search --status error
|
|
396
|
+
|
|
397
|
+
# Find calls for specific agent in date range
|
|
398
|
+
retell transcripts search \
|
|
399
|
+
--agent-id agent_123 \
|
|
400
|
+
--since 2025-11-01 \
|
|
401
|
+
--until 2025-11-15
|
|
402
|
+
|
|
403
|
+
# Combine multiple filters
|
|
404
|
+
retell transcripts search \
|
|
405
|
+
--status error \
|
|
406
|
+
--agent-id agent_123 \
|
|
407
|
+
--since 2025-11-01 \
|
|
408
|
+
--limit 20
|
|
409
|
+
|
|
410
|
+
# Use field selection for minimal output
|
|
411
|
+
retell transcripts search \
|
|
412
|
+
--status error \
|
|
413
|
+
--fields call_id,call_status,agent_id
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
**Available filters:**
|
|
417
|
+
- `--status` - Call status (error, ended, ongoing)
|
|
418
|
+
- `--agent-id` - Filter by agent
|
|
419
|
+
- `--since` - Calls after date (YYYY-MM-DD or ISO format)
|
|
420
|
+
- `--until` - Calls before date (YYYY-MM-DD or ISO format)
|
|
421
|
+
- `--limit` - Max results (default: 50)
|
|
422
|
+
- `--fields` - Select specific fields (from Phase 2)
|
|
423
|
+
|
|
424
|
+
**AI Agent Workflow Example:**
|
|
425
|
+
```bash
|
|
426
|
+
# 1. Find all recent error calls
|
|
427
|
+
retell transcripts search --status error --since 2025-11-08 --fields call_id
|
|
428
|
+
|
|
429
|
+
# 2. For each call, get hotspots
|
|
430
|
+
retell transcripts analyze <call_id> --hotspots-only
|
|
431
|
+
|
|
432
|
+
# 3. No jq or grep needed - direct JSON parsing!
|
|
433
|
+
```
|
|
434
|
+
|
|
268
435
|
## Common Workflows
|
|
269
436
|
|
|
270
437
|
### Analyzing Failed Calls
|
|
@@ -319,7 +486,17 @@ jq -s '[.[] | .performance.latency_p50_ms.e2e] | add / length' analysis-*.json
|
|
|
319
486
|
|
|
320
487
|
## For AI Agents
|
|
321
488
|
|
|
322
|
-
All commands output JSON by default, making
|
|
489
|
+
**This CLI was specifically designed for AI assistants** to access Retell AI efficiently without the token overhead of MCP servers. All commands output JSON by default, making it perfect for Claude Code, Cursor, Aider, and other AI coding assistants.
|
|
490
|
+
|
|
491
|
+
### Why This Tool Exists
|
|
492
|
+
|
|
493
|
+
Traditional MCP (Model Context Protocol) servers can consume significant context windows when working with Retell AI data. This CLI provides a lightweight, token-efficient alternative that:
|
|
494
|
+
|
|
495
|
+
- **Reduces token usage by 50-90%** with field selection (`--fields`)
|
|
496
|
+
- **Provides structured JSON output** for easy parsing
|
|
497
|
+
- **Offers hotspot detection** for focused troubleshooting
|
|
498
|
+
- **Enables safe prompt updates** with diff and dry-run features
|
|
499
|
+
- **Works across all shells** (bash, zsh, fish) for maximum compatibility
|
|
323
500
|
|
|
324
501
|
### Example AI Workflow
|
|
325
502
|
|
|
@@ -331,12 +508,19 @@ retell transcripts list | jq '.[] | select(.call_status == "error")'
|
|
|
331
508
|
retell transcripts analyze call_123
|
|
332
509
|
|
|
333
510
|
# AI pulls current prompts
|
|
334
|
-
retell prompts pull agent_456
|
|
511
|
+
retell prompts pull agent_456
|
|
335
512
|
|
|
336
513
|
# AI reads and suggests improvements to prompts
|
|
337
|
-
#
|
|
338
|
-
|
|
339
|
-
|
|
514
|
+
# (Edits .retell-prompts/agent_456/general_prompt.md)
|
|
515
|
+
|
|
516
|
+
# AI shows what changed
|
|
517
|
+
retell prompts diff agent_456
|
|
518
|
+
|
|
519
|
+
# AI explains the changes and uses dry-run to verify
|
|
520
|
+
retell prompts update agent_456 --dry-run
|
|
521
|
+
|
|
522
|
+
# Apply changes
|
|
523
|
+
retell prompts update agent_456
|
|
340
524
|
retell agent-publish agent_456
|
|
341
525
|
```
|
|
342
526
|
|
|
@@ -467,4 +651,4 @@ If you encounter any issues or have questions:
|
|
|
467
651
|
|
|
468
652
|
---
|
|
469
653
|
|
|
470
|
-
Built
|
|
654
|
+
Built by the community for AI-assisted Retell AI development. Not affiliated with or endorsed by Retell AI.
|