Skip to content

Commit d8fe2ce

Browse files
jacksonyzjclaude
andcommitted
Merge Adrian's ADK docs audit into final audit
Incorporates PR #461 (adrian-kahali): - Get Started restructure: welcome -> introduction, new top-level quickstart, updated docs.json sidebar - Configuration page: <Tip> blocks linking to related guides, expandable config snippet, cleaner prose - Environment setup: consolidated secrets + config explanations, better wording - Integrations: clearer intro, CLI section labelled - Conversations: <CodeGroup> for channel matching, <Tip> blocks for cross-references - AI execution: <Note> for LLMz reference, tighter phrasing - Tools: highlight annotations on code blocks Conflicts resolved in favor of keeping the audit fixes from this branch (correct default model order, ms units for idleTimeout, evals/ path, agent-steps screenshot, no trailing Cards, no standalone Dev console sections, "Botpress Cloud" wording, real CLI reference secrets table instead of placeholder link) while taking Adrian's <Tip>/<Note> block styling and structural improvements. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 parents bc98145 + 6994579 commit d8fe2ce

11 files changed

Lines changed: 309 additions & 211 deletions

File tree

adk/conversations/ai-execution.mdx

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
---
22
title: Run AI agents in a conversation
3-
description: Use execute() to hand messages to the AI model.
3+
description: Use `execute()` to hand messages to the AI model.
44
---
55

6-
`execute()` is the primary way your agent responds to users. It starts an AI loop that iterates until the model reaches a conclusion. On each iteration, the model can read the conversation, call tools, and generate code. The loop ends when the model sends a message to the user (and waits for a reply), triggers an exit, or hits the iteration limit (default 10, configurable).
6+
The `execute()` function is the primary way your agent responds to users. It starts an AI loop that iterates until the model reaches a conclusion. On each iteration, the model can read the conversation, call tools, and generate code.
77

8-
The `await` resolves once the loop finishes. Under the hood, `execute()` is powered by [llmz](https://github.com/botpress/botpress/tree/master/packages/llmz).
8+
The loop ends when the model sends a message to the user (and waits for a reply), triggers an exit, or hits the iteration limit (which defaults to 10 and is configurable).
9+
10+
The `await` resolves once the loop finishes.
11+
12+
<Note>
13+
Under the hood, `execute()` is powered by [LLMz](https://github.com/botpress/botpress/tree/master/packages/llmz).
14+
</Note>
915

1016
## Basic usage
1117

12-
```typescript
18+
```typescript highlight={4-6}
1319
export default new Conversation({
1420
channel: "webchat.channel",
1521
handler: async ({ execute }) => {
@@ -24,13 +30,15 @@ The model reads the full conversation transcript, follows your instructions, and
2430

2531
## Instructions
2632

27-
Instructions tell the model how to behave. They can be a static string or a function that returns a string:
33+
Pass instructions into the `instructions` field to tell the model how to behave. They can be a static string or a function that returns a string:
2834

29-
```typescript
35+
```typescript highlight={3, 8-13}
36+
// String
3037
await execute({
3138
instructions: "You are a helpful assistant that speaks formally.",
3239
})
3340

41+
// Function that returns a string
3442
await execute({
3543
instructions: () => {
3644
const hour = new Date().getHours()
@@ -45,25 +53,29 @@ Instructions are evaluated fresh on each execution. Use a function when you need
4553

4654
## Knowledge
4755

48-
Attach knowledge bases to give the model access to your documents:
56+
Pass knowledge bases into the `knowledge` field to give the model access to your documents:
4957

50-
```typescript
58+
```typescript highlight={6}
5159
import { DocsKB } from "../knowledge/docs"
52-
import { FAQKB } from "../knowledge/faq"
60+
import { FaqKB } from "../knowledge/faq"
5361

5462
await execute({
5563
instructions: "Answer questions using the documentation.",
56-
knowledge: [DocsKB, FAQKB],
64+
knowledge: [DocsKB, FaqKB],
5765
})
5866
```
5967

60-
The model automatically searches the knowledge bases when it needs information. Results include citations that trace back to the source documents. See [Knowledge bases](/adk/data/knowledge) for how to define them.
68+
The model automatically searches the knowledge bases when it needs information. Results include citations that trace back to the source documents.
69+
70+
<Tip>
71+
For more information on defining knowledge bases, check out the [Knowledge base documentation](/adk/data/knowledge).
72+
</Tip>
6173

6274
## Tools
6375

64-
Give the model functions it can call:
76+
Give the model functions it can call by passing them into the `tools` field:
6577

66-
```typescript
78+
```typescript highlight={6}
6779
import { getWeather } from "../tools/weather"
6880
import { createTicket } from "../tools/ticket"
6981

@@ -77,7 +89,7 @@ The model decides when to call a tool based on the conversation. For a full guid
7789

7890
## Exits
7991

80-
Exits let the model end execution with a structured result:
92+
Pass in `exits` to let the model end execution with a structured result:
8193

8294
```typescript
8395
import { Autonomous, z } from "@botpress/runtime"
@@ -104,7 +116,7 @@ if (result.exit?.name === "handoffToHuman") {
104116

105117
## Model override
106118

107-
Override the default model for a specific execution:
119+
You can override the default model for a specific execution:
108120

109121
```typescript
110122
await execute({
@@ -126,6 +138,8 @@ The default model is set in `agent.config.ts` under `defaultModels.autonomous`.
126138

127139
## Temperature and reasoning
128140

141+
To control the model's temperature and reasoning effort, use the `temperature` and `reasoningEffort` props:
142+
129143
```typescript
130144
await execute({
131145
instructions: "You are a helpful assistant.",
@@ -150,7 +164,7 @@ await execute({
150164
})
151165
```
152166

153-
Defaults to 10, clamped between 1 and 100.
167+
The number of iterations defaults to 10 and is clamped between 1 and 100.
154168

155169
## Cancellation
156170

@@ -179,7 +193,7 @@ await execute({
179193
})
180194
```
181195

182-
In worker mode, the model processes without sending messages to the conversation.
196+
In worker mode, the model executes without sending messages to the conversation.
183197

184198
## Hooks
185199

adk/conversations/setup.mdx

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,45 @@ You can test your conversation using the **Chat** page in the dev console. This
3535

3636
The `channel` field determines which integration channels this conversation handles:
3737

38-
```typescript
39-
// Match all channels
40-
channel: "*"
41-
42-
// Match a specific channel
43-
channel: "webchat.channel"
44-
45-
// Match multiple channels
46-
channel: ["webchat.channel", "chat.channel"]
47-
```
48-
49-
When you use `"*"`, the handler runs for any channel but `message` and `event` are typed as `unknown`. Specifying a channel gives you strict types on message payloads, event payloads, and the conversation instance:
38+
<CodeGroup>
39+
```ts All channels highlight={2} theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
40+
export default new Conversation({
41+
channel: "*",
42+
handler: async ({ execute }) => {
43+
await execute({
44+
instructions: "You are a helpful assistant.",
45+
});
46+
},
47+
});
48+
```
49+
50+
```ts Specific channel highlight={2} theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
51+
export default new Conversation({
52+
channel: "webchat.channel",
53+
handler: async ({ execute }) => {
54+
await execute({
55+
instructions: "You are a helpful assistant.",
56+
});
57+
},
58+
});
59+
```
60+
61+
```ts Array of channels highlight={2-5} theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
62+
export default new Conversation({
63+
channel: [
64+
"chat.channel",
65+
"webchat.channel"
66+
],
67+
handler: async ({ execute }) => {
68+
await execute({
69+
instructions: "You are a helpful assistant.",
70+
});
71+
},
72+
});
73+
```
74+
</CodeGroup>
75+
76+
When you use `"*"`, the handler runs for any channel, but `message` and `event` are typed as `unknown`. Specifying a channel gives you strict types on message payloads, event payloads, and the conversation instance:
5077

5178
```typescript
5279
// channel: "*" — message.payload is unknown
@@ -165,7 +192,7 @@ Events use the format `"integration:eventName"` for integration events, or just
165192

166193
Each conversation can declare its own state schema, separate from the bot and user state in `agent.config.ts`:
167194

168-
```typescript
195+
```typescript highlight={3-6}
169196
export default new Conversation({
170197
channel: "webchat.channel",
171198
state: z.object({
@@ -182,4 +209,8 @@ export default new Conversation({
182209
})
183210
```
184211

185-
Conversation state is automatically persisted between handler calls. For more on state scopes (conversation vs bot vs user), see [Manage states](/adk/conversations/state).
212+
Conversation state is automatically persisted between handler calls.
213+
214+
<Tip>
215+
For more information about state scopes (conversation vs. bot vs. user), check out our guide on [managing states](/adk/conversations/state).
216+
</Tip>

adk/conversations/tools.mdx

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The `input` and `output` schemas use Zod. Use `.describe()` on each field so the
3939

4040
Pass tools to `execute()` via the `tools` array:
4141

42-
```typescript
42+
```typescript highlight={10}
4343
import { Conversation } from "@botpress/runtime"
4444
import getWeather from "../tools/weather"
4545
import createTicket from "../tools/ticket"
@@ -61,7 +61,7 @@ The model decides which tools to call based on the conversation. It can call mul
6161

6262
You can define tools directly inside a handler without creating a separate file:
6363

64-
```typescript
64+
```typescript highlight={6-15, 19}
6565
import { Autonomous, z, Conversation } from "@botpress/runtime"
6666

6767
export default new Conversation({
@@ -86,7 +86,7 @@ export default new Conversation({
8686
})
8787
```
8888

89-
This is useful for tools that are only relevant to a single conversation.
89+
This is useful for tools that are only relevant to a single type of conversation.
9090

9191
## Writing good descriptions
9292

@@ -115,7 +115,7 @@ Tools can throw signals to influence the AI loop without returning a normal resu
115115

116116
### ThinkSignal
117117

118-
Throws context back into the model's reasoning without producing a tool output. Useful when a tool finds no results and you want the model to try a different approach:
118+
A `ThinkSignal` throws context back into the model's reasoning without producing a tool output. This is useful when a tool finds no results and you want the model to try a different approach:
119119

120120
```typescript
121121
import { Autonomous } from "@botpress/runtime"
@@ -136,9 +136,11 @@ handler: async ({ query }) => {
136136

137137
## Actions as tools
138138

139-
Actions are reusable functions that can be called from anywhere in your agent (conversations, workflows, other actions, or external API clients). Unlike standalone tools, which only exist inside `execute()`, actions are shared primitives. You can convert any action into a tool:
139+
Actions are reusable functions that can be called from anywhere in your agentconversations, workflows, other actions, or external API clients. Tools only work inside `execute()`, where the AI model decides when to call them based on the conversation.
140140

141-
```typescript
141+
You can convert any action into a tool by calling its `asTool()` method and passing it into `tools`:
142+
143+
```typescript highlight={8}
142144
import { Conversation, actions } from "@botpress/runtime"
143145

144146
export default new Conversation({
@@ -152,13 +154,15 @@ export default new Conversation({
152154
})
153155
```
154156

155-
See [Build Actions](/adk/external/actions) for how to define actions.
157+
<Tip>
158+
Check out our guide on [building actions](/adk/external/actions) for more information.
159+
</Tip>
156160

157161
## Workflows as tools
158162

159163
Workflows are long-running background processes that can span multiple steps and run independently of the conversation. Converting a workflow to a tool lets the model kick one off:
160164

161-
```typescript
165+
```typescript highlight={9}
162166
import { Conversation } from "@botpress/runtime"
163167
import orderWorkflow from "../workflows/order"
164168

@@ -173,13 +177,15 @@ export default new Conversation({
173177
})
174178
```
175179

176-
See [Create workflows](/adk/workflows/create) for how to define workflows.
180+
<Tip>
181+
Check out our guide on [creating workflows](/adk/workflows/create) for more information.
182+
</Tip>
177183

178184
## Calling actions from tools
179185

180186
Tools can call actions for reusable logic:
181187

182-
```typescript
188+
```typescript highlight={8}
183189
import { Autonomous, actions, z } from "@botpress/runtime"
184190

185191
export default new Autonomous.Tool({

adk/get-started/quickstart.mdx

Lines changed: 0 additions & 94 deletions
This file was deleted.

0 commit comments

Comments
 (0)