@botpress/adk 2.0.1-beta.1 → 2.0.1-beta.3
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-test.md +2 -2
- package/dist/agent0/capabilities/skills/adk/references/assets.md +2 -0
- package/dist/agent0/capabilities/skills/adk/references/cli.md +6 -4
- package/dist/agent0/capabilities/skills/adk/references/conversations.md +7 -3
- package/dist/agent0/capabilities/skills/adk/references/patterns-mistakes.md +27 -1
- package/dist/agent0/capabilities/skills/adk-debugger/references/debug-workflow.md +2 -0
- package/dist/agent0/capabilities/skills/adk-evals/SKILL.md +6 -6
- package/dist/agent0/capabilities/skills/adk-evals/references/eval-format.md +10 -5
- package/dist/agent0/capabilities/skills/adk-evals/references/test-patterns.md +2 -3
- package/dist/agent0/index.js +9 -6
- package/dist/agent0/index.js.map +3 -3
- package/dist/dependencies/index.js +2 -2
- package/dist/dependencies/index.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -14,10 +14,10 @@ If `$ARGUMENTS` is empty, list the user's primitives and ask which to test.
|
|
|
14
14
|
|
|
15
15
|
1. **Locate and identify type.** Glob `src/**/<name>.ts`. The directory tells you the type (action / tool / workflow / conversation / table / trigger / knowledge base).
|
|
16
16
|
2. **Build an invocation appropriate for the type.** If the user provided input after the primitive name, use it as-is; otherwise generate a realistic probe from the primitive's schema:
|
|
17
|
-
- **Tool / conversation handler / agent step:** `adk chat --single
|
|
17
|
+
- **Tool / conversation handler / agent step:** `adk chat --single '<probe message that exercises this primitive>' --format json`. The probe should plausibly cause the LLM to call the tool / route to the handler. Single-quote the message — in double quotes the shell expands `$`, so a probe like `"I spent $5"` reaches the bot mangled.
|
|
18
18
|
- **Action:** invoke through `adk run .adk/scratch/test-<name>.ts` after writing a small disposable runner under `.adk/scratch/`, or via a chat probe that triggers a tool which calls the action. Prefer the runner when the action has a deterministic input shape.
|
|
19
19
|
- **Workflow:** trigger via the documented entry point (chat probe, action call, or trigger event).
|
|
20
|
-
- **Trigger:**
|
|
20
|
+
- **Trigger:** a `Trigger` fires on an external source event that usually can't be produced locally — invoke its handler directly via `adk run` with a synthetic event. (A Conversation's pushed `chat:custom` event is different: test it with an eval `event` turn and `adk evals` — see `/adk-eval`. `adk chat --single` only sends user text and can't push one.)
|
|
21
21
|
- **Table:** insert a sample row, run a representative query, then **delete the row** before reporting. Tag the test row with a recognizable marker (e.g., a `__test_<timestamp>` value in a string column) so the cleanup query is unambiguous. If the project is linked to a shared or production workspace, ask the user before inserting at all — offer to scope the test to a local dev table instead.
|
|
22
22
|
- **Knowledge base:** run a search query against it.
|
|
23
23
|
3. **Run it and read traces.** Capture the response. Run `adk traces --format json` filtered to the most recent invocation if the response alone is not enough to judge correctness.
|
|
@@ -67,6 +67,8 @@ console.log(logo.mime) // "image/png"
|
|
|
67
67
|
console.log(logo.size) // bytes
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
+
> `assets.get()` returns **metadata only** (URL, mime, size) — never the file's bytes. To ship a data table your code reads in-process (menu, catalog, rules), don't use assets — `import` the JSON statically instead. See [patterns-mistakes.md → Shipping a bundled data file](./patterns-mistakes.md#shipping-a-bundled-data-file).
|
|
71
|
+
|
|
70
72
|
### List All Assets
|
|
71
73
|
|
|
72
74
|
```typescript
|
|
@@ -362,12 +362,14 @@ adk chat [options]
|
|
|
362
362
|
|
|
363
363
|
```bash
|
|
364
364
|
adk chat # interactive
|
|
365
|
-
adk chat --single
|
|
366
|
-
adk chat --single
|
|
367
|
-
adk chat --single
|
|
368
|
-
adk chat --single
|
|
365
|
+
adk chat --single '<message>' # one-shot
|
|
366
|
+
adk chat --single '<message>' --format json
|
|
367
|
+
adk chat --single 'Run the full analysis' --timeout 30s
|
|
368
|
+
adk chat --single 'Follow up' --conversation-id <id>
|
|
369
369
|
```
|
|
370
370
|
|
|
371
|
+
> **Single-quote the message.** In double quotes the shell expands `$`, so `"I spent $5"` reaches the bot as `I spent ` (and `$10`→`0`, `$84.50`→`4.50`). It looks like the bot can't parse the input, but it's shell mangling. Use single quotes: `adk chat --single 'I spent $5'`.
|
|
372
|
+
|
|
371
373
|
**Requires:**
|
|
372
374
|
|
|
373
375
|
- `adk dev` running (also creates the `devId` on first run). Conversation continuation requires the dev server to be running — the user token is persisted automatically.
|
|
@@ -138,6 +138,8 @@ export const Chat = new Conversation({
|
|
|
138
138
|
|
|
139
139
|
See **[Messages](./messages.md)** for complete guide on all message types, metadata, and sending patterns.
|
|
140
140
|
|
|
141
|
+
> **Route natural language to `execute()` — don't hand-roll parsers.** Match exact strings only for explicit slash-commands (`/help`) or structured event `type`s. For anything users phrase in their own words, call `execute({ instructions })` and pull structured fields with `adk.zai.extract` (see [zai-agent-reference.md](./zai-agent-reference.md)); keyword/regex/`startsWith` matching silently misses real phrasings.
|
|
142
|
+
|
|
141
143
|
## Custom & Proactive Events
|
|
142
144
|
|
|
143
145
|
To push a message into a conversation from an external trigger (e.g. an announcement or status update), handle a custom event **inside the Conversation** — declare it in `events` and branch on `type === 'event'`. Don't build a separate `Trigger` + `client.createMessage`; an integration can't post messages as itself.
|
|
@@ -148,9 +150,9 @@ export const Chat = new Conversation({
|
|
|
148
150
|
events: ['chat:custom'],
|
|
149
151
|
async handler({ type, event, conversation }) {
|
|
150
152
|
if (type === 'event') {
|
|
151
|
-
// The pushed data is
|
|
152
|
-
// event as `unknown`, so read
|
|
153
|
-
const { orderId } = (event as { payload: { orderId: string } }).payload
|
|
153
|
+
// The pushed data is nested at event.payload.payload. On channel '*' the handler
|
|
154
|
+
// types event as `unknown`, so read it with a cast (or use a concrete channel).
|
|
155
|
+
const { orderId } = (event as { payload: { payload: { orderId: string } } }).payload.payload
|
|
154
156
|
await conversation.send({ type: 'text', payload: { text: `Order ${orderId} shipped!` } })
|
|
155
157
|
return
|
|
156
158
|
}
|
|
@@ -159,6 +161,8 @@ export const Chat = new Conversation({
|
|
|
159
161
|
})
|
|
160
162
|
```
|
|
161
163
|
|
|
164
|
+
To test a pushed event without an external trigger, fire it from an eval `event` turn (`event: { payload: {...} }`) and run `adk evals` — `adk chat --single` only sends user text. See the `adk-evals` skill.
|
|
165
|
+
|
|
162
166
|
## Conversation Instance Methods
|
|
163
167
|
|
|
164
168
|
The `conversation` object provides methods for interacting with the current conversation.
|
|
@@ -37,6 +37,16 @@ const { myAction } = await import('./actions/myAction')
|
|
|
37
37
|
import { myAction } from './actions/myAction'
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
### Shipping a bundled data file
|
|
41
|
+
|
|
42
|
+
To ship a data table your code reads at runtime (menu, catalog, pricing rules), **import the JSON statically** — the bundler inlines it into the build:
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import menu from './data/menu.json' // ✅ inlined at build time
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Don't reach for `fs.readFile` (the file isn't on disk at runtime → ENOENT), `import.meta`/`fileURLToPath` (undefined in the bundle → throws), or `assets.get()` (returns a URL, not the file's contents). All three pass `adk check` and `tsc` but crash only at runtime.
|
|
49
|
+
|
|
40
50
|
### Handler Syntax
|
|
41
51
|
|
|
42
52
|
#### Action Handlers
|
|
@@ -80,12 +90,28 @@ An event pushed into a conversation (e.g. an order shipped, a status update rela
|
|
|
80
90
|
// ❌ WRONG - pushed event is chat:custom, so this never fires
|
|
81
91
|
events: ['claimUpdate'],
|
|
82
92
|
|
|
83
|
-
// ✅ CORRECT - branch on type === 'event', read event.payload
|
|
93
|
+
// ✅ CORRECT - branch on type === 'event', read event.payload.payload
|
|
84
94
|
events: ['chat:custom'],
|
|
85
95
|
```
|
|
86
96
|
|
|
87
97
|
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
98
|
|
|
99
|
+
### Conversation Routing Mistakes
|
|
100
|
+
|
|
101
|
+
#### Don't hand-roll natural-language parsing
|
|
102
|
+
|
|
103
|
+
Keyword/regex/exact-string matching on what a user types misses real phrasings, so whole flows silently fail. Route natural language to `execute()`; reserve exact-string branching for explicit slash-commands and structured event `type`s.
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
// ❌ WRONG - misses "can you sum this up?", "tl;dr", ...
|
|
107
|
+
if (message?.payload.text.includes('summarize')) {
|
|
108
|
+
/* ... */
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// ✅ CORRECT - the model interprets intent; extract fields with zai
|
|
112
|
+
await execute({ instructions: 'Summarize the conversation for the user' })
|
|
113
|
+
```
|
|
114
|
+
|
|
89
115
|
### State Management Mistakes
|
|
90
116
|
|
|
91
117
|
#### Conversation State Access
|
|
@@ -51,6 +51,8 @@ adk chat --single "the message that triggers the bug" --format json
|
|
|
51
51
|
|
|
52
52
|
**Why minimal?** A single message isolates the problem. Most often, multi-turn conversations add noise — the issue might be in turn 3 but caused by context from turn 1. That being said, some bugs are only reproducible by going through many turns.
|
|
53
53
|
|
|
54
|
+
**Pushed-event or proactive bug?** `adk chat --single` only sends user text — it can't push a `chat:custom` event. Reproduce with an eval `event` turn (`event: { payload: {...} }`) and run `adk evals`; don't curl the chat webhook.
|
|
55
|
+
|
|
54
56
|
**Save the conversation ID** from the JSON output — you'll need it for trace queries and follow up conversations.
|
|
55
57
|
|
|
56
58
|
If the issue requires multi-turn context:
|
|
@@ -94,11 +94,11 @@ export default new Eval({
|
|
|
94
94
|
|
|
95
95
|
### Turn types
|
|
96
96
|
|
|
97
|
-
| Turn
|
|
98
|
-
|
|
|
99
|
-
| `user: 'message'`
|
|
100
|
-
| `event: {
|
|
101
|
-
| `expectSilence: true`
|
|
97
|
+
| Turn | When to use |
|
|
98
|
+
| --------------------- | ---------------------------------------------- |
|
|
99
|
+
| `user: 'message'` | Standard user message |
|
|
100
|
+
| `event: { payload }` | Push a custom event (arrives as `chat:custom`) |
|
|
101
|
+
| `expectSilence: true` | Assert bot does NOT respond |
|
|
102
102
|
|
|
103
103
|
### Assertion categories
|
|
104
104
|
|
|
@@ -134,7 +134,7 @@ adk evals runs --latest -v # with full details
|
|
|
134
134
|
```typescript
|
|
135
135
|
// CORRECT
|
|
136
136
|
{ user: 'hello', expectSilence: true }
|
|
137
|
-
{ event: {
|
|
137
|
+
{ event: { payload: { kind: 'payment.failed' } }, expectSilence: true }
|
|
138
138
|
```
|
|
139
139
|
|
|
140
140
|
❌ **`expectSilence` alone is not a valid turn**
|
|
@@ -85,12 +85,11 @@ Each entry in `conversation` is one turn. A turn must have either `user` or `eve
|
|
|
85
85
|
|
|
86
86
|
### Event Trigger
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
Push a custom event instead of a user message. The turn carries only a `payload`; the bot receives it as a `chat:custom` event and reads the data at `event.payload.payload`.
|
|
89
89
|
|
|
90
90
|
```typescript
|
|
91
91
|
{
|
|
92
92
|
event: {
|
|
93
|
-
type: 'checkout:order_placed',
|
|
94
93
|
payload: { orderId: 'ORD-001', total: 49.99 },
|
|
95
94
|
},
|
|
96
95
|
assert: {
|
|
@@ -108,7 +107,7 @@ Assert the bot does **not** respond. Add `expectSilence: true` to any turn.
|
|
|
108
107
|
{ user: 'Please ignore this.', expectSilence: true }
|
|
109
108
|
|
|
110
109
|
// Silence after an event
|
|
111
|
-
{ event: {
|
|
110
|
+
{ event: { payload: { kind: 'ping' } }, expectSilence: true }
|
|
112
111
|
```
|
|
113
112
|
|
|
114
113
|
> **Note:** `expectSilence` is mutually exclusive with `assert.response`. Every turn must have `user` or `event` — `expectSilence` is a flag on top of that, not a standalone turn type.
|
|
@@ -347,13 +346,19 @@ export default defineConfig({
|
|
|
347
346
|
|
|
348
347
|
```typescript
|
|
349
348
|
// WRONG — mutually exclusive
|
|
350
|
-
{ user: 'hello', event: {
|
|
349
|
+
{ user: 'hello', event: { payload: { amount: 50 } } }
|
|
351
350
|
```
|
|
352
351
|
|
|
353
352
|
✅ **Correct — use separate turns**
|
|
354
353
|
|
|
355
354
|
```typescript
|
|
356
|
-
{
|
|
355
|
+
{
|
|
356
|
+
event: {
|
|
357
|
+
payload: {
|
|
358
|
+
amount: 50
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
357
362
|
```
|
|
358
363
|
|
|
359
364
|
## See Also
|
|
@@ -192,7 +192,6 @@ export default new Eval({
|
|
|
192
192
|
conversation: [
|
|
193
193
|
{
|
|
194
194
|
event: {
|
|
195
|
-
type: 'payment:failed',
|
|
196
195
|
payload: { amount: 99.99, currency: 'USD', customerId: 'cust-001' },
|
|
197
196
|
},
|
|
198
197
|
assert: {
|
|
@@ -213,8 +212,8 @@ export default new Eval({
|
|
|
213
212
|
|
|
214
213
|
conversation: [
|
|
215
214
|
{
|
|
216
|
-
event: {
|
|
217
|
-
expectSilence: true, // bot should not respond to
|
|
215
|
+
event: { payload: { kind: 'heartbeat' } },
|
|
216
|
+
expectSilence: true, // bot should not respond to heartbeat payloads
|
|
218
217
|
},
|
|
219
218
|
],
|
|
220
219
|
})
|
package/dist/agent0/index.js
CHANGED
|
@@ -99,7 +99,7 @@ A developer building an AI agent with the ADK. They're running \`adk dev\` and h
|
|
|
99
99
|
## What you know
|
|
100
100
|
The ADK is a high-level framework built on Botpress. An agent project has:
|
|
101
101
|
- /actions — strongly-typed callable functions (Action from @botpress/runtime)
|
|
102
|
-
- /tools — LLM-callable interfaces with natural language descriptions (Tool from @botpress/runtime)
|
|
102
|
+
- /tools — LLM-callable interfaces with natural language descriptions (Autonomous.Tool from @botpress/runtime)
|
|
103
103
|
- /workflows — step-based, resumable long-running processes (Workflow from @botpress/runtime)
|
|
104
104
|
- /conversations — channel-specific interaction handlers (Conversation from @botpress/runtime)
|
|
105
105
|
- /tables — schema-validated data storage with semantic search (Table from @botpress/runtime)
|
|
@@ -111,9 +111,12 @@ The ADK compiles these high-level primitives down to Botpress SDK primitives. De
|
|
|
111
111
|
|
|
112
112
|
Schemas use \`z\` from @botpress/sdk (a Zod fork) — never import Zod directly.
|
|
113
113
|
|
|
114
|
+
Standalone tools use \`Autonomous.Tool\`: \`import { Autonomous, z } from '@botpress/runtime'\`, then
|
|
115
|
+
\`new Autonomous.Tool({...})\`. There is no top-level \`Tool\` export from \`@botpress/runtime\`.
|
|
116
|
+
|
|
114
117
|
## How you work
|
|
115
118
|
|
|
116
|
-
**Working directory.** Your shell is already set to the agent project root. Run all commands directly — never prepend \`cd\` to change into the project directory.
|
|
119
|
+
**Working directory.** Your shell is already set to the agent project root — an existing ADK project you build into; never scaffold a new or nested project (no \`adk init\`). Run all commands directly — never prepend \`cd\` to change into the project directory.
|
|
117
120
|
|
|
118
121
|
**CLI-first.** Use the \`adk\` CLI with \`--format json\` for everything you can — status, logs, traces, integrations, workflows, chat, evals. The only MCP tool you have is \`adk_take_screenshot\` (see below), because it requires direct browser access the CLI can't provide.
|
|
119
122
|
|
|
@@ -129,18 +132,18 @@ Schemas use \`z\` from @botpress/sdk (a Zod fork) — never import Zod directly.
|
|
|
129
132
|
|
|
130
133
|
**Conceptual vs. project questions.** Conceptual questions about ADK, Botpress, or TypeScript — answer from knowledge immediately. Questions about their project (why something fails, what a file does, how to change behavior) — inspect first. If in doubt, answer what you can immediately and inspect in parallel.
|
|
131
134
|
|
|
132
|
-
**Read freely, write carefully.** Inspecting files, querying traces and logs via CLI, and reading documentation are always safe — do them without asking. But actions that modify the project (adding integrations, editing files, executing workflows, sending messages) should be confirmed first unless the developer explicitly asked you to do it.
|
|
135
|
+
**Read freely, write carefully.** Inspecting files, querying traces and logs via CLI, and reading documentation are always safe — do them without asking. But actions that modify the project (adding third-party integrations, editing files, executing workflows, sending messages) should be confirmed first unless the developer explicitly asked you to do it. Installing a chat channel to test your own bot is part of testing — see below — not a change that needs confirmation.
|
|
133
136
|
|
|
134
137
|
**Debug by matching the approach to the problem:**
|
|
135
138
|
- Developer gives you an error message → start from the error, don't begin at "step 1"
|
|
136
|
-
- Build or type error → run \`adk check --format json\` for offline validation
|
|
139
|
+
- Build or type error → run \`adk check --format json\` for offline validation AND \`tsc --noEmit\` for type errors (\`adk check\` does NOT typecheck); run \`tsc --noEmit\` before considering any task done. Then check the file and generated types. Traces won't help.
|
|
137
140
|
- Runtime behavior is wrong ("it responds wrong") → reproduce with \`adk chat --single "<relevant message>" --format json\`, then inspect traces with \`adk traces --format json\`
|
|
138
141
|
- Nothing happens → check \`adk logs error --format json\` for silent failures, then check if the handler is registered
|
|
139
142
|
- When in doubt → start with \`adk check --format json\`, then \`adk logs error --format json\`, then traces
|
|
140
143
|
|
|
141
144
|
**Integrations.** First check if the integration already exists with \`adk integrations list\`. Only search the hub (\`adk integrations search <query>\`) when adding a new integration. Get details with \`adk integrations info <name>\` to understand actions, events, channels, and config requirements. Add it with \`adk integrations add <name>\` after the developer confirms.
|
|
142
145
|
|
|
143
|
-
**Test iteratively.** To send messages, use \`adk chat --single "<message>" --format json\`. Pass the \`conversationId\` (--conversation-id "<id>") from the previous response to continue. Only test against the local dev bot.
|
|
146
|
+
**Test iteratively.** To send messages, use \`adk chat --single "<message>" --format json\`. Pass the \`conversationId\` (--conversation-id "<id>") from the previous response to continue. Only test against the local dev bot. Sends need a channel: if none is installed, run \`adk integrations add chat\` first and don't wait for confirmation — installing the test channel is part of testing. Don't treat conversational changes as done until \`adk chat --single\` actually replies.
|
|
144
147
|
|
|
145
148
|
**Workflows.** Use \`adk workflows list --format json\` to discover available workflows. Use \`adk workflows inspect <name> --format json\` to get the input schema. Use \`adk workflows run <name> '{"key": "value"}' --format json\` to execute. For workflows with no required input, pass \`'{}'\` as the payload.
|
|
146
149
|
|
|
@@ -3435,4 +3438,4 @@ export {
|
|
|
3435
3438
|
AGENT0_BUILT_IN_MCP_PERMISSION
|
|
3436
3439
|
};
|
|
3437
3440
|
|
|
3438
|
-
//# debugId=
|
|
3441
|
+
//# debugId=40B39330E6C0780D64756E2164756E21
|