@botpress/adk 2.0.0-alpha.1 → 2.0.1-beta.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/dist/agent0/capabilities/commands/adk-ship.md +3 -2
- package/dist/agent0/capabilities/commands/adk-validate.md +1 -1
- package/dist/agent0/capabilities/skills/adk/SKILL.md +19 -9
- package/dist/agent0/capabilities/skills/adk/references/actions.md +2 -0
- package/dist/agent0/capabilities/skills/adk/references/agent-config.md +25 -15
- package/dist/agent0/capabilities/skills/adk/references/cli.md +134 -41
- package/dist/agent0/capabilities/skills/adk/references/context-api.md +2 -0
- package/dist/agent0/capabilities/skills/adk/references/conversations.md +21 -0
- package/dist/agent0/capabilities/skills/adk/references/explain-config.md +2 -2
- package/dist/agent0/capabilities/skills/adk/references/integrations.md +39 -25
- package/dist/agent0/capabilities/skills/adk/references/interfaces.md +1 -1
- package/dist/agent0/capabilities/skills/adk/references/knowledge-bases.md +4 -4
- package/dist/agent0/capabilities/skills/adk/references/mcp-server.md +1 -1
- package/dist/agent0/capabilities/skills/adk/references/patterns-mistakes.md +16 -0
- package/dist/agent0/capabilities/skills/adk/references/plugins.md +28 -30
- package/dist/agent0/capabilities/skills/adk/references/tables.md +13 -26
- package/dist/agent0/capabilities/skills/adk/references/tools.md +2 -0
- package/dist/agent0/capabilities/skills/adk/references/triggers.md +16 -12
- package/dist/agent0/capabilities/skills/adk/references/workflows.md +2 -0
- package/dist/agent0/capabilities/skills/adk-debugger/references/common-failures.md +4 -4
- package/dist/agent0/capabilities/skills/adk-debugger/references/debug-workflow.md +11 -11
- package/dist/agent0/capabilities/skills/adk-dev-console/SKILL.md +5 -0
- package/dist/agent0/capabilities/skills/adk-dev-console/references/pages.md +14 -0
- package/dist/agent0/index.js +44 -9
- package/dist/agent0/index.js.map +5 -5
- package/dist/agent0/runtime/client.d.ts.map +1 -1
- package/dist/agent0/types.d.ts +5 -0
- package/dist/agent0/types.d.ts.map +1 -1
- package/dist/bot-generator/generator.d.ts.map +1 -1
- package/dist/commands/bp-dev-command.d.ts.map +1 -1
- package/dist/config/manager.d.ts.map +1 -1
- package/dist/dependencies/dependency-manager.d.ts +4 -0
- package/dist/dependencies/dependency-manager.d.ts.map +1 -1
- package/dist/dependencies/index.js +19 -3
- package/dist/dependencies/index.js.map +4 -4
- package/dist/deploy-manifest/index.d.ts.map +1 -1
- package/dist/generators/table-types.d.ts +1 -0
- package/dist/generators/table-types.d.ts.map +1 -1
- package/dist/index.js +54 -14
- package/dist/index.js.map +11 -10
- package/dist/utils/schema-serialization.d.ts +2 -0
- package/dist/utils/schema-serialization.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
# Integration Management
|
|
2
2
|
|
|
3
|
-
Integrations connect your agent to external platforms and services. Manage them
|
|
3
|
+
Integrations connect your agent to external platforms and services. Manage them through the CLI or Dev Console — never hand-edit dependency snapshots.
|
|
4
4
|
|
|
5
5
|
## CLI Commands
|
|
6
6
|
|
|
7
7
|
All integration management uses the `adk integrations` subcommand family. Every mutation command supports `--target <env>` (dev or prod, default: dev) and `--format <format>` (text or json).
|
|
8
8
|
|
|
9
|
-
> **
|
|
9
|
+
> **Removed aliases:** The old flat commands (`adk add`, `adk remove`, `adk search`, `adk list`, `adk info`, `adk upgrade`) are no longer part of the public CLI. Use the `adk integrations` subcommands instead.
|
|
10
10
|
|
|
11
11
|
### Discovery
|
|
12
12
|
|
|
13
|
-
| Command
|
|
14
|
-
|
|
|
15
|
-
| `adk integrations search <query>`
|
|
16
|
-
| `adk integrations
|
|
17
|
-
| `adk integrations list`
|
|
18
|
-
| `adk integrations info <name>`
|
|
13
|
+
| Command | Description | Key Flags |
|
|
14
|
+
| -------------------------------------------- | ------------------------------------------------- | ---------------------------- |
|
|
15
|
+
| `adk integrations search <query>` | Search Hub integrations by keyword | `--format json` |
|
|
16
|
+
| `adk integrations search --interface <name>` | Find Hub integrations that implement an interface | `--format json` |
|
|
17
|
+
| `adk integrations list` | Show installed dependencies | `--format json`, `--verbose` |
|
|
18
|
+
| `adk integrations info <name[@version]>` | Full integration details | `--format json` |
|
|
19
19
|
|
|
20
20
|
Use `--format json` for programmatic inspection of config schemas, action shapes, and event payloads.
|
|
21
21
|
|
|
@@ -30,26 +30,28 @@ Use `--format json` for programmatic inspection of config schemas, action shapes
|
|
|
30
30
|
| `adk integrations disable <alias>` | Disable without removing | `--target <env>` |
|
|
31
31
|
| `adk integrations configure <alias>` | Set or unset config values | `--set key=value`, `--unset key`, `--target <env>` |
|
|
32
32
|
|
|
33
|
-
### State
|
|
33
|
+
### State Inspection and Promotion
|
|
34
34
|
|
|
35
|
-
| Command
|
|
36
|
-
|
|
|
37
|
-
| `adk integrations
|
|
38
|
-
| `adk integrations
|
|
39
|
-
| `adk integrations
|
|
40
|
-
| `adk integrations diff` | Show differences between lock file and cloud | `--target <env>` |
|
|
35
|
+
| Command | Description | Key Flags |
|
|
36
|
+
| ------------------------- | ------------------------------------------- | -------------------------------------------------- |
|
|
37
|
+
| `adk integrations status` | Show capability state and remediation | `--target <env>`, `--format json` |
|
|
38
|
+
| `adk integrations copy` | Copy integration state between environments | `--from <env>`, `--to <env>`, `--dry-run`, `--yes` |
|
|
39
|
+
| `adk integrations diff` | Show snapshot vs Cloud differences | `--target <env>` |
|
|
41
40
|
|
|
42
|
-
##
|
|
41
|
+
## Snapshot System
|
|
43
42
|
|
|
44
|
-
Integration state lives in per-environment
|
|
43
|
+
Integration state lives in Botpress Cloud. The ADK writes generated per-environment snapshots under `.adk/dependencies/`:
|
|
45
44
|
|
|
46
|
-
-
|
|
47
|
-
-
|
|
45
|
+
- `.adk/dependencies/dev.json` — development environment snapshot
|
|
46
|
+
- `.adk/dependencies/prod.json` — production environment snapshot
|
|
47
|
+
- `.adk/dependencies/migration.json` — one-way legacy migration marker
|
|
48
48
|
|
|
49
49
|
```json
|
|
50
50
|
{
|
|
51
51
|
"version": 1,
|
|
52
52
|
"env": "dev",
|
|
53
|
+
"botId": "bot_123",
|
|
54
|
+
"fetchedAt": "2026-06-10T12:00:00.000Z",
|
|
53
55
|
"integrations": {
|
|
54
56
|
"slack": {
|
|
55
57
|
"name": "slack",
|
|
@@ -73,12 +75,13 @@ Integration state lives in per-environment lock files at the project root:
|
|
|
73
75
|
|
|
74
76
|
**Key principles:**
|
|
75
77
|
|
|
76
|
-
- Cloud is the source of truth.
|
|
77
|
-
- Never edit
|
|
78
|
+
- Cloud is the source of truth. Snapshots are local reflections refreshed after mutations and Cloud reads.
|
|
79
|
+
- Never edit snapshots by hand — use `adk integrations` commands or the Dev Console.
|
|
78
80
|
- The `--target` flag controls which environment (dev/prod) a command operates on.
|
|
79
81
|
- Config values support env substitution: `${env:API_KEY}` resolves to `process.env.API_KEY` at apply time.
|
|
82
|
+
- Use `adk dependencies export` / `adk dependencies import` for explicit dependency-only restore artifacts. These files are separate from generated `.adk/dependencies/*.json` snapshots.
|
|
80
83
|
|
|
81
|
-
**Migration from agent.config.ts:** Projects with a legacy `dependencies` block in `agent.config.ts` are auto-migrated
|
|
84
|
+
**Migration from agent.config.ts / legacy lock files:** Projects with a legacy `dependencies` block in `agent.config.ts` or legacy `dependencies.<env>.lock.json` files are auto-migrated on the first CLI command. If Cloud has no dependency state for an environment, legacy state is imported to Cloud automatically, including prod. The migration is one-shot and skipped when `.adk/dependencies/migration.json` exists; the marker contents are informational and are not parsed for gating.
|
|
82
85
|
|
|
83
86
|
## Integration Lifecycle
|
|
84
87
|
|
|
@@ -86,7 +89,7 @@ Integration state lives in per-environment lock files at the project root:
|
|
|
86
89
|
|
|
87
90
|
```bash
|
|
88
91
|
adk integrations search slack
|
|
89
|
-
adk integrations
|
|
92
|
+
adk integrations search --interface hitl
|
|
90
93
|
adk integrations info slack --format json
|
|
91
94
|
```
|
|
92
95
|
|
|
@@ -100,7 +103,7 @@ adk integrations add agi/linear@2.0.0
|
|
|
100
103
|
|
|
101
104
|
Always pin to a specific version. Without `--alias`, the integration name becomes the alias.
|
|
102
105
|
|
|
103
|
-
What happens: the integration is resolved,
|
|
106
|
+
What happens: the integration is resolved, applied to Cloud, and the local snapshot is refreshed. OAuth or missing-required-field integrations may be installed disabled with an `unconfigured` status until configuration/authorization is complete.
|
|
104
107
|
|
|
105
108
|
### 3. Configure
|
|
106
109
|
|
|
@@ -125,7 +128,7 @@ registration_pending → registered (success)
|
|
|
125
128
|
→ registration_failed (error)
|
|
126
129
|
```
|
|
127
130
|
|
|
128
|
-
Check status with `adk integrations
|
|
131
|
+
Check status with `adk integrations status`.
|
|
129
132
|
|
|
130
133
|
### 5. Use in Code
|
|
131
134
|
|
|
@@ -147,6 +150,17 @@ adk integrations upgrade slack
|
|
|
147
150
|
|
|
148
151
|
After upgrading, check for breaking changes in the new version, then re-deploy with `adk deploy`.
|
|
149
152
|
|
|
153
|
+
### Dependency Snapshot Import/Export
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
adk dependencies export [file] --target dev
|
|
157
|
+
adk dependencies export [file] --target prod --no-config
|
|
158
|
+
adk dependencies import <file> --dry-run
|
|
159
|
+
adk dependencies import <file> --target prod --yes
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Use these commands when you need to move or restore one environment's integration/plugin state without exporting the whole project. Export includes config by default and prints a security notice; pass `--no-config` before sharing an artifact. Import applies the captured state to the selected Cloud bot, refreshes the local snapshot, and restores the previous local snapshot after `--dry-run`.
|
|
163
|
+
|
|
150
164
|
## Configuration Types
|
|
151
165
|
|
|
152
166
|
Use `adk integrations info <name> --format json` to inspect an integration's configuration schema.
|
|
@@ -78,7 +78,7 @@ These are aggregated in:
|
|
|
78
78
|
|
|
79
79
|
Interfaces and integrations are complementary. See **[integrations.md](./integrations.md)** for integration management.
|
|
80
80
|
|
|
81
|
-
- **Integrations** are concrete connections to external services (Slack, webchat, Linear). You add them with `adk add`.
|
|
81
|
+
- **Integrations** are concrete connections to external services (Slack, webchat, Linear). You add them with `adk integrations add`.
|
|
82
82
|
- **Interfaces** are abstract contracts. An integration _implements_ an interface by declaring compatible actions with matching schemas.
|
|
83
83
|
- When you add an integration that implements an interface, the ADK automatically detects this and generates the mapping. No user action is required.
|
|
84
84
|
|
|
@@ -246,11 +246,11 @@ As of ADK 1.9+, knowledge bases are synced using the `adk kb` command, which run
|
|
|
246
246
|
# Interactive KB management
|
|
247
247
|
adk kb
|
|
248
248
|
|
|
249
|
-
# Non-interactive sync
|
|
250
|
-
adk kb sync -y
|
|
249
|
+
# Non-interactive sync (dev; use --prod for production)
|
|
250
|
+
adk kb sync --dev -y
|
|
251
251
|
|
|
252
|
-
#
|
|
253
|
-
adk kb
|
|
252
|
+
# Force a full re-sync, ignoring change detection
|
|
253
|
+
adk kb sync --dev --force -y
|
|
254
254
|
```
|
|
255
255
|
|
|
256
256
|
The KB sync:
|
|
@@ -104,7 +104,7 @@ The generated config includes `--cwd` to target the correct directory:
|
|
|
104
104
|
|
|
105
105
|
**"No chat or webchat integration found"**
|
|
106
106
|
|
|
107
|
-
- Add an integration: `adk add chat
|
|
107
|
+
- Add an integration: `adk integrations add chat@<version>` or `adk integrations add webchat@<version>`
|
|
108
108
|
|
|
109
109
|
**Inspect the MCP server:**
|
|
110
110
|
|
|
@@ -70,6 +70,22 @@ export const myTool = new Autonomous.Tool({
|
|
|
70
70
|
})
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
+
### Event Handling Mistakes
|
|
74
|
+
|
|
75
|
+
#### Receiving a pushed event — subscribe to `chat:custom`, not a made-up name
|
|
76
|
+
|
|
77
|
+
An event pushed into a conversation (e.g. an order shipped, a status update relayed in) arrives as `chat:custom`. A handler subscribed to a domain-specific name never fires.
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
// ❌ WRONG - pushed event is chat:custom, so this never fires
|
|
81
|
+
events: ['claimUpdate'],
|
|
82
|
+
|
|
83
|
+
// ✅ CORRECT - branch on type === 'event', read event.payload
|
|
84
|
+
events: ['chat:custom'],
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The camelCase rule applies only to events you define/emit, not to receiving. See [conversations.md → Custom & Proactive Events](./conversations.md#custom--proactive-events).
|
|
88
|
+
|
|
73
89
|
### State Management Mistakes
|
|
74
90
|
|
|
75
91
|
#### Conversation State Access
|
|
@@ -6,13 +6,13 @@ Users consume plugins. They do not author them.
|
|
|
6
6
|
|
|
7
7
|
## Plugin vs Integration
|
|
8
8
|
|
|
9
|
-
| | Plugin | Integration
|
|
10
|
-
| ---------------------- | ----------------------------------------- |
|
|
11
|
-
| **Purpose** | Adds behavior/logic to your bot | Connects to an external platform
|
|
12
|
-
| **Installed via** | `adk plugins add <name>` | `adk
|
|
13
|
-
| **May depend on** | Integrations (via interface wiring) | Nothing
|
|
14
|
-
| **
|
|
15
|
-
| **Action call format** | `plugins.<alias>.actions.<action>(input)` | `actions.<alias>.<action>(input)`
|
|
9
|
+
| | Plugin | Integration |
|
|
10
|
+
| ---------------------- | ----------------------------------------- | --------------------------------- |
|
|
11
|
+
| **Purpose** | Adds behavior/logic to your bot | Connects to an external platform |
|
|
12
|
+
| **Installed via** | `adk plugins add <name>` | `adk integrations add <name>` |
|
|
13
|
+
| **May depend on** | Integrations (via interface wiring) | Nothing |
|
|
14
|
+
| **Snapshot key** | `plugins` | `integrations` |
|
|
15
|
+
| **Action call format** | `plugins.<alias>.actions.<action>(input)` | `actions.<alias>.<action>(input)` |
|
|
16
16
|
|
|
17
17
|
## CLI Commands
|
|
18
18
|
|
|
@@ -101,23 +101,17 @@ adk plugins upgrade <alias> --to <version>
|
|
|
101
101
|
adk plugins upgrade <alias> --target prod
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
-
###
|
|
104
|
+
### Snapshot Inspection and Promotion
|
|
105
105
|
|
|
106
|
-
Plugin state is
|
|
106
|
+
Plugin state lives in Botpress Cloud and is reflected locally in `.adk/dependencies/<env>.json` alongside integrations. These commands inspect and promote dependency state:
|
|
107
107
|
|
|
108
108
|
```bash
|
|
109
|
-
#
|
|
110
|
-
adk plugins
|
|
111
|
-
adk plugins
|
|
112
|
-
adk plugins
|
|
113
|
-
|
|
114
|
-
#
|
|
115
|
-
adk plugins apply
|
|
116
|
-
adk plugins apply --target prod
|
|
117
|
-
adk plugins apply --dry-run # preview without writing
|
|
118
|
-
adk plugins apply --yes # allow destructive changes without confirmation
|
|
119
|
-
|
|
120
|
-
# Show differences between lock and cloud
|
|
109
|
+
# Show per-plugin capability state with remediation
|
|
110
|
+
adk plugins status
|
|
111
|
+
adk plugins status --target prod
|
|
112
|
+
adk plugins status --format json
|
|
113
|
+
|
|
114
|
+
# Show differences between the local snapshot and Cloud
|
|
121
115
|
adk plugins diff
|
|
122
116
|
adk plugins diff --target prod
|
|
123
117
|
|
|
@@ -127,6 +121,8 @@ adk plugins copy --from dev --to prod --dry-run
|
|
|
127
121
|
adk plugins copy --from dev --to prod --yes # allow destructive changes without confirmation
|
|
128
122
|
```
|
|
129
123
|
|
|
124
|
+
Use `adk dependencies export` / `adk dependencies import` for dependency-only restore artifacts covering integrations and plugins together. These files are explicit backups or transfer artifacts, not user-authored replacements for `.adk/dependencies/<env>.json`.
|
|
125
|
+
|
|
130
126
|
## Interface Dependencies
|
|
131
127
|
|
|
132
128
|
Plugins often depend on [interfaces](./interfaces.md) -- abstract contracts that integrations implement. When you add a plugin, the CLI resolves these dependencies:
|
|
@@ -171,14 +167,16 @@ The call format is `plugins.<alias>.actions.<action>()`. This differs from integ
|
|
|
171
167
|
|
|
172
168
|
Plugin actions are routed through the Botpress client internally -- the runtime proxy calls `client.callAction()` with the format `<alias>#<actionName>`, so you never need to construct this yourself.
|
|
173
169
|
|
|
174
|
-
##
|
|
170
|
+
## Snapshot Structure
|
|
175
171
|
|
|
176
|
-
Plugins live in
|
|
172
|
+
Plugins live in `.adk/dependencies/dev.json` (or `.adk/dependencies/prod.json`) under the `plugins` key:
|
|
177
173
|
|
|
178
174
|
```json
|
|
179
175
|
{
|
|
180
176
|
"version": 1,
|
|
181
177
|
"env": "dev",
|
|
178
|
+
"botId": "bot_123",
|
|
179
|
+
"fetchedAt": "2026-06-10T12:00:00.000Z",
|
|
182
180
|
"integrations": { ... },
|
|
183
181
|
"plugins": {
|
|
184
182
|
"desk-hitl": {
|
|
@@ -210,7 +208,7 @@ Each plugin entry has:
|
|
|
210
208
|
|
|
211
209
|
## Environment Variable References
|
|
212
210
|
|
|
213
|
-
Plugin config values support `${env:VAR_NAME}` syntax. The CLI substitutes these from the process environment
|
|
211
|
+
Plugin config values support `${env:VAR_NAME}` syntax. The CLI substitutes these from the process environment when applying to Cloud while preserving the reference in the snapshot. This keeps secrets out of version control.
|
|
214
212
|
|
|
215
213
|
```bash
|
|
216
214
|
# Set a config value that references an env var
|
|
@@ -248,13 +246,13 @@ adk plugins disable my-plugin
|
|
|
248
246
|
adk plugins enable my-plugin
|
|
249
247
|
```
|
|
250
248
|
|
|
251
|
-
###
|
|
249
|
+
### Inspect After Manual Cloud Changes
|
|
252
250
|
|
|
253
251
|
If someone changed plugin state through the Botpress dashboard:
|
|
254
252
|
|
|
255
253
|
```bash
|
|
256
|
-
adk plugins
|
|
257
|
-
adk plugins diff #
|
|
254
|
+
adk plugins status # show availability/remediation
|
|
255
|
+
adk plugins diff # compare local snapshot with Cloud
|
|
258
256
|
```
|
|
259
257
|
|
|
260
258
|
## Pitfalls
|
|
@@ -265,11 +263,11 @@ adk plugins diff # verify lock matches cloud
|
|
|
265
263
|
|
|
266
264
|
3. **Plugin actions vs integration actions** -- Plugin actions use `plugins.<alias>.actions.<name>()`, not `actions.<alias>.<name>()`. Mixing these up gives runtime errors.
|
|
267
265
|
|
|
268
|
-
4. **
|
|
266
|
+
4. **Snapshot drift** -- If someone adds or removes plugins via the Botpress dashboard, refresh with a Cloud-reading command such as `adk plugins status` and check `adk plugins diff`.
|
|
269
267
|
|
|
270
|
-
5. **Prod requires confirmation** -- `adk plugins
|
|
268
|
+
5. **Prod requires confirmation** -- `adk plugins copy --from dev --to prod` and destructive operations require confirmation or `--yes`. This is intentional.
|
|
271
269
|
|
|
272
|
-
6. **Old `adk add plugin:` syntax** -- The legacy
|
|
270
|
+
6. **Old `adk add plugin:` syntax** -- The legacy flat command is no longer supported. Use `adk plugins add <name>` for plugin installs, config, interface dependencies, and enable/disable lifecycle.
|
|
273
271
|
|
|
274
272
|
## See Also
|
|
275
273
|
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Tables provide structured data storage with automatic schema management, CRUD operations, and optional semantic search capabilities.
|
|
4
4
|
|
|
5
|
+
> **Use `state`, not a Table, for simple memory.** For per-user or per-bot values (names, preferences, counters), use `user.state` / `bot.state` (see [Context API](./context-api.md)). Reach for a Table only for collections of rows you list, query, or search.
|
|
6
|
+
|
|
5
7
|
## Basic Concepts
|
|
6
8
|
|
|
7
9
|
### What are Tables?
|
|
@@ -22,10 +24,10 @@ Tables provide structured data storage with automatic schema management, CRUD op
|
|
|
22
24
|
|
|
23
25
|
**Before creating any table, you MUST follow these two rules or table creation will fail:**
|
|
24
26
|
|
|
25
|
-
1. **DO NOT define `id`
|
|
26
|
-
- ❌ Don't define
|
|
27
|
-
- ✅
|
|
28
|
-
- ✅
|
|
27
|
+
1. **DO NOT define `id`, `createdAt`, or `updatedAt` columns in schema** - all three are RESERVED and automatically managed. Defining any of them in `columns` throws an error.
|
|
28
|
+
- ❌ Don't define them: `columns: { id: ..., createdAt: ..., updatedAt: ... }`
|
|
29
|
+
- ✅ Every row automatically has `id` (`number`), `createdAt`, and `updatedAt` — read them off the row (e.g. `row.createdAt`). Never write `createdAt`/`updatedAt` in any payload; they are always system-managed.
|
|
30
|
+
- ✅ `id` is auto-assigned by `createRows()` (don't pass it). You may pass `id` (as `number`) to `upsertRows()` — there it is the **match key** that locates the row to update, not a column value you set.
|
|
29
31
|
|
|
30
32
|
2. **Table names MUST end with "Table" suffix** - The `name` property passed to `new Table()` must end with "Table" (e.g., `"UsersTable"`, `"OrdersTable"`). This is enforced by runtime validation.
|
|
31
33
|
|
|
@@ -61,11 +63,10 @@ export const UsersTable = new Table({
|
|
|
61
63
|
description: 'Stores user information',
|
|
62
64
|
|
|
63
65
|
columns: {
|
|
64
|
-
// Note: id
|
|
66
|
+
// Note: id, createdAt, updatedAt are NOT defined - they're automatic!
|
|
65
67
|
name: z.string(),
|
|
66
68
|
email: z.string().email(),
|
|
67
69
|
role: z.enum(['admin', 'user', 'guest']),
|
|
68
|
-
createdAt: z.date(),
|
|
69
70
|
metadata: z.object({}).passthrough(), // Flexible object
|
|
70
71
|
},
|
|
71
72
|
})
|
|
@@ -124,9 +125,7 @@ export const ConversationsTable = new Table({
|
|
|
124
125
|
description: 'Store conversation data with complex metadata',
|
|
125
126
|
|
|
126
127
|
columns: {
|
|
127
|
-
//
|
|
128
|
-
createdAt: z.string().describe('ISO 8601 date string'),
|
|
129
|
-
updatedAt: z.string().describe('ISO 8601 date string'),
|
|
128
|
+
// id, createdAt, updatedAt are automatic — don't define them.
|
|
130
129
|
|
|
131
130
|
// Optional fields
|
|
132
131
|
waitingSince: z.string().optional(),
|
|
@@ -204,7 +203,6 @@ export const DocumentsTable = new Table({
|
|
|
204
203
|
},
|
|
205
204
|
|
|
206
205
|
tags: z.array(z.string()),
|
|
207
|
-
createdAt: z.date(),
|
|
208
206
|
},
|
|
209
207
|
|
|
210
208
|
// Optional: Search optimization factor
|
|
@@ -248,7 +246,6 @@ await UsersTable.createRows({
|
|
|
248
246
|
name: 'John Doe',
|
|
249
247
|
email: 'john@example.com',
|
|
250
248
|
role: 'user',
|
|
251
|
-
createdAt: new Date(),
|
|
252
249
|
metadata: { source: 'signup' },
|
|
253
250
|
},
|
|
254
251
|
],
|
|
@@ -261,13 +258,11 @@ await UsersTable.createRows({
|
|
|
261
258
|
name: 'Alice',
|
|
262
259
|
email: 'alice@example.com',
|
|
263
260
|
role: 'admin',
|
|
264
|
-
createdAt: new Date(),
|
|
265
261
|
},
|
|
266
262
|
{
|
|
267
263
|
name: 'Bob',
|
|
268
264
|
email: 'bob@example.com',
|
|
269
265
|
role: 'user',
|
|
270
|
-
createdAt: new Date(),
|
|
271
266
|
},
|
|
272
267
|
],
|
|
273
268
|
})
|
|
@@ -382,7 +377,6 @@ await ContactsTable.upsertRows({
|
|
|
382
377
|
contactId: contact.id,
|
|
383
378
|
name: contact.name,
|
|
384
379
|
email: contact.email,
|
|
385
|
-
updatedAt: new Date(),
|
|
386
380
|
})),
|
|
387
381
|
keyColumn: 'contactId',
|
|
388
382
|
})
|
|
@@ -484,8 +478,6 @@ export const OrdersTable = new Table({
|
|
|
484
478
|
}),
|
|
485
479
|
status: z.enum(['pending', 'processing', 'shipped', 'delivered']),
|
|
486
480
|
total: z.number().positive(),
|
|
487
|
-
createdAt: z.date(),
|
|
488
|
-
updatedAt: z.date(),
|
|
489
481
|
},
|
|
490
482
|
})
|
|
491
483
|
```
|
|
@@ -758,7 +750,6 @@ export const createUser = new Action({
|
|
|
758
750
|
name: input.name,
|
|
759
751
|
email: input.email,
|
|
760
752
|
role: input.role,
|
|
761
|
-
createdAt: new Date(),
|
|
762
753
|
metadata: {},
|
|
763
754
|
},
|
|
764
755
|
],
|
|
@@ -881,16 +872,14 @@ export const UsersTable = new Table({ name: "UsersTable", columns: { ... } });
|
|
|
881
872
|
export const OrdersTable = new Table({ name: "OrdersTable", columns: { ... } });
|
|
882
873
|
```
|
|
883
874
|
|
|
884
|
-
### 2.
|
|
875
|
+
### 2. Timestamps Are Automatic
|
|
876
|
+
|
|
877
|
+
Every row already has `createdAt` and `updatedAt` (and `id`) — don't define them. Add your own date column only for a distinct meaning, e.g. a soft delete:
|
|
885
878
|
|
|
886
879
|
```typescript
|
|
887
880
|
columns: {
|
|
888
|
-
//
|
|
889
|
-
|
|
890
|
-
updatedAt: z.date(),
|
|
891
|
-
|
|
892
|
-
// Optional: soft delete
|
|
893
|
-
deletedAt: z.date().nullable().optional()
|
|
881
|
+
// createdAt / updatedAt are automatic — read them off the row, don't define them.
|
|
882
|
+
deletedAt: z.date().nullable().optional() // soft delete
|
|
894
883
|
}
|
|
895
884
|
```
|
|
896
885
|
|
|
@@ -997,7 +986,6 @@ export const CacheTable = new Table({
|
|
|
997
986
|
key: z.string(),
|
|
998
987
|
value: z.unknown(),
|
|
999
988
|
expiresAt: z.date(),
|
|
1000
|
-
createdAt: z.date(),
|
|
1001
989
|
},
|
|
1002
990
|
})
|
|
1003
991
|
|
|
@@ -1024,7 +1012,6 @@ export async function getCached<T>(key: string, fetcher: () => Promise<T>, ttlMi
|
|
|
1024
1012
|
key,
|
|
1025
1013
|
value,
|
|
1026
1014
|
expiresAt: new Date(Date.now() + ttlMinutes * 60 * 1000),
|
|
1027
|
-
createdAt: new Date(),
|
|
1028
1015
|
},
|
|
1029
1016
|
],
|
|
1030
1017
|
keyColumn: 'key',
|
|
@@ -56,6 +56,8 @@ export default new Autonomous.Tool({
|
|
|
56
56
|
- Can pass directly to `execute()`: `tools: [searchDocs]`
|
|
57
57
|
- Better for tool composition and reusability
|
|
58
58
|
|
|
59
|
+
> A `Tool`/`Autonomous.Tool` is already a tool — pass it directly (`tools: [myTool]`). Do **not** call `.asTool()` on it; `.asTool()` only adapts an **Action** into a tool.
|
|
60
|
+
|
|
59
61
|
## Tool Properties
|
|
60
62
|
|
|
61
63
|
| Property | Type | Required | Description |
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Triggers allow your bot to react to events from the bot itself or integrated services. They enable event-driven automation and workflow orchestration.
|
|
4
4
|
|
|
5
|
-
> **⚠️ IMPORTANT:** Always verify integration events exist before using them! Use `adk info <integration> --
|
|
5
|
+
> **⚠️ IMPORTANT:** Always verify integration events exist before using them! Use `adk integrations info <integration> --format json` and inspect the returned event spec. Integration events change between versions.
|
|
6
6
|
>
|
|
7
7
|
> **⚠️ Dev-mode limitation:** `adk dev` is not a perfect mirror of production for every integration event flow. Some private or custom integration events may not register or route locally even when the event name is valid. If an event-driven flow works in docs but not in local dev, verify the event first, then test against a deployed bot before assuming your trigger code is wrong.
|
|
8
|
+
>
|
|
9
|
+
> **⚠️ To _receive_ a pushed event, subscribe to `chat:custom` — not a custom name.** An event pushed into a chat conversation (e.g. an order shipped, a status update relayed in) arrives as `chat:custom`. Subscribe the `Conversation` to `events: ['chat:custom']` and branch on `type === 'event'`; a handler on a made-up name like `orderShipped` never fires. See [Conversations → Custom & Proactive Events](./conversations.md#custom--proactive-events). The camelCase rule below applies only to events you _define/emit_, not to receiving.
|
|
10
|
+
>
|
|
11
|
+
> **⚠️ Events you define must be camelCase** — `orderShipped`, not `order_shipped`; `adk build` rejects snake_case names.
|
|
8
12
|
|
|
9
13
|
## Basic Concepts
|
|
10
14
|
|
|
@@ -98,7 +102,7 @@ Standard events emitted by the bot:
|
|
|
98
102
|
|
|
99
103
|
Events from integrated services use the pattern `integrationName:eventName`.
|
|
100
104
|
|
|
101
|
-
**IMPORTANT:** Always verify events exist using `adk info <integration> --
|
|
105
|
+
**IMPORTANT:** Always verify events exist using `adk integrations info <integration> --format json` before using them.
|
|
102
106
|
|
|
103
107
|
```typescript
|
|
104
108
|
// Intercom events (real events from vertical-one)
|
|
@@ -106,7 +110,7 @@ Events from integrated services use the pattern `integrationName:eventName`.
|
|
|
106
110
|
'intercom:contactEvent' // Contact created/updated
|
|
107
111
|
'intercom:adminEvent' // Admin changes
|
|
108
112
|
|
|
109
|
-
// Slack events (verified with adk info slack --
|
|
113
|
+
// Slack events (verified with adk integrations info slack --format json)
|
|
110
114
|
'slack:reactionAdded'
|
|
111
115
|
'slack:reactionRemoved'
|
|
112
116
|
'slack:memberJoinedChannel'
|
|
@@ -114,18 +118,18 @@ Events from integrated services use the pattern `integrationName:eventName`.
|
|
|
114
118
|
'slack:memberLeftChannel'
|
|
115
119
|
'slack:workflowWebhook'
|
|
116
120
|
|
|
117
|
-
// Linear events (verified with adk info linear --
|
|
121
|
+
// Linear events (verified with adk integrations info linear --format json)
|
|
118
122
|
'linear:issueCreated'
|
|
119
123
|
'linear:issueUpdated'
|
|
120
124
|
'linear:issueDeleted'
|
|
121
125
|
|
|
122
|
-
// GitHub events (verified with adk info github --
|
|
126
|
+
// GitHub events (verified with adk integrations info github --format json)
|
|
123
127
|
'github:issueOpened'
|
|
124
128
|
'github:pullRequestOpened'
|
|
125
129
|
'github:pullRequestMerged'
|
|
126
130
|
'github:pullRequestReviewSubmitted'
|
|
127
131
|
|
|
128
|
-
// Webchat events (verified with adk info webchat --
|
|
132
|
+
// Webchat events (verified with adk integrations info webchat --format json)
|
|
129
133
|
'webchat:conversationStarted'
|
|
130
134
|
'webchat:trigger'
|
|
131
135
|
```
|
|
@@ -134,15 +138,15 @@ Events from integrated services use the pattern `integrationName:eventName`.
|
|
|
134
138
|
|
|
135
139
|
```bash
|
|
136
140
|
# Search for an integration
|
|
137
|
-
adk search email
|
|
141
|
+
adk integrations search email
|
|
138
142
|
|
|
139
143
|
# Get all events for an integration
|
|
140
|
-
adk info slack --
|
|
141
|
-
adk info linear --
|
|
142
|
-
adk info github --
|
|
144
|
+
adk integrations info slack --format json
|
|
145
|
+
adk integrations info linear --format json
|
|
146
|
+
adk integrations info github --format json
|
|
143
147
|
```
|
|
144
148
|
|
|
145
|
-
Checking `adk info <integration> --
|
|
149
|
+
Checking `adk integrations info <integration> --format json` confirms the event exists, but it does not guarantee that every event source behaves the same in `adk dev` as it does after deployment.
|
|
146
150
|
|
|
147
151
|
## Trigger Handlers
|
|
148
152
|
|
|
@@ -222,7 +226,7 @@ export default new Trigger({
|
|
|
222
226
|
|
|
223
227
|
handler: async ({ event }) => {
|
|
224
228
|
// Call integration action (e.g., SendGrid)
|
|
225
|
-
// First add the integration: adk add sendgrid
|
|
229
|
+
// First add the integration: adk integrations add sendgrid@<version>
|
|
226
230
|
await actions.sendgrid.sendEmail({
|
|
227
231
|
to: 'admin@example.com',
|
|
228
232
|
from: 'bot@example.com',
|
|
@@ -506,6 +506,8 @@ await step('process-all-items', async () => {
|
|
|
506
506
|
|
|
507
507
|
## Communication Patterns
|
|
508
508
|
|
|
509
|
+
> **For simple turn-by-turn chat (quizzes, multi-step prompts within one conversation), don't use a Workflow.** Keep the sequence in the Conversation handler with per-conversation `state`. Request/provide workflows are for pausing on external or async input — overkill and hard to resume for linear chat.
|
|
510
|
+
|
|
509
511
|
### 1. Requesting User Input (Blocking)
|
|
510
512
|
|
|
511
513
|
Workflows can pause and request data from conversations:
|
|
@@ -21,7 +21,7 @@ adk check --format json
|
|
|
21
21
|
- Missing or invalid `agent.config.ts` fields
|
|
22
22
|
- Schema mismatch between action/tool input and output definitions
|
|
23
23
|
- Invalid entity names (too long or contains invalid characters)
|
|
24
|
-
- Missing dependency (integration not added with `adk add`)
|
|
24
|
+
- Missing dependency (integration not added with `adk integrations add`)
|
|
25
25
|
- Import from wrong source (e.g., importing from `@botpress/sdk` instead of `@botpress/runtime`)
|
|
26
26
|
- Invalid table schema definitions
|
|
27
27
|
|
|
@@ -85,7 +85,7 @@ Look for `tool_call` spans with `success: false`. Some tools could be workflows
|
|
|
85
85
|
- **Handler error:** Read the error message, fix the handler code
|
|
86
86
|
- **Schema mismatch:** Compare `input` in the trace against the tool's input schema definition
|
|
87
87
|
- **Auth expired:** Reconfigure the integration in the Dev Console (localhost:3001) which must be done interactively
|
|
88
|
-
- **Missing config:** Run `adk info <integration> --format json` to see required config, then configure in Dev Console which must also be done interactively
|
|
88
|
+
- **Missing config:** Run `adk integrations info <integration> --format json` to see required config, then configure in Dev Console which must also be done interactively
|
|
89
89
|
|
|
90
90
|
---
|
|
91
91
|
|
|
@@ -143,7 +143,7 @@ Also check the Dev Console at localhost:3001 for integration status.
|
|
|
143
143
|
|
|
144
144
|
- **Auth:** Reconfigure the integration in Dev Console
|
|
145
145
|
- **Rate limits:** Add retry logic or reduce request frequency
|
|
146
|
-
- **Config:** Run `adk info <integration> --format json` to verify required fields, update in Dev Console
|
|
146
|
+
- **Config:** Run `adk integrations info <integration> --format json` to verify required fields, update in Dev Console
|
|
147
147
|
- **Events in dev:** Restart `adk dev` — event registration sometimes needs a fresh start
|
|
148
148
|
|
|
149
149
|
---
|
|
@@ -163,7 +163,7 @@ adk check --format json
|
|
|
163
163
|
|
|
164
164
|
- **Import from wrong source:** Using `@botpress/sdk` where `@botpress/runtime` is needed (or vice versa)
|
|
165
165
|
- **Schema mismatch:** Action/tool input or output schema doesn't match the handler's actual types
|
|
166
|
-
- **Missing dependency:** Integration referenced in code but not added with `adk add`
|
|
166
|
+
- **Missing dependency:** Integration referenced in code but not added with `adk integrations add`
|
|
167
167
|
- **Type errors in generated code:** Usually caused by stale generated types — run `adk build` or re-run `adk dev` to regenerate
|
|
168
168
|
|
|
169
169
|
**Fix:** Start with `adk check --format json` — it catches most issues offline. For type errors, try deleting `.adk/` and running `adk build` or re-running `adk dev` to regenerate.
|
|
@@ -142,16 +142,16 @@ Missing or incorrect configuration — integration auth, agent.json, environment
|
|
|
142
142
|
|
|
143
143
|
Apply a targeted fix based on the classification:
|
|
144
144
|
|
|
145
|
-
| Classification | Where to Fix
|
|
146
|
-
| ------------------------ |
|
|
147
|
-
| Runtime error in handler | Action/tool/workflow handler code
|
|
148
|
-
| Schema mismatch | Input/output schema definitions
|
|
149
|
-
| Wrong tool selected | Tool descriptions, instructions
|
|
150
|
-
| Hallucinated params | Input schemas, validation
|
|
151
|
-
| Model refusal | Instructions, tool descriptions
|
|
152
|
-
| Model looping | `onBeforeTool` guard, output clarity
|
|
153
|
-
| Integration failure | Dev Console config, `adk add`
|
|
154
|
-
| Config issue | `agent.json`, `agent.local.json`
|
|
145
|
+
| Classification | Where to Fix | Reference |
|
|
146
|
+
| ------------------------ | ------------------------------------------ | -------------------------------------------- |
|
|
147
|
+
| Runtime error in handler | Action/tool/workflow handler code | `common-failures.md` |
|
|
148
|
+
| Schema mismatch | Input/output schema definitions | `common-failures.md` § Build Errors |
|
|
149
|
+
| Wrong tool selected | Tool descriptions, instructions | `llm-debugging.md` § Wrong Tool |
|
|
150
|
+
| Hallucinated params | Input schemas, validation | `llm-debugging.md` § Hallucinated Parameters |
|
|
151
|
+
| Model refusal | Instructions, tool descriptions | `llm-debugging.md` § Refusal |
|
|
152
|
+
| Model looping | `onBeforeTool` guard, output clarity | `llm-debugging.md` § Looping |
|
|
153
|
+
| Integration failure | Dev Console config, `adk integrations add` | `common-failures.md` § Integration Failures |
|
|
154
|
+
| Config issue | `agent.json`, `agent.local.json` | `common-failures.md` § Config Confusion |
|
|
155
155
|
|
|
156
156
|
---
|
|
157
157
|
|
|
@@ -189,7 +189,7 @@ After fixing, write a regression eval so the bug can't come back. Use the **adk-
|
|
|
189
189
|
Quick template:
|
|
190
190
|
|
|
191
191
|
```typescript
|
|
192
|
-
import { Eval } from '@botpress/
|
|
192
|
+
import { Eval } from '@botpress/evals'
|
|
193
193
|
|
|
194
194
|
export default new Eval({
|
|
195
195
|
name: 'fix-description-here',
|