-
Notifications
You must be signed in to change notification settings - Fork 70
docs(adk): create State and Configuration concept pages #449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jacksonyzj
wants to merge
29
commits into
master
Choose a base branch
from
feat/adk-new-concept-pages
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+482
−1
Open
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
b7fcda1
docs(adk): create State and Configuration concept pages (ADK-304, ADK…
jacksonyzj 2caa13c
docs(adk): fix default models to match adk init output
jacksonyzj ae3222a
docs(adk): add real CLI output, clarify adk config vs integration config
jacksonyzj 89ebacc
docs(adk): add env variables section, evals config option (ADK-303)
jacksonyzj ae07f2a
docs(adk): minor wording fixes in state and configuration pages
jacksonyzj f076eb2
docs(adk): improve env variables section with practical API key example
jacksonyzj 279df58
docs(adk): add state references section (ADK-304)
jacksonyzj 448ce44
docs(adk): fix state context wording, Reference.Workflow example, con…
jacksonyzj 04e5c87
docs(adk): apply review fixes — description wording, current-user, co…
jacksonyzj 57cc715
docs(adk): update integration config to string shorthand, settings in…
jacksonyzj be41fb7
docs(adk): remove redundant 'optional' from evals description
jacksonyzj c16c816
docs(adk): move config:get defaults note to Note block
jacksonyzj 6094fd8
docs(adk): remove environment variables section
jacksonyzj f7164f9
docs(adk): simplify state intro and user state wording
jacksonyzj 54140fb
docs(adk): fix highlights, simplify state tracking note
jacksonyzj a978f11
docs(adk): remove highlights from state examples
jacksonyzj 0a0ebcc
docs(adk): reduce Managing Integrations mentions to one
jacksonyzj 6ca5431
docs(adk): fix all highlight line numbers in state examples
jacksonyzj 620a360
docs(adk): system tags code example, simplify state references, fix h…
jacksonyzj 32ba3cf
docs(adk): add lead-in text before tags example
jacksonyzj c7fbcb8
docs(adk): remove unshipped conversation instance state, add .describ…
jacksonyzj 5594929
docs(adk): fix conversation state highlight off by one
jacksonyzj 9e2e922
docs(adk): remove highlight from tags example
jacksonyzj b1cdb0c
docs(adk): fix state references highlight lines
jacksonyzj 19e9f0a
docs(adk): reduce Note blocks in managing configuration section
jacksonyzj e4d5111
docs(adk): rename Interactive configuration to Validate configuration
jacksonyzj 890b19c
docs(adk): add Managing Integrations link to config note
jacksonyzj be79b7f
docs(adk): remove unnecessary highlight from custom events example
jacksonyzj b4798d3
Merge branch 'master' into feat/adk-new-concept-pages
adkah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,250 @@ | ||
| --- | ||
| title: Configuration | ||
| --- | ||
|
|
||
| Configuration defines your agent's identity, models, state schemas, dependencies, and runtime settings. Everything is centralized in `agent.config.ts`. | ||
|
|
||
| ## `agent.config.ts` | ||
|
|
||
| The main configuration file uses `defineConfig` from `@botpress/runtime`: | ||
|
|
||
| ```typescript | ||
| import { z, defineConfig } from "@botpress/runtime"; | ||
|
|
||
| export default defineConfig({ | ||
| name: "my-agent", | ||
| description: "An AI agent built with the Botpress ADK", | ||
|
|
||
| defaultModels: { | ||
| autonomous: "cerebras:gpt-oss-120b", | ||
| zai: "cerebras:gpt-oss-120b", | ||
| }, | ||
|
|
||
| bot: { | ||
| state: z.object({}), | ||
| tags: {}, | ||
| }, | ||
|
|
||
| user: { | ||
| state: z.object({}), | ||
| tags: {}, | ||
| }, | ||
|
|
||
| conversation: { | ||
| tags: {}, | ||
| }, | ||
|
|
||
| message: { | ||
| tags: {}, | ||
| }, | ||
|
|
||
| workflow: { | ||
| tags: {}, | ||
| }, | ||
|
|
||
| configuration: { | ||
| schema: z.object({ | ||
| apiKey: z.string(), | ||
| maxRetries: z.number().default(3), | ||
|
Comment on lines
+47
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: If this snippet is meant to show only the structure of the config file, we should avoid showing specific schemas. |
||
| }), | ||
| }, | ||
|
|
||
| dependencies: { | ||
| integrations: { | ||
| chat: "chat@0.7.7", | ||
| webchat: "webchat@0.3.0", | ||
| }, | ||
| }, | ||
| }); | ||
| ``` | ||
|
|
||
| ## Config options | ||
|
|
||
| <Expandable title="defineConfig options"> | ||
| <ResponseField name="name" type="string"> | ||
| Agent name. Used to identify your agent in the Botpress dashboard. | ||
| </ResponseField> | ||
| <ResponseField name="description" type="string"> | ||
| Optional description of your agent. | ||
| </ResponseField> | ||
| <ResponseField name="defaultModels" type="object"> | ||
| Default LLM models for your agent. | ||
| <Expandable title="properties"> | ||
| <ResponseField name="autonomous" type="string"> | ||
| Model used for `execute()` calls in conversations and workflows. | ||
| </ResponseField> | ||
| <ResponseField name="zai" type="string"> | ||
| Model used for Zai operations (`zai.extract()`, `zai.check()`, etc.). | ||
| </ResponseField> | ||
| </Expandable> | ||
| </ResponseField> | ||
| <ResponseField name="bot" type="object"> | ||
| Bot-level state schema and tags. See [State](/adk/concepts/state). | ||
| </ResponseField> | ||
| <ResponseField name="user" type="object"> | ||
| User-level state schema and tags. See [State](/adk/concepts/state). | ||
| </ResponseField> | ||
| <ResponseField name="conversation" type="object"> | ||
| Conversation-level tags. | ||
| </ResponseField> | ||
| <ResponseField name="message" type="object"> | ||
| Message-level tags. | ||
| </ResponseField> | ||
| <ResponseField name="workflow" type="object"> | ||
| Workflow-level tags. | ||
| </ResponseField> | ||
| <ResponseField name="configuration" type="object"> | ||
| Runtime configuration schema. Values are set via `adk config` and accessed at runtime via the `configuration` import. | ||
| <Expandable title="properties"> | ||
| <ResponseField name="schema" type="z.ZodObject" required> | ||
| A Zod object schema defining the configuration fields. Must be `z.object()`. | ||
| </ResponseField> | ||
| </Expandable> | ||
| </ResponseField> | ||
| <ResponseField name="dependencies" type="object"> | ||
| Integration and interface dependencies. See [Managing Integrations](/adk/managing-integrations). | ||
| </ResponseField> | ||
| <ResponseField name="events" type="object"> | ||
| Custom event definitions. Each key is an event name, with an optional schema and description. | ||
| </ResponseField> | ||
| <ResponseField name="evals" type="object"> | ||
| Evaluation settings. | ||
| <Expandable title="properties"> | ||
| <ResponseField name="idleTimeout" type="number"> | ||
| Timeout in seconds for idle eval conversations. | ||
| </ResponseField> | ||
| <ResponseField name="judgePassThreshold" type="number"> | ||
| Pass threshold for LLM judge assertions (1-5). | ||
| </ResponseField> | ||
| <ResponseField name="judgeModel" type="string"> | ||
| Model to use for LLM judge assertions (e.g., `"openai:gpt-4o"`). | ||
| </ResponseField> | ||
| </Expandable> | ||
| </ResponseField> | ||
| </Expandable> | ||
|
|
||
| ## Accessing configuration at runtime | ||
|
|
||
| Import `configuration` from `@botpress/runtime` to access your agent's configuration values: | ||
|
|
||
| ```typescript | ||
| import { configuration } from "@botpress/runtime"; | ||
|
|
||
| const apiKey = configuration.apiKey; | ||
| const maxRetries = configuration.maxRetries; | ||
| ``` | ||
|
|
||
| Configuration values are defined by the `configuration.schema` in `agent.config.ts` and set via the `adk config` command or the Botpress dashboard. | ||
|
|
||
| <Note> | ||
| Configuration is read-only at runtime. Attempting to set a value will throw an error. | ||
| </Note> | ||
|
|
||
| ## Managing configuration | ||
|
|
||
| ### Validate configuration | ||
|
|
||
| Run `adk config` to validate all configuration values and set any that are missing: | ||
|
|
||
| ```bash | ||
| adk config | ||
| ``` | ||
|
|
||
| ```txt | ||
| 📝 Configuration (development) | ||
|
|
||
| ✓ Configuration validated successfully | ||
| ``` | ||
|
|
||
| This validates your values against the schema and prompts for any missing or invalid fields. Requires a `configuration.schema` in your `agent.config.ts`. | ||
|
|
||
| ### Get and set values | ||
|
|
||
| Set and retrieve individual configuration values. Note that `config:get` reads persisted values only and does not resolve schema defaults: | ||
|
|
||
| ```bash | ||
| adk config:set supportEmail "help@mycompany.com" | ||
| ``` | ||
|
|
||
| ```txt | ||
| ✓ Configuration updated (development) | ||
| supportEmail = help@mycompany.com | ||
| ``` | ||
|
|
||
| ```bash | ||
| adk config:get supportEmail | ||
| ``` | ||
|
|
||
| ```txt | ||
| 📝 Configuration value (development) | ||
|
|
||
| Key: supportEmail | ||
| Value: help@mycompany.com | ||
| ``` | ||
|
|
||
| ### Production configuration | ||
|
|
||
| Use the `--prod` flag to manage production configuration separately from development: | ||
|
|
||
| ```bash | ||
| adk config --prod | ||
| adk config:set supportEmail "help@mycompany.com" --prod | ||
| adk config:get supportEmail --prod | ||
| ``` | ||
|
|
||
| <Note> | ||
| Agent configuration (`adk config`) is separate from integration configuration. Integration settings like API keys are managed in the Control Panel during `adk dev`. See [Managing Integrations](/adk/managing-integrations) for details. | ||
| </Note> | ||
|
|
||
| ## Default models | ||
|
|
||
| The `defaultModels` field sets which LLM models your agent uses: | ||
|
|
||
| ```typescript | ||
| defaultModels: { | ||
| autonomous: "cerebras:gpt-oss-120b", | ||
| zai: "cerebras:gpt-oss-120b", | ||
| }, | ||
| ``` | ||
|
|
||
| - **`autonomous`**: used by `execute()` in conversations and workflows | ||
| - **`zai`**: used by Zai operations like `zai.extract()`, `zai.check()`, `zai.text()` | ||
|
|
||
| You can override the model per-call using the `model` prop on `execute()`. | ||
|
|
||
| ## Custom events | ||
|
|
||
| Define custom events that your agent can emit and listen to: | ||
|
|
||
| ```typescript | ||
| export default defineConfig({ | ||
| name: "my-agent", | ||
| events: { | ||
| orderPlaced: { | ||
| description: "Fired when an order is placed", | ||
| schema: z.object({ | ||
| orderId: z.string(), | ||
| total: z.number(), | ||
| }), | ||
| }, | ||
| }, | ||
| }); | ||
| ``` | ||
|
|
||
| Custom events can be subscribed to in [Triggers](/adk/concepts/triggers) and [Conversations](/adk/concepts/conversations) (via the `events` prop). | ||
|
|
||
| ## Dependencies | ||
|
|
||
| The `dependencies` field declares which integrations your agent uses: | ||
|
|
||
| ```typescript | ||
| dependencies: { | ||
| integrations: { | ||
| chat: "chat@0.7.7", | ||
| webchat: "webchat@0.3.0", | ||
| slack: "slack@1.0.0", | ||
| }, | ||
| }, | ||
| ``` | ||
|
|
||
| Integration settings (API keys, tokens, etc.) are configured in the Control Panel during `adk dev`, not in `agent.config.ts`. | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.