@bland-ai/cli 0.1.0 → 0.1.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/README.md +516 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
# Bland CLI
|
|
2
|
+
|
|
3
|
+
The command-line interface for [Bland AI](https://bland.ai). Build, test, and deploy conversational AI agents from your terminal.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @bland-ai/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or run without installing:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx @bland-ai/cli
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Requires Node.js 18+.
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
### 1. Authenticate
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
bland auth login --key YOUR_API_KEY
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Or set the environment variable:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
export BLAND_API_KEY=your_key_here
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 2. Check your account
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
bland auth whoami
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 3. Make a call
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
bland call send +15551234567 --task "Ask if they're interested in a demo" --voice nat --wait
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 4. Build a pathway
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Scaffold a new project
|
|
49
|
+
bland pathway init ./my-pathway --name "Customer Support"
|
|
50
|
+
|
|
51
|
+
# Edit the YAML file in your editor
|
|
52
|
+
# Then push it to Bland
|
|
53
|
+
bland pathway push ./my-pathway
|
|
54
|
+
|
|
55
|
+
# Test it interactively
|
|
56
|
+
bland pathway chat <pathway_id> --verbose
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Commands
|
|
60
|
+
|
|
61
|
+
### Authentication
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
bland auth login # Log in with API key
|
|
65
|
+
bland auth login --key sk-... # Log in non-interactively
|
|
66
|
+
bland auth logout # Clear credentials
|
|
67
|
+
bland auth whoami # Show account info and balance
|
|
68
|
+
bland auth switch # Switch between profiles
|
|
69
|
+
bland auth profiles # List all saved profiles
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The CLI stores profiles in `~/.config/bland-cli/config.json`. You can have multiple profiles for different orgs or environments.
|
|
73
|
+
|
|
74
|
+
### Calls
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
bland call send <number> # Make an outbound call
|
|
78
|
+
--task <prompt> # What the AI should do
|
|
79
|
+
--pathway <id> # Use a pathway instead of a task
|
|
80
|
+
--voice <voice> # Voice selection (nat, josh, etc.)
|
|
81
|
+
--from <number> # Caller ID
|
|
82
|
+
--first-sentence <text> # Opening line
|
|
83
|
+
--model <base|turbo> # Model selection
|
|
84
|
+
--max-duration <mins> # Max call length
|
|
85
|
+
--wait # Wait and stream live transcript
|
|
86
|
+
--record # Enable recording
|
|
87
|
+
--transfer <number> # Transfer number
|
|
88
|
+
--request-data <json> # Variables to inject
|
|
89
|
+
--webhook <url> # Post-call webhook
|
|
90
|
+
|
|
91
|
+
bland call list # List recent calls
|
|
92
|
+
--limit <n> # Max results (default 20)
|
|
93
|
+
--status <s> # Filter: completed, active, failed
|
|
94
|
+
--from <date> # Start date
|
|
95
|
+
--to <date> # End date
|
|
96
|
+
--inbound # Only inbound calls
|
|
97
|
+
--batch <id> # Filter by batch
|
|
98
|
+
|
|
99
|
+
bland call get <call_id> # Full call details + transcript
|
|
100
|
+
bland call stop <call_id> # End an active call
|
|
101
|
+
bland call events <call_id> # View call events
|
|
102
|
+
bland call recording <call_id> # Get recording URL
|
|
103
|
+
--download # Save to local file
|
|
104
|
+
bland call analyze <call_id> # Run post-call analysis
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Pathways
|
|
108
|
+
|
|
109
|
+
The pathway workflow lets you define conversational flows as YAML files and sync them with the Bland API.
|
|
110
|
+
|
|
111
|
+
#### YAML Format
|
|
112
|
+
|
|
113
|
+
```yaml
|
|
114
|
+
name: "Customer Support"
|
|
115
|
+
description: "Handles inbound support calls"
|
|
116
|
+
version: draft
|
|
117
|
+
|
|
118
|
+
global:
|
|
119
|
+
voice: nat
|
|
120
|
+
model: base
|
|
121
|
+
|
|
122
|
+
nodes:
|
|
123
|
+
greeting:
|
|
124
|
+
type: default
|
|
125
|
+
prompt: |
|
|
126
|
+
Greet the customer warmly. Ask how you can help them today.
|
|
127
|
+
edges:
|
|
128
|
+
- target: identify_issue
|
|
129
|
+
condition: "Customer describes their problem"
|
|
130
|
+
- target: transfer_human
|
|
131
|
+
condition: "Customer asks for a human"
|
|
132
|
+
|
|
133
|
+
identify_issue:
|
|
134
|
+
type: default
|
|
135
|
+
prompt: |
|
|
136
|
+
Listen to the customer's issue and categorize it.
|
|
137
|
+
extract_variables:
|
|
138
|
+
- name: issue_type
|
|
139
|
+
type: string
|
|
140
|
+
description: "billing, technical, or general"
|
|
141
|
+
edges:
|
|
142
|
+
- target: billing_help
|
|
143
|
+
condition: "issue_type is billing"
|
|
144
|
+
- target: tech_help
|
|
145
|
+
condition: "issue_type is technical"
|
|
146
|
+
|
|
147
|
+
billing_help:
|
|
148
|
+
type: default
|
|
149
|
+
prompt: "Help with billing questions."
|
|
150
|
+
edges:
|
|
151
|
+
- target: goodbye
|
|
152
|
+
|
|
153
|
+
tech_help:
|
|
154
|
+
type: default
|
|
155
|
+
prompt: "Help with technical issues."
|
|
156
|
+
edges:
|
|
157
|
+
- target: goodbye
|
|
158
|
+
|
|
159
|
+
transfer_human:
|
|
160
|
+
type: transfer
|
|
161
|
+
number: "+15551234567"
|
|
162
|
+
|
|
163
|
+
goodbye:
|
|
164
|
+
type: end_call
|
|
165
|
+
prompt: "Thank the customer and end the call."
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
#### Pathway Commands
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# Project setup
|
|
172
|
+
bland pathway init [dir] # Scaffold a new pathway project
|
|
173
|
+
--name <name> # Pathway name
|
|
174
|
+
|
|
175
|
+
# Sync with Bland
|
|
176
|
+
bland pathway pull <id> [dir] # Download pathway as YAML
|
|
177
|
+
bland pathway push [dir] # Upload YAML to Bland
|
|
178
|
+
--create # Create new if no ID linked
|
|
179
|
+
bland pathway diff [dir] # Compare local vs remote
|
|
180
|
+
bland pathway validate [dir] # Validate YAML locally
|
|
181
|
+
bland pathway watch [dir] # Auto-push on file changes
|
|
182
|
+
|
|
183
|
+
# CRUD
|
|
184
|
+
bland pathway list # List all pathways
|
|
185
|
+
bland pathway get <id> # Show pathway details
|
|
186
|
+
bland pathway create [name] # Create a new pathway
|
|
187
|
+
--from-file <path> # Create from YAML file
|
|
188
|
+
bland pathway delete <id> # Delete a pathway
|
|
189
|
+
bland pathway duplicate <id> # Duplicate a pathway
|
|
190
|
+
|
|
191
|
+
# Interactive testing
|
|
192
|
+
bland pathway chat <id> # Chat with a pathway in your terminal
|
|
193
|
+
--start-node <name> # Start at a specific node
|
|
194
|
+
--variables <json> # Inject variables
|
|
195
|
+
--verbose # Show node transitions and variables
|
|
196
|
+
|
|
197
|
+
# Automated testing
|
|
198
|
+
bland pathway test <id> # Run YAML test cases
|
|
199
|
+
--file <test.yaml> # Test case file
|
|
200
|
+
--parallel <n> # Concurrent test runs
|
|
201
|
+
bland pathway simulate <id> # Run AI simulation
|
|
202
|
+
--scenario <text> # Scenario description
|
|
203
|
+
--count <n> # Number of simulations
|
|
204
|
+
|
|
205
|
+
# Node-level testing
|
|
206
|
+
bland pathway node test <pid> <nid> # Test a single node
|
|
207
|
+
--permutations <n> # Number of variations
|
|
208
|
+
|
|
209
|
+
# Versioning
|
|
210
|
+
bland pathway versions <id> # List versions
|
|
211
|
+
bland pathway promote <id> # Promote draft to production
|
|
212
|
+
|
|
213
|
+
# Code nodes
|
|
214
|
+
bland pathway code test <pid> <nid> # Test a custom code node
|
|
215
|
+
--input <json> # Test input data
|
|
216
|
+
|
|
217
|
+
# AI generation
|
|
218
|
+
bland pathway generate # Generate pathway from description
|
|
219
|
+
--description <text>
|
|
220
|
+
|
|
221
|
+
# Editing
|
|
222
|
+
bland pathway edit <id> # Edit a node prompt in $EDITOR
|
|
223
|
+
|
|
224
|
+
# Folders
|
|
225
|
+
bland pathway folder list
|
|
226
|
+
bland pathway folder create <name>
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
#### Test Cases Format
|
|
230
|
+
|
|
231
|
+
```yaml
|
|
232
|
+
pathway: "Customer Support"
|
|
233
|
+
tests:
|
|
234
|
+
- name: billing_inquiry
|
|
235
|
+
scenario: "Customer calls about a wrong charge on their bill."
|
|
236
|
+
expected_path: [greeting, identify_issue, billing_help, goodbye]
|
|
237
|
+
expected_variables:
|
|
238
|
+
issue_type: "billing"
|
|
239
|
+
|
|
240
|
+
- name: transfer_request
|
|
241
|
+
scenario: "Customer immediately asks to speak to a human."
|
|
242
|
+
expected_path: [greeting, transfer_human]
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Personas
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
bland persona list # List all personas
|
|
249
|
+
bland persona get <id> # Show persona details
|
|
250
|
+
bland persona create # Create interactively
|
|
251
|
+
bland persona update <id> # Update persona
|
|
252
|
+
bland persona delete <id> # Delete persona
|
|
253
|
+
bland persona promote <id> # Promote draft to production
|
|
254
|
+
bland persona reset-draft <id> # Reset draft to production
|
|
255
|
+
bland persona gaps <id> # View knowledge gaps
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Phone Numbers
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
bland number list # List owned numbers
|
|
262
|
+
bland number buy # Purchase a new number
|
|
263
|
+
--area-code <code> # Preferred area code
|
|
264
|
+
--country <code> # Country code (default: US)
|
|
265
|
+
--count <n> # Buy multiple
|
|
266
|
+
bland number release <number> # Release a number
|
|
267
|
+
bland number update <number> # Update number config
|
|
268
|
+
--pathway <id> # Set inbound pathway
|
|
269
|
+
--persona <id> # Set persona
|
|
270
|
+
--webhook <url> # Set webhook
|
|
271
|
+
--prompt <text> # Set prompt
|
|
272
|
+
--voice <voice> # Set voice
|
|
273
|
+
bland number configure <number> # Interactive configuration
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Voices
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
bland voice list # List available voices
|
|
280
|
+
--language <code> # Filter by language
|
|
281
|
+
--custom # Show only custom voices
|
|
282
|
+
bland voice speak <text> # Generate TTS audio
|
|
283
|
+
--voice <voice> # Voice to use (default: nat)
|
|
284
|
+
-o, --output <file> # Save to file
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Tools
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
bland tool list # List all tools
|
|
291
|
+
bland tool get <id> # Show tool details
|
|
292
|
+
bland tool create # Create interactively
|
|
293
|
+
bland tool update <id> # Update tool
|
|
294
|
+
bland tool delete <id> # Delete tool
|
|
295
|
+
bland tool test <id> # Test with sample input
|
|
296
|
+
--input <json> # Test input data
|
|
297
|
+
--verbose # Show full request/response
|
|
298
|
+
bland tool types # List tool types
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Knowledge Bases
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
bland knowledge list # List knowledge bases (alias: bland kb list)
|
|
305
|
+
bland knowledge create <name> # Create knowledge base
|
|
306
|
+
bland knowledge scrape <name> # Scrape URLs into KB
|
|
307
|
+
--urls <url1,url2> # Comma-separated URLs
|
|
308
|
+
--file <urls.txt> # File with URLs (one per line)
|
|
309
|
+
bland knowledge delete <id> # Delete knowledge base
|
|
310
|
+
bland knowledge status <id> # Check processing status
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Batch Campaigns
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
bland batch create # Create batch campaign
|
|
317
|
+
--file <contacts.csv> # Contacts CSV file
|
|
318
|
+
--pathway <id> # Pathway to use
|
|
319
|
+
--from <number> # From number
|
|
320
|
+
bland batch list # List batches
|
|
321
|
+
bland batch get <id> # Batch details + stats
|
|
322
|
+
bland batch stop <id> # Stop a running batch
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### SMS
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
bland sms send <number> # Send SMS
|
|
329
|
+
--from <number> # From number
|
|
330
|
+
--message <text> # Message text
|
|
331
|
+
--pathway <id> # Use pathway for conversation
|
|
332
|
+
bland sms conversations # List SMS conversations
|
|
333
|
+
bland sms get <id> # Get conversation thread
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### Other Commands
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
# Web agents
|
|
340
|
+
bland agent list | get | create | update | delete
|
|
341
|
+
|
|
342
|
+
# Guard rails
|
|
343
|
+
bland guard list | create | delete
|
|
344
|
+
|
|
345
|
+
# Monitoring
|
|
346
|
+
bland alarm list | create | delete
|
|
347
|
+
|
|
348
|
+
# Secrets
|
|
349
|
+
bland secret list | set | delete
|
|
350
|
+
|
|
351
|
+
# Releases
|
|
352
|
+
bland release list | create | promote
|
|
353
|
+
|
|
354
|
+
# Widgets
|
|
355
|
+
bland widget list | create | delete
|
|
356
|
+
|
|
357
|
+
# Evaluations
|
|
358
|
+
bland eval run | list | get
|
|
359
|
+
|
|
360
|
+
# Audio
|
|
361
|
+
bland audio generate <text> --voice <voice> -o <file>
|
|
362
|
+
bland audio analyze <file>
|
|
363
|
+
|
|
364
|
+
# SIP
|
|
365
|
+
bland sip discover <host>
|
|
366
|
+
|
|
367
|
+
# Local development
|
|
368
|
+
bland listen # Forward webhooks to localhost
|
|
369
|
+
--forward-to <url> # Your local server URL
|
|
370
|
+
--port <n> # Listen port (default: 4242)
|
|
371
|
+
--events <types> # Filter event types
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
## Profiles
|
|
375
|
+
|
|
376
|
+
The CLI supports multiple profiles for managing different API keys or organizations.
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
# Add a second profile
|
|
380
|
+
bland auth login --key sk-staging-xxx
|
|
381
|
+
|
|
382
|
+
# Switch between profiles
|
|
383
|
+
bland auth switch
|
|
384
|
+
|
|
385
|
+
# List profiles
|
|
386
|
+
bland auth profiles
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
Profiles are stored at `~/.config/bland-cli/config.json`. You can also override the API key per-command with `BLAND_API_KEY`:
|
|
390
|
+
|
|
391
|
+
```bash
|
|
392
|
+
BLAND_API_KEY=sk-staging-xxx bland pathway list
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
## Pathway Workflow
|
|
396
|
+
|
|
397
|
+
The typical development cycle for pathways:
|
|
398
|
+
|
|
399
|
+
```
|
|
400
|
+
1. bland pathway init ./my-bot # Scaffold project
|
|
401
|
+
2. Edit bland-pathway.yaml # Write your flow
|
|
402
|
+
3. bland pathway validate # Check for errors
|
|
403
|
+
4. bland pathway push --create # Upload to Bland
|
|
404
|
+
5. bland pathway chat <id> --verbose # Test interactively
|
|
405
|
+
6. bland pathway test <id> # Run automated tests
|
|
406
|
+
7. bland pathway promote <id> # Ship to production
|
|
407
|
+
8. bland pathway watch # Auto-push on save
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
## MCP Server
|
|
411
|
+
|
|
412
|
+
The CLI includes an MCP (Model Context Protocol) server that lets AI coding tools like Claude Code and Cursor interact with your Bland account.
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
# Start the MCP server
|
|
416
|
+
bland mcp
|
|
417
|
+
|
|
418
|
+
# Or with SSE transport
|
|
419
|
+
bland mcp --transport sse --port 3100
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
### Claude Code Setup
|
|
423
|
+
|
|
424
|
+
Add to your Claude Code config:
|
|
425
|
+
|
|
426
|
+
```json
|
|
427
|
+
{
|
|
428
|
+
"mcpServers": {
|
|
429
|
+
"bland": {
|
|
430
|
+
"command": "npx",
|
|
431
|
+
"args": ["@bland-ai/cli", "mcp"]
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
### Available MCP Tools
|
|
438
|
+
|
|
439
|
+
| Tool | What it does |
|
|
440
|
+
|------|-------------|
|
|
441
|
+
| `bland_call_send` | Make a phone call |
|
|
442
|
+
| `bland_call_list` | List recent calls |
|
|
443
|
+
| `bland_call_get` | Get call details and transcript |
|
|
444
|
+
| `bland_pathway_list` | List pathways |
|
|
445
|
+
| `bland_pathway_get` | Get pathway details |
|
|
446
|
+
| `bland_pathway_create` | Create a pathway from nodes/edges |
|
|
447
|
+
| `bland_pathway_chat` | Chat with a pathway |
|
|
448
|
+
| `bland_pathway_node_test` | Test a single node |
|
|
449
|
+
| `bland_persona_list` | List personas |
|
|
450
|
+
| `bland_persona_get` | Get persona details |
|
|
451
|
+
| `bland_number_list` | List phone numbers |
|
|
452
|
+
| `bland_number_buy` | Buy a phone number |
|
|
453
|
+
| `bland_voice_list` | List available voices |
|
|
454
|
+
| `bland_tool_test` | Test a custom tool |
|
|
455
|
+
| `bland_knowledge_list` | List knowledge bases |
|
|
456
|
+
| `bland_audio_generate` | Generate TTS audio |
|
|
457
|
+
|
|
458
|
+
## Local Webhook Development
|
|
459
|
+
|
|
460
|
+
Forward Bland webhooks to your local dev server without ngrok:
|
|
461
|
+
|
|
462
|
+
```bash
|
|
463
|
+
# Terminal 1: your app
|
|
464
|
+
node server.js
|
|
465
|
+
|
|
466
|
+
# Terminal 2: bland webhook forwarder
|
|
467
|
+
bland listen --forward-to http://localhost:3000/webhook
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
The CLI creates a webhook endpoint and forwards incoming events to your local URL, logging each event with timestamps and response codes.
|
|
471
|
+
|
|
472
|
+
## JSON Output
|
|
473
|
+
|
|
474
|
+
Every list and get command supports `--json` for piping to `jq` or scripts:
|
|
475
|
+
|
|
476
|
+
```bash
|
|
477
|
+
# Get all pathway IDs
|
|
478
|
+
bland pathway list --json | jq '.[].id'
|
|
479
|
+
|
|
480
|
+
# Get a call transcript as JSON
|
|
481
|
+
bland call get <id> --json | jq '.transcripts'
|
|
482
|
+
|
|
483
|
+
# Count active numbers
|
|
484
|
+
bland number list --json | jq 'length'
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
## Environment Variables
|
|
488
|
+
|
|
489
|
+
| Variable | Purpose |
|
|
490
|
+
|----------|---------|
|
|
491
|
+
| `BLAND_API_KEY` | API key (overrides stored profile) |
|
|
492
|
+
| `BLAND_BASE_URL` | API base URL (default: `https://api.bland.ai`) |
|
|
493
|
+
|
|
494
|
+
## Project Files
|
|
495
|
+
|
|
496
|
+
When you run `bland pathway init`, it creates:
|
|
497
|
+
|
|
498
|
+
```
|
|
499
|
+
my-pathway/
|
|
500
|
+
bland-pathway.yaml # Pathway definition
|
|
501
|
+
tests/
|
|
502
|
+
test-cases.yaml # Test cases
|
|
503
|
+
.blandrc # Project config (pathway ID, file paths)
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
The `.blandrc` file links your local project to a remote pathway:
|
|
507
|
+
|
|
508
|
+
```yaml
|
|
509
|
+
pathway_id: pw_abc123
|
|
510
|
+
pathway_file: bland-pathway.yaml
|
|
511
|
+
test_file: tests/test-cases.yaml
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
## License
|
|
515
|
+
|
|
516
|
+
MIT
|