@botpress/adk-cli 1.19.0-beta.4 → 1.19.0-beta.5

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 (65) hide show
  1. package/dist/{README-wjb7z7f0.md → README-824wa4jj.md} +1 -1
  2. package/dist/SKILL-75ym6tcj.md +257 -0
  3. package/dist/SKILL-chnwzmt1.md +548 -0
  4. package/dist/SKILL-d4bs53y3.md +244 -0
  5. package/dist/SKILL-h4b2f1n9.md +114 -0
  6. package/dist/SKILL-hbw5nt95.md +111 -0
  7. package/dist/actions-h7hxxvxr.md +823 -0
  8. package/dist/adk-build-emhwd0tg.md +39 -0
  9. package/dist/adk-debug-yrrdtpmb.md +23 -0
  10. package/dist/adk-dev-console-7z9rtjpy.md +17 -0
  11. package/dist/adk-document-ras6zzzh.md +68 -0
  12. package/dist/adk-eval-vx76dwq0.md +17 -0
  13. package/dist/adk-explain-fcsaw852.md +22 -0
  14. package/dist/adk-init-9kmxmbbe.md +30 -0
  15. package/dist/adk-ship-dybzn884.md +29 -0
  16. package/dist/adk-test-xq67savs.md +27 -0
  17. package/dist/adk-validate-1p4skv4m.md +31 -0
  18. package/dist/advanced-patterns-z86m9h1a.md +669 -0
  19. package/dist/agent-config-1aqvkrgf.md +450 -0
  20. package/dist/agent-steps-zj4c1n9t.md +115 -0
  21. package/dist/assets-q7jt8r2q.md +237 -0
  22. package/dist/autonomous-execution-fymc12e5.md +747 -0
  23. package/dist/cli-c31e06yr.md +1334 -0
  24. package/dist/cli.js +970 -566
  25. package/dist/commands.json +24 -3
  26. package/dist/common-failures-ht29w2db.md +231 -0
  27. package/dist/component-registry-bbpw0see.md +43 -0
  28. package/dist/context-api-760cvh0h.md +461 -0
  29. package/dist/conversation-analysis-8ka4nrm4.md +420 -0
  30. package/dist/conversation-lifecycle-4seqqjc1.md +311 -0
  31. package/dist/conversations-gwfvxaee.md +1111 -0
  32. package/dist/custom-components-y5wdgpey.md +167 -0
  33. package/dist/debug-workflow-vz84q80v.md +239 -0
  34. package/dist/desk-k54ktvsd.md +852 -0
  35. package/dist/doc-standards-ck6ax2jd.md +124 -0
  36. package/dist/eval-format-7n9brja4.md +354 -0
  37. package/dist/evals-y1zcr1mc.md +11 -0
  38. package/dist/explain-config-1yaq3zzd.md +424 -0
  39. package/dist/files-dzt0wxn3.md +918 -0
  40. package/dist/integration-actions-xang7tma.md +659 -0
  41. package/dist/integrations-k5ss07f4.md +266 -0
  42. package/dist/interfaces-6t0bpxs4.md +97 -0
  43. package/dist/knowledge-bases-20rg8p5c.md +456 -0
  44. package/dist/llm-debugging-76ng8rzm.md +209 -0
  45. package/dist/mcp-server-n1asyzhv.md +112 -0
  46. package/dist/messages-gkkg0b54.md +769 -0
  47. package/dist/model-configuration-f273kgd0.md +201 -0
  48. package/dist/multi-agent-dashboard-1mdfjdts.md +70 -0
  49. package/dist/pages-xn18xn73.md +273 -0
  50. package/dist/patterns-mistakes-5vb99dhf.md +469 -0
  51. package/dist/plugins-ttnx8f49.md +280 -0
  52. package/dist/tables-x45t36dd.md +1136 -0
  53. package/dist/tags-46td3qrg.md +516 -0
  54. package/dist/test-patterns-hj47w4nc.md +355 -0
  55. package/dist/testing-workflow-2vkp932f.md +225 -0
  56. package/dist/tools-wk7bq24z.md +581 -0
  57. package/dist/trace-summarization-hdyx1c2e.md +313 -0
  58. package/dist/traces-and-logs-f2kjfh19.md +203 -0
  59. package/dist/triggers-4j2cc86x.md +719 -0
  60. package/dist/ui-server-entry.js +952 -137
  61. package/dist/workflow-steps-mrdrf1c5.md +851 -0
  62. package/dist/workflows-gadx3s69.md +1408 -0
  63. package/dist/zai-agent-reference-e6644aad.md +454 -0
  64. package/dist/zai-complete-guide-mnna5d6f.md +1408 -0
  65. package/package.json +4 -4
