docs(adk): create State and Configuration concept pages#449
docs(adk): create State and Configuration concept pages#449jacksonyzj wants to merge 8 commits intomasterfrom
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
…fig:get defaults note
|
|
||
| export default defineConfig({ | ||
| name: "my-agent", | ||
| description: "An AI agent built with Botpress ADK", |
There was a problem hiding this comment.
| description: "An AI agent built with Botpress ADK", | |
| description: "An AI agent built with the Botpress ADK", |
| apiKey: z.string(), | ||
| maxRetries: z.number().default(3), |
There was a problem hiding this comment.
suggestion: If this snippet is meant to show only the structure of the config file, we should avoid showing specific schemas.
| chat: { version: "chat@0.7.7", enabled: true }, | ||
| webchat: { version: "webchat@0.3.0", enabled: true }, |
| ```typescript | ||
| import { z, defineConfig } from "@botpress/runtime"; | ||
|
|
||
| export default defineConfig({ |
| Custom event definitions. Each key is an event name, with an optional schema and description. | ||
| </ResponseField> | ||
| <ResponseField name="evals" type="object"> | ||
| Optional evaluation settings. |
There was a problem hiding this comment.
Most settings are optional, so unless we start mentioning it across the board, I don't think we need it here.
| ``` | ||
|
|
||
| <Note> | ||
| There is no dedicated secrets API in the ADK. For integration-specific credentials (like OAuth tokens), configure them in `agent.config.ts` under `dependencies` or via the Botpress dashboard. See [Managing Integrations](/adk/managing-integrations) for details. |
| chat: { version: "chat@0.7.7", enabled: true }, | ||
| webchat: { version: "webchat@0.3.0", enabled: true }, | ||
| slack: { version: "slack@1.0.0", enabled: true }, |
There was a problem hiding this comment.
This is also outdated according to the latest beta release.
|
|
||
| ### User state | ||
|
|
||
| Import `user` from `@botpress/runtime` to access per-user state inside any handler, action, tool, or workflow: |
There was a problem hiding this comment.
| Import `user` from `@botpress/runtime` to access per-user state inside any handler, action, tool, or workflow: | |
| Import `user` from `@botpress/runtime` to access current-user state inside any handler, action, tool, or workflow: |
| user.tags.role = "admin"; | ||
| ``` | ||
|
|
||
| Conversation tags are accessed via the `conversation` instance in handlers: |
There was a problem hiding this comment.
| Conversation tags are accessed via the `conversation` instance in handlers: | |
| Conversation tags are accessed via a `conversation` instance: |
since you can also do Conversation.get(<id>)
|
|
||
| ### Conversation state | ||
|
|
||
| Conversation state is accessed via the `state` parameter in the handler: |
There was a problem hiding this comment.
| Conversation state is accessed via the `state` parameter in the handler: | |
| Conversation state is accessed via the `state` parameter in the handler or on a Conversation instance: |
| title: State | ||
| --- | ||
|
|
||
| State lets your agent persist data across conversations, users, and the entire bot. The ADK provides three state scopes, each with different lifetimes and access patterns. |
There was a problem hiding this comment.
| State lets your agent persist data across conversations, users, and the entire bot. The ADK provides three state scopes, each with different lifetimes and access patterns. | |
| State lets your agent store and reuse data across conversations, users, and the entire bot. The ADK provides three types of states, depending on how long you need the data and who should have access to it. |
Suggesting a less technical heavy sentence but can reword to fit what you mean
| | Scope | Lifetime | Access | Defined in | | ||
| |-------|----------|--------|------------| | ||
| | Bot | Global, shared across all users and conversations | `bot.state` | `agent.config.ts` | | ||
| | User | Per-user, persists across all of a user's conversations | `user.state` | `agent.config.ts` | |
There was a problem hiding this comment.
| | User | Per-user, persists across all of a user's conversations | `user.state` | `agent.config.ts` | | |
| | User | Per-user, available across all of a user's conversations | `user.state` | `agent.config.ts` | |
|
|
||
| Define bot and user state schemas in `agent.config.ts`: | ||
|
|
||
| ```typescript highlight={8-11, 14-18} |
There was a problem hiding this comment.
Not completely sure what you're highlighting, I think this is off
|
|
||
| Conversation state is accessed via the `state` parameter in the handler: | ||
|
|
||
| ```typescript |
There was a problem hiding this comment.
can use a highlight here to show what you mean
| ``` | ||
|
|
||
| <Note> | ||
| State changes are automatically tracked and persisted. You don't need to call a save method: just mutate the state object directly. |
There was a problem hiding this comment.
| State changes are automatically tracked and persisted. You don't need to call a save method: just mutate the state object directly. | |
| State changes are handled automatically. You don't need to call a save method, just update the state object directly. |
|
|
||
| Define tag schemas in `agent.config.ts`: | ||
|
|
||
| ```typescript highlight={5-11} |
There was a problem hiding this comment.
highlight looks off
| ``` | ||
|
|
||
| <Note> | ||
| System tags (set by integrations, containing `:` in the key) are read-only. You can read them but any writes are silently ignored. |
There was a problem hiding this comment.
I think an example code would help here instead of using a note
|
|
||
| ## State references | ||
|
|
||
| You can store references to workflow instances in state. They are automatically serialized when saved and loaded back as full instances when read: |
There was a problem hiding this comment.
| You can store references to workflow instances in state. They are automatically serialized when saved and loaded back as full instances when read: | |
| You can store workflow instances in state. They are saved automatically and loaded back as full instances when read: |
Unless serialized is an important term, this just needs to be reworded
|
|
||
| You can store references to workflow instances in state. They are automatically serialized when saved and loaded back as full instances when read: | ||
|
|
||
| ```typescript |
There was a problem hiding this comment.
instead of commenting in the code, can highlight whats relevant
| }, | ||
| ``` | ||
|
|
||
| See [Managing Integrations](/adk/managing-integrations) for details on adding, removing, and configuring integrations. |
There was a problem hiding this comment.
the managing integration page is mentioned like 3 times in this guide. Could limit it to one and maybe cut how often we mention it.
Summary
Two new concept pages for State and Configuration, filling gaps in the ADK documentation.
Tickets
State page covers
agent.config.tsand Conversation definitionsReference.Workflow()bot.idanduser.ididentity accessorsConfiguration page covers
defineConfigreference with all options (includingevals)configurationruntime import (read-only proxy)adk config/config:get/config:setwith--prodflag (with real CLI output)process.envinagent.config.ts)adk configis separate from integration configurationconfig:getreads persisted values only, not schema defaultsTest plan
adk config,config:set,config:geton real bot