@@ -0,0 +1,450 @@
1
+ # Configuration
2
+
3
+ Configure your bot's behavior, integrations, dependencies, and global state through the unified `agent.config.ts` file.
4
+
5
+ ## agent.config.ts
6
+
7
+ The main configuration file defines your bot's core settings, AI models, dependencies, and state schemas.
8
+
9
+ ### Configuration Example
10
+
11
+ ```typescript
12
+ import { defineConfig, z } from "@botpress/runtime";
13
+
14
+ export default defineConfig({
15
+ name: "customer-support-bot",
16
+ description: "Customer support assistant with knowledge base",
17
+
18
+ // AI Model Configuration
19
+ defaultModels: {
20
+ autonomous: "openai:gpt-4o", // For execute() function
21
+ zai: "openai:gpt-4o-mini", // For zai operations
22
+ },
23
+
24
+ // User State Schema
25
+ user: {
26
+ state: z.object({
27
+ preferredLanguage: z.enum(["en", "es", "fr", "de"]).default("en"),
28
+ timezone: z.string().default("UTC"),
29
+ name: z.string().optional(),
30
+ email: z.string().email().optional(),
31
+ notificationsEnabled: z.boolean().default(true),
32
+ accountTier: z.enum(["free", "pro", "enterprise"]).default("free"),
33
+ metadata: z.object({}).passthrough().default({}),
34
+ }),
35
+ },
36
+
37
+ // Bot Global State Schema
38
+ bot: {
39
+ state: z.object({
40
+ version: z.number().default(1),
41
+ maintenanceMode: z.boolean().default(false),
42
+
43
+ // Feature flags
44
+ features: z.object({
45
+ advancedSearch: z.boolean().default(false),
46
+ multiLanguage: z.boolean().default(true),
47
+ }).default({}),
48
+
49
+ // Analytics
50
+ totalConversations: z.number().default(0),
51
+ totalUsers: z.number().default(0),
52
+ }),
53
+ },
54
+
55
+ // Integrations are managed via lock files (dependencies.dev.lock.json / dependencies.prod.lock.json)
56
+ // Use `adk integrations add/remove/configure` to manage them — see integrations.md
57
+ });
58
+ ```
59
+
60
+ ### Additional Configuration Fields
61
+
62
+ #### Tags
63
+
64
+ Tags are key-value pairs for categorizing entities. All entities (`user`, `bot`, `conversation`, `message`, `workflow`) support tags. See **[Tags](./tags.md)** for complete documentation.
65
+
66
+ #### Bot Configuration Schema
67
+
68
+ Define a custom configuration schema for bot-level settings accessible via the Context API:
69
+
70
+ ```typescript
71
+ export default defineConfig({
72
+ name: "my-bot",
73
+
74
+ configuration: {
75
+ schema: z.object({
76
+ maxRetries: z.number().default(3),
77
+ apiEndpoint: z.string(),
78
+ featureFlags: z.object({
79
+ enableBetaFeatures: z.boolean().default(false),
80
+ }),
81
+ }),
82
+ },
83
+ });
84
+ ```
85
+
86
+ Access via direct import from `@botpress/runtime`:
87
+
88
+ ```typescript
89
+ import { configuration } from "@botpress/runtime";
90
+
91
+ if (configuration.featureFlags.enableBetaFeatures) {
92
+ // Use beta features
93
+ }
94
+ ```
95
+
96
+ See **[Context API](./context-api.md)** for details on accessing other runtime values.
97
+
98
+ ### Model Configuration
99
+
100
+ **Default Models:**
101
+
102
+ If you don't specify `defaultModels`, the ADK uses these defaults:
103
+ - `zai`: `"openai:gpt-4.1-2025-04-14"`
104
+ - `autonomous`: `"openai:gpt-4.1-mini-2025-04-14"`
105
+
106
+ **Available Models:**
107
+
108
+ ```typescript
109
+ // OpenAI
110
+ "openai:gpt-4o"
111
+ "openai:gpt-4o-mini"
112
+ "openai:gpt-4-turbo"
113
+ "openai:gpt-4.1-2025-04-14"
114
+ "openai:gpt-4.1-mini-2025-04-14"
115
+
116
+ // Anthropic
117
+ "anthropic:claude-3-5-sonnet"
118
+ "anthropic:claude-3-opus"
119
+ "anthropic:claude-3-haiku"
120
+
121
+ // Google
122
+ "google:gemini-1.5-pro"
123
+ "google:gemini-1.5-flash"
124
+ ```
125
+
126
+ **Model Fallback Arrays:**
127
+
128
+ You can specify multiple models as fallbacks:
129
+
130
+ ```typescript
131
+ defaultModels: {
132
+ autonomous: [
133
+ "openai:gpt-4o",
134
+ "anthropic:claude-3-5-sonnet",
135
+ "openai:gpt-4o-mini"
136
+ ],
137
+ zai: "openai:gpt-4o-mini"
138
+ }
139
+ ```
140
+
141
+ ### Accessing Configuration
142
+
143
+ ```typescript
144
+ import { bot, user } from "@botpress/runtime";
145
+
146
+ // In any handler (action, workflow, conversation)
147
+
148
+ // Access bot state
149
+ const version = bot.state.version;
150
+ const maintenanceMode = bot.state.maintenanceMode;
151
+
152
+ // Modify bot state
153
+ bot.state.totalConversations += 1;
154
+ bot.state.features.advancedSearch = true;
155
+
156
+ // Access user state
157
+ const language = user.state.preferredLanguage;
158
+ const tier = user.state.accountTier;
159
+
160
+ // Modify user state
161
+ user.state.lastActiveDate = new Date();
162
+ user.state.metadata.lastQuery = "product pricing";
163
+ ```
164
+
165
+ ## Dependencies (Integrations, Plugins, Interfaces)
166
+
167
+ Integration state lives in per-environment lock files at the project root, not in `agent.config.ts`:
168
+
169
+ - `dependencies.dev.lock.json` — development environment
170
+ - `dependencies.prod.lock.json` — production environment
171
+
172
+ Cloud is the source of truth. Lock files are local reflections refreshed after every mutation. Never edit lock files by hand.
173
+
174
+ > **Migration:** Projects with a legacy `dependencies` block in `agent.config.ts` are auto-migrated to lock files on the first CLI command.
175
+
176
+ ### Managing Dependencies
177
+
178
+ Use the `adk integrations` CLI subcommands. See **[CLI Reference](./cli.md)** and **[Integrations](./integrations.md)** for full details:
179
+
180
+ ```bash
181
+ adk integrations search <query> # Search for integrations
182
+ adk integrations add <name>@<version> # Add integration
183
+ adk integrations configure <alias> --set key=value # Configure
184
+ adk integrations enable <alias> # Enable
185
+ adk integrations remove <alias> # Remove
186
+ adk integrations upgrade [alias] # Upgrade
187
+ adk integrations list # List installed
188
+ ```
189
+
190
+ ### Using Integration Actions
191
+
192
+ See **[Integration Actions](./integration-actions.md)** for calling integration functionality from your code.
193
+
194
+ ## Environment Variables
195
+
196
+ ### .env File
197
+
198
+ ```bash
199
+ # Bot Configuration
200
+ BOT_NAME=customer-support-bot
201
+ NODE_ENV=development
202
+
203
+ # API Keys
204
+ OPENAI_API_KEY=sk-...
205
+ ANTHROPIC_API_KEY=sk-ant-...
206
+
207
+ # Integration Tokens
208
+ SLACK_BOT_TOKEN=xoxb-...
209
+ LINEAR_API_KEY=lin_api_...
210
+
211
+ # ADK Development (CLI-specific)
212
+ ADK_DEV_PORT=3000 # Bot port (default: 3000)
213
+ ADK_CONSOLE_PORT=3001 # UI console port (default: 3001)
214
+ DEBUG=adk:* # Enable ADK debug logs
215
+
216
+ # Feature Flags (optional)
217
+ ENABLE_ADVANCED_SEARCH=true
218
+
219
+ # External Services (optional)
220
+ WEBHOOK_URL=https://api.example.com/webhooks
221
+ ```
222
+
223
+ ### Accessing Environment Variables
224
+
225
+ ```typescript
226
+ // In configuration
227
+ export default defineConfig({
228
+ name: process.env.BOT_NAME || "my-bot",
229
+
230
+ defaultModels: {
231
+ autonomous: process.env.AI_MODEL || "openai:gpt-4o",
232
+ },
233
+ });
234
+
235
+ // In handlers
236
+ export const myAction = new Action({
237
+ async handler({ input }) {
238
+ const apiKey = process.env.EXTERNAL_API_KEY;
239
+
240
+ if (!apiKey) {
241
+ throw new Error("EXTERNAL_API_KEY not configured");
242
+ }
243
+
244
+ // Use the API key
245
+ const response = await fetch("https://api.example.com", {
246
+ headers: { Authorization: `Bearer ${apiKey}` },
247
+ });
248
+ },
249
+ });
250
+ ```
251
+
252
+ ## State Management Patterns
253
+
254
+ ### User State Patterns
255
+
256
+ ```typescript
257
+ // Progressive profile building
258
+ export const Chat = new Conversation({
259
+ async handler({ message, conversation, execute }) {
260
+ // Collect user info progressively
261
+ if (!user.state.name && message?.type === "text") {
262
+ user.state.name = extractName(message.payload.text);
263
+ }
264
+
265
+ if (!user.state.email) {
266
+ // Ask for email if needed
267
+ await conversation.send({
268
+ type: "text",
269
+ payload: { text: "What's your email address?" },
270
+ });
271
+ }
272
+
273
+ // Use preferences
274
+ const language = user.state.preferredLanguage;
275
+ await execute({
276
+ instructions: `Respond in ${language}`,
277
+ });
278
+ },
279
+ });
280
+ ```
281
+
282
+ ### Bot State Patterns
283
+
284
+ ```typescript
285
+ export const Chat = new Conversation({
286
+ async handler({ conversation }) {
287
+ // Feature flag checking
288
+ if (bot.state.features.advancedSearch) {
289
+ // Use advanced search
290
+ const results = await advancedSearch(query);
291
+ } else {
292
+ // Use basic search
293
+ const results = await basicSearch(query);
294
+ }
295
+
296
+ // Maintenance mode
297
+ if (bot.state.maintenanceMode) {
298
+ await conversation.send({
299
+ type: "text",
300
+ payload: {
301
+ text: "The bot is currently under maintenance. Please try again later.",
302
+ },
303
+ });
304
+ return;
305
+ }
306
+
307
+ // Business hours check (example)
308
+ const supportHours = "9:00 AM to 5:00 PM EST";
309
+ await conversation.send({
310
+ type: "text",
311
+ payload: { text: `Our support hours are ${supportHours}` },
312
+ });
313
+ },
314
+ });
315
+ ```
316
+
317
+ ## Best Practices
318
+
319
+ ### 1. Use Environment Variables for Secrets
320
+
321
+ ```typescript
322
+ // ❌ Bad - hardcoded secrets
323
+ config: {
324
+ apiKey: "sk-abc123def456";
325
+ }
326
+
327
+ // ✅ Good - environment variable
328
+ config: {
329
+ apiKey: process.env.OPENAI_API_KEY;
330
+ }
331
+ ```
332
+
333
+ ### 2. Validate Configuration
334
+
335
+ ```typescript
336
+ export default defineConfig({
337
+ name: validateBotName(process.env.BOT_NAME),
338
+
339
+ user: {
340
+ state: z.object({
341
+ // Use strict validation
342
+ email: z.string().email(),
343
+ age: z.number().int().min(0).max(150),
344
+ }),
345
+ },
346
+ });
347
+ ```
348
+
349
+ ### 3. Provide Defaults
350
+
351
+ ```typescript
352
+ user: {
353
+ state: z.object({
354
+ // Always provide sensible defaults
355
+ language: z.string().default("en"),
356
+ notifications: z.boolean().default(true),
357
+ theme: z.enum(["light", "dark"]).default("light"),
358
+ });
359
+ }
360
+ ```
361
+
362
+ ### 4. Document State Schema
363
+
364
+ ```typescript
365
+ bot: {
366
+ state: z.object({
367
+ /**
368
+ * Current version of the bot configuration
369
+ * Increment when making breaking changes
370
+ */
371
+ version: z.number().default(1),
372
+
373
+ /**
374
+ * Feature flags for gradual rollout
375
+ * @example { "newUI": true, "betaFeatures": false }
376
+ */
377
+ features: z.record(z.boolean()).default({}),
378
+ });
379
+ }
380
+ ```
381
+
382
+ ### 5. Separate Concerns
383
+
384
+ ```typescript
385
+ // Separate configuration by domain
386
+ const userConfig = {
387
+ state: userStateSchema,
388
+ };
389
+
390
+ const botConfig = {
391
+ state: botStateSchema,
392
+ };
393
+
394
+ const integrationConfig = {
395
+ slack: slackConfig,
396
+ discord: discordConfig,
397
+ };
398
+
399
+ export default defineConfig({
400
+ ...baseConfig,
401
+ user: userConfig,
402
+ bot: botConfig,
403
+ });
404
+ ```
405
+
406
+ ## Project Files
407
+
408
+ ### agent.json
409
+
410
+ The `agent.json` file stores bot and workspace IDs for deployment. This file is automatically created by `adk link` or `adk dev`.
411
+
412
+ ```json
413
+ {
414
+ "botId": "bot_abc123",
415
+ "workspaceId": "ws_xyz789",
416
+ "devId": "bot_dev_123"
417
+ }
418
+ ```
419
+
420
+ **Fields:**
421
+
422
+ - `botId` - Production bot ID (used by `adk deploy`)
423
+ - `workspaceId` - Workspace ID
424
+ - `devId` - Development bot ID (used by `adk dev`)
425
+
426
+ **Important:**
427
+
428
+ - Add `agent.json` to `.gitignore` if you do not want environment-specific IDs committed
429
+ - Each developer/environment can have different IDs
430
+ - Created automatically by `adk link` or `adk dev`
431
+ - Current scaffolds do not add `agent.json` to `.gitignore` automatically
432
+
433
+ ### package.json
434
+
435
+ Standard Node.js package file with ADK-specific scripts.
436
+
437
+ ```json
438
+ {
439
+ "scripts": {
440
+ "dev": "adk dev",
441
+ "build": "adk build",
442
+ "deploy": "adk deploy"
443
+ },
444
+ "dependencies": {
445
+ "@botpress/runtime": "workspace:*"
446
+ }
447
+ }
448
+ ```
449
+
450
+ See **[CLI Reference](./cli.md)** for complete command documentation.
@@ -0,0 +1,115 @@
1
+ # Agent Steps
2
+
3
+ Agent Steps is the execution visualizer on the right side of the **Chat** page. It shows exactly what the agent did to process each conversation message — in real time.
4
+
5
+ ## What Users See
6
+
7
+ When a user sends a message in the webchat (left panel), the Agent Steps panel (right panel) shows the execution flow as a sequence of collapsible cards:
8
+
9
+ ```
10
+ ┌─ User Message: "Help me with order #123"
11
+ │
12
+ ├─ 🤖 Bot Handler (onWebchatConversation)
13
+ │ ├─ Iteration 1
14
+ │ │ ├─ 🟣 Tool: lookupOrder (input: {orderId: "123"})
15
+ │ │ └─ → continued
16
+ │ ├─ Iteration 2
17
+ │ │ ├─ 🔵 Message: "I found order #123. It was shipped yesterday..."
18
+ │ │ └─ → message_sent
19
+ │ └─ 🟢 State: conversation.lastOrderId = "123"
20
+ │
21
+ └─ Total: 2 iterations, $0.0034, 1.2s
22
+ ```
23
+
24
+ ## Data Model
25
+
26
+ ### Turns
27
+
28
+ A **Turn** is one conversation exchange — from the user's input through the agent's complete response. Each turn contains:
29
+
30
+ - **User message** or **event** that triggered processing
31
+ - **Handler span** — the conversation/event/trigger handler that processed it
32
+ - **Steps** — autonomous iterations (the agent's think-decide-act loops)
33
+ - **Direct messages** — messages sent outside iterations
34
+ - **State mutations** — state changes made during the turn
35
+ - **Total cost** — aggregated AI cost across all iterations
36
+
37
+ ### Steps (Autonomous Iterations)
38
+
39
+ Each **Step** is one iteration of the autonomous agent loop. The agent:
40
+ 1. Receives context (conversation history, available tools)
41
+ 2. Makes an LLM call (the **cognitive request**)
42
+ 3. Decides what to do: call a tool, send a message, or stop
43
+
44
+ Each step shows:
45
+ - **Iteration number** (1, 2, 3...)
46
+ - **Exit reason**: "continued" (more work to do), "tool_called", "message_sent", "errored"
47
+ - **Cognitive request** metadata: model, input/output tokens, cost, duration
48
+ - **Tools called** in this iteration
49
+ - **Messages sent** in this iteration
50
+
51
+ ### Tool Calls
52
+
53
+ Displayed as **violet cards** (or green for `search_knowledge`). Each shows:
54
+ - Tool name
55
+ - Input (JSON)
56
+ - Output (JSON or markdown for knowledge search results)
57
+ - Duration
58
+ - Status (ok / error / running)
59
+
60
+ ### Bot Messages
61
+
62
+ Displayed as **blue cards**. Each shows:
63
+ - Message content (markdown rendered)
64
+ - Duration
65
+ - Long messages are clamped at 300 characters — click to expand
66
+
67
+ ### State Mutations
68
+
69
+ Displayed as **teal cards**. Each shows:
70
+ - State type (bot, user, conversation)
71
+ - Two-column "Before" and "After" view
72
+ - Only changed keys shown by default (toggle for full state)
73
+ - JSON tree view for complex objects
74
+
75
+ ### Trigger Handlers
76
+
77
+ When a trigger fires instead of a conversation message, the turn shows an **amber card** with:
78
+ - Trigger name
79
+ - Event type that fired it
80
+ - Same iteration/tool/message structure inside
81
+
82
+ ## Status Indicators
83
+
84
+ | Visual | Meaning |
85
+ |--------|---------|
86
+ | ✓ Green checkmark | Completed successfully |
87
+ | ✗ Red X | Failed (error message in detail panel) |
88
+ | ⟳ Blue spinner | Currently executing |
89
+ | Shimmer text ("thinking...") | LLM is generating |
90
+
91
+ ## AI Metrics
92
+
93
+ Each iteration's cognitive request shows:
94
+ - **Model**: e.g., "claude-3.5-sonnet"
95
+ - **Input tokens**: count + cost
96
+ - **Output tokens**: count + cost
97
+ - **Total cost**: USD with 4 decimal places
98
+ - **Duration**: milliseconds
99
+
100
+ Turn-level cost is the sum of all iteration costs.
101
+
102
+ ## Interactions
103
+
104
+ - **Collapse/Expand**: Click any card to toggle children. "Collapse All" / "Expand All" buttons in header.
105
+ - **Detail Panel**: Click a step to open a resizable detail panel on the right with full span data.
106
+ - **Copy**: Copy buttons on IDs, tokens, error messages.
107
+ - **Open Traces**: "Open conversation traces" link in the header navigates to the full Traces page filtered to this conversation.
108
+
109
+ ## Real-Time Updates
110
+
111
+ Agent Steps streams data via SSE (Server-Sent Events):
112
+ - Running spans show a live timer
113
+ - New spans animate in from the top
114
+ - Auto-scrolls to bottom when new content arrives
115
+ - Stale detection marks spans as errored if the CLI stops sending updates for 5+ seconds