@botpress/adk 1.18.3 → 1.19.0-beta.10
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/agent-init/agent-project-generator.d.ts +10 -7
- package/dist/agent-init/agent-project-generator.d.ts.map +1 -1
- package/dist/agent-project/agent-project.d.ts +1 -1
- package/dist/agent-project/agent-project.d.ts.map +1 -1
- package/dist/agent-project/component-files.d.ts +10 -0
- package/dist/agent-project/component-files.d.ts.map +1 -0
- package/dist/agent-project/component-index-writer.d.ts +22 -0
- package/dist/agent-project/component-index-writer.d.ts.map +1 -0
- package/dist/agent-project/config-writer.d.ts +5 -0
- package/dist/agent-project/config-writer.d.ts.map +1 -1
- package/dist/agent-project/dependencies-parser.d.ts.map +1 -1
- package/dist/agent-project/file-watcher.d.ts.map +1 -1
- package/dist/agent-project/index.d.ts +3 -0
- package/dist/agent-project/index.d.ts.map +1 -1
- package/dist/agent-project/lock-to-dependencies.d.ts +11 -0
- package/dist/agent-project/lock-to-dependencies.d.ts.map +1 -0
- package/dist/agent-project/types.d.ts +1 -0
- package/dist/agent-project/types.d.ts.map +1 -1
- package/dist/agent-project/validation-errors.d.ts +1 -0
- package/dist/agent-project/validation-errors.d.ts.map +1 -1
- package/dist/agent0/capabilities/commands/adk-build.md +39 -0
- package/dist/agent0/capabilities/commands/adk-debug.md +23 -0
- package/dist/agent0/capabilities/commands/adk-dev-console.md +17 -0
- package/dist/agent0/capabilities/commands/adk-document.md +68 -0
- package/dist/agent0/capabilities/commands/adk-eval.md +17 -0
- package/dist/agent0/capabilities/commands/adk-explain.md +22 -0
- package/dist/agent0/capabilities/commands/adk-init.md +30 -0
- package/dist/agent0/capabilities/commands/adk-ship.md +29 -0
- package/dist/agent0/capabilities/commands/adk-test.md +27 -0
- package/dist/agent0/capabilities/commands/adk-validate.md +31 -0
- package/dist/agent0/capabilities/skills/adk/SKILL.md +548 -0
- package/dist/agent0/capabilities/skills/adk/references/actions.md +823 -0
- package/dist/agent0/capabilities/skills/adk/references/advanced-patterns.md +669 -0
- package/dist/agent0/capabilities/skills/adk/references/agent-config.md +450 -0
- package/dist/agent0/capabilities/skills/adk/references/assets.md +237 -0
- package/dist/agent0/capabilities/skills/adk/references/autonomous-execution.md +747 -0
- package/dist/agent0/capabilities/skills/adk/references/cli.md +1334 -0
- package/dist/agent0/capabilities/skills/adk/references/context-api.md +461 -0
- package/dist/agent0/capabilities/skills/adk/references/conversation-lifecycle.md +311 -0
- package/dist/agent0/capabilities/skills/adk/references/conversations.md +1111 -0
- package/dist/agent0/capabilities/skills/adk/references/custom-components.md +167 -0
- package/dist/agent0/capabilities/skills/adk/references/desk.md +852 -0
- package/dist/agent0/capabilities/skills/adk/references/evals.md +11 -0
- package/dist/agent0/capabilities/skills/adk/references/explain-config.md +424 -0
- package/dist/agent0/capabilities/skills/adk/references/files.md +918 -0
- package/dist/agent0/capabilities/skills/adk/references/integration-actions.md +659 -0
- package/dist/agent0/capabilities/skills/adk/references/integrations.md +266 -0
- package/dist/agent0/capabilities/skills/adk/references/interfaces.md +97 -0
- package/dist/agent0/capabilities/skills/adk/references/knowledge-bases.md +456 -0
- package/dist/agent0/capabilities/skills/adk/references/mcp-server.md +112 -0
- package/dist/agent0/capabilities/skills/adk/references/messages.md +769 -0
- package/dist/agent0/capabilities/skills/adk/references/model-configuration.md +201 -0
- package/dist/agent0/capabilities/skills/adk/references/patterns-mistakes.md +469 -0
- package/dist/agent0/capabilities/skills/adk/references/plugins.md +280 -0
- package/dist/agent0/capabilities/skills/adk/references/tables.md +1136 -0
- package/dist/agent0/capabilities/skills/adk/references/tags.md +516 -0
- package/dist/agent0/capabilities/skills/adk/references/tools.md +581 -0
- package/dist/agent0/capabilities/skills/adk/references/triggers.md +719 -0
- package/dist/agent0/capabilities/skills/adk/references/workflow-steps.md +851 -0
- package/dist/agent0/capabilities/skills/adk/references/workflows.md +1408 -0
- package/dist/agent0/capabilities/skills/adk/references/zai-agent-reference.md +454 -0
- package/dist/agent0/capabilities/skills/adk/references/zai-complete-guide.md +1408 -0
- package/dist/agent0/capabilities/skills/adk-debugger/SKILL.md +257 -0
- package/dist/agent0/capabilities/skills/adk-debugger/references/common-failures.md +231 -0
- package/dist/agent0/capabilities/skills/adk-debugger/references/conversation-analysis.md +420 -0
- package/dist/agent0/capabilities/skills/adk-debugger/references/debug-workflow.md +239 -0
- package/dist/agent0/capabilities/skills/adk-debugger/references/llm-debugging.md +209 -0
- package/dist/agent0/capabilities/skills/adk-debugger/references/trace-summarization.md +313 -0
- package/dist/agent0/capabilities/skills/adk-debugger/references/traces-and-logs.md +203 -0
- package/dist/agent0/capabilities/skills/adk-dev-console/SKILL.md +111 -0
- package/dist/agent0/capabilities/skills/adk-dev-console/references/agent-steps.md +115 -0
- package/dist/agent0/capabilities/skills/adk-dev-console/references/component-registry.md +43 -0
- package/dist/agent0/capabilities/skills/adk-dev-console/references/multi-agent-dashboard.md +70 -0
- package/dist/agent0/capabilities/skills/adk-dev-console/references/pages.md +273 -0
- package/dist/agent0/capabilities/skills/adk-docs/SKILL.md +114 -0
- package/dist/agent0/capabilities/skills/adk-docs/references/doc-standards.md +124 -0
- package/dist/agent0/capabilities/skills/adk-evals/SKILL.md +244 -0
- package/dist/agent0/capabilities/skills/adk-evals/references/eval-format.md +354 -0
- package/dist/agent0/capabilities/skills/adk-evals/references/test-patterns.md +355 -0
- package/dist/agent0/capabilities/skills/adk-evals/references/testing-workflow.md +225 -0
- package/dist/agent0/config/index.d.ts +5 -0
- package/dist/agent0/config/index.d.ts.map +1 -0
- package/dist/agent0/config/paths.d.ts +12 -0
- package/dist/agent0/config/paths.d.ts.map +1 -0
- package/dist/agent0/config/schema.d.ts +171 -0
- package/dist/agent0/config/schema.d.ts.map +1 -0
- package/dist/agent0/config/secrets.d.ts +4 -0
- package/dist/agent0/config/secrets.d.ts.map +1 -0
- package/dist/agent0/config/store.d.ts +26 -0
- package/dist/agent0/config/store.d.ts.map +1 -0
- package/dist/agent0/index.d.ts +6 -0
- package/dist/agent0/index.d.ts.map +1 -0
- package/dist/agent0/index.js +3381 -0
- package/dist/agent0/index.js.map +29 -0
- package/dist/agent0/providers/catalog.d.ts +189 -0
- package/dist/agent0/providers/catalog.d.ts.map +1 -0
- package/dist/agent0/providers/index.d.ts +4 -0
- package/dist/agent0/providers/index.d.ts.map +1 -0
- package/dist/agent0/providers/registry.d.ts +32 -0
- package/dist/agent0/providers/registry.d.ts.map +1 -0
- package/dist/agent0/providers/source.d.ts +105 -0
- package/dist/agent0/providers/source.d.ts.map +1 -0
- package/dist/agent0/runtime/client.d.ts +49 -0
- package/dist/agent0/runtime/client.d.ts.map +1 -0
- package/dist/agent0/runtime/engine.d.ts +79 -0
- package/dist/agent0/runtime/engine.d.ts.map +1 -0
- package/dist/agent0/runtime/index.d.ts +7 -0
- package/dist/agent0/runtime/index.d.ts.map +1 -0
- package/dist/agent0/runtime/manager.d.ts +81 -0
- package/dist/agent0/runtime/manager.d.ts.map +1 -0
- package/dist/agent0/runtime/permissions.d.ts +6 -0
- package/dist/agent0/runtime/permissions.d.ts.map +1 -0
- package/dist/agent0/runtime/process.d.ts +52 -0
- package/dist/agent0/runtime/process.d.ts.map +1 -0
- package/dist/agent0/runtime/project-discovery.d.ts +5 -0
- package/dist/agent0/runtime/project-discovery.d.ts.map +1 -0
- package/dist/agent0/types.d.ts +447 -0
- package/dist/agent0/types.d.ts.map +1 -0
- package/dist/assets/manager.d.ts +0 -2
- package/dist/assets/manager.d.ts.map +1 -1
- package/dist/assets/types.d.ts +3 -1
- package/dist/assets/types.d.ts.map +1 -1
- package/dist/auth/credentials.d.ts.map +1 -1
- package/dist/auth/index.d.ts +30 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/service.d.ts.map +1 -1
- package/dist/bot-generator/dev-id-manager.d.ts.map +1 -1
- package/dist/bot-generator/generator.d.ts +5 -1
- package/dist/bot-generator/generator.d.ts.map +1 -1
- package/dist/bot-generator/integration-sync.d.ts +2 -0
- package/dist/bot-generator/integration-sync.d.ts.map +1 -1
- package/dist/bot-generator/interface-sync.d.ts +2 -0
- package/dist/bot-generator/interface-sync.d.ts.map +1 -1
- package/dist/bot-generator/plugin-sync.d.ts +2 -0
- package/dist/bot-generator/plugin-sync.d.ts.map +1 -1
- package/dist/bot-generator/table-validation.d.ts +17 -0
- package/dist/bot-generator/table-validation.d.ts.map +1 -0
- package/dist/chat-bundle.cjs +31 -0
- package/dist/cognitive/models.d.ts +32 -0
- package/dist/cognitive/models.d.ts.map +1 -0
- package/dist/commands/base-command.d.ts +1 -0
- package/dist/commands/base-command.d.ts.map +1 -1
- package/dist/commands/bp-add-command.d.ts.map +1 -1
- package/dist/commands/bp-build-command.d.ts.map +1 -1
- package/dist/commands/bp-chat-command.d.ts.map +1 -1
- package/dist/commands/bp-cli.d.ts +1 -0
- package/dist/commands/bp-cli.d.ts.map +1 -1
- package/dist/commands/bp-cli.js +147 -0
- package/dist/commands/bp-cli.js.map +12 -0
- package/dist/commands/bp-deploy-command.d.ts.map +1 -1
- package/dist/commands/bp-dev-command.d.ts +7 -0
- package/dist/commands/bp-dev-command.d.ts.map +1 -1
- package/dist/commands/bp-dev-stderr.d.ts +21 -0
- package/dist/commands/bp-dev-stderr.d.ts.map +1 -0
- package/dist/commands/bp-dev-worker-env.d.ts +7 -0
- package/dist/commands/bp-dev-worker-env.d.ts.map +1 -0
- package/dist/commands/index.d.ts +0 -5
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/config/manager.d.ts +9 -1
- package/dist/config/manager.d.ts.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/dependencies/alias-utils.d.ts +13 -0
- package/dist/dependencies/alias-utils.d.ts.map +1 -0
- package/dist/dependencies/dependency-manager.d.ts +89 -0
- package/dist/dependencies/dependency-manager.d.ts.map +1 -0
- package/dist/dependencies/errors.d.ts +19 -0
- package/dist/dependencies/errors.d.ts.map +1 -0
- package/dist/dependencies/index.d.ts +17 -0
- package/dist/dependencies/index.d.ts.map +1 -0
- package/dist/dependencies/index.js +6233 -0
- package/dist/dependencies/index.js.map +61 -0
- package/dist/dependencies/json-utils.d.ts +3 -0
- package/dist/dependencies/json-utils.d.ts.map +1 -0
- package/dist/dependencies/lock-file.d.ts +15 -0
- package/dist/dependencies/lock-file.d.ts.map +1 -0
- package/dist/dependencies/migration.d.ts +8 -0
- package/dist/dependencies/migration.d.ts.map +1 -0
- package/dist/dependencies/registry/integration-registry.d.ts +17 -0
- package/dist/dependencies/registry/integration-registry.d.ts.map +1 -0
- package/dist/dependencies/registry/interface-registry.d.ts +11 -0
- package/dist/dependencies/registry/interface-registry.d.ts.map +1 -0
- package/dist/dependencies/registry/plugin-registry.d.ts +16 -0
- package/dist/dependencies/registry/plugin-registry.d.ts.map +1 -0
- package/dist/dependencies/resolvers/integration-resolver.d.ts +30 -0
- package/dist/dependencies/resolvers/integration-resolver.d.ts.map +1 -0
- package/dist/dependencies/resolvers/plugin-resolver.d.ts +38 -0
- package/dist/dependencies/resolvers/plugin-resolver.d.ts.map +1 -0
- package/dist/dependencies/types.d.ts +254 -0
- package/dist/dependencies/types.d.ts.map +1 -0
- package/dist/deploy-manifest/index.d.ts +608 -0
- package/dist/deploy-manifest/index.d.ts.map +1 -0
- package/dist/file-watcher/watcher.d.ts +21 -5
- package/dist/file-watcher/watcher.d.ts.map +1 -1
- package/dist/generators/action-types.d.ts.map +1 -1
- package/dist/generators/assets.d.ts +2 -2
- package/dist/generators/assets.d.ts.map +1 -1
- package/dist/generators/client-wrapper.d.ts.map +1 -1
- package/dist/generators/tests.d.ts +6 -6
- package/dist/generators/tests.d.ts.map +1 -1
- package/dist/generators/utils.d.ts.map +1 -1
- package/dist/index.d.ts +15 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17614 -5514
- package/dist/index.js.map +83 -66
- package/dist/integrations/config-utils.d.ts.map +1 -1
- package/dist/integrations/hub-cache.d.ts.map +1 -1
- package/dist/integrations/index.d.ts +0 -6
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/manager.d.ts +17 -1
- package/dist/integrations/manager.d.ts.map +1 -1
- package/dist/interfaces/index.d.ts +0 -2
- package/dist/interfaces/index.d.ts.map +1 -1
- package/dist/interfaces/manager.d.ts +3 -1
- package/dist/interfaces/manager.d.ts.map +1 -1
- package/dist/interfaces/parser.d.ts.map +1 -1
- package/dist/knowledge/manager.d.ts +3 -1
- package/dist/knowledge/manager.d.ts.map +1 -1
- package/dist/knowledge/types.d.ts +2 -2
- package/dist/knowledge/types.d.ts.map +1 -1
- package/dist/plugins/manager.d.ts +34 -1
- package/dist/plugins/manager.d.ts.map +1 -1
- package/dist/preflight/checker.d.ts +5 -6
- package/dist/preflight/checker.d.ts.map +1 -1
- package/dist/preflight/index.d.ts +2 -2
- package/dist/preflight/index.d.ts.map +1 -1
- package/dist/preflight/types.d.ts +30 -32
- package/dist/preflight/types.d.ts.map +1 -1
- package/dist/runner/script-runner.d.ts +2 -0
- package/dist/runner/script-runner.d.ts.map +1 -1
- package/dist/runner/supervise-child.d.ts +24 -0
- package/dist/runner/supervise-child.d.ts.map +1 -0
- package/dist/secrets/manager.d.ts.map +1 -1
- package/dist/tables/table-manager.d.ts.map +1 -1
- package/dist/tables/types.d.ts +3 -2
- package/dist/tables/types.d.ts.map +1 -1
- package/dist/templates/README.md +14 -13
- package/dist/templates/blank/agent.config.ts +0 -3
- package/dist/templates/blank/evals/index.eval.ts +30 -0
- package/dist/templates/blank/src/conversations/index.ts +16 -16
- package/dist/templates/blank/tsconfig.json +1 -1
- package/dist/templates/botpress-desk/README.md +87 -0
- package/dist/templates/botpress-desk/agent.config.ts +19 -0
- package/dist/templates/botpress-desk/evals/index.eval.ts +30 -0
- package/dist/templates/botpress-desk/package.json +17 -0
- package/dist/templates/botpress-desk/src/actions/index.ts +19 -0
- package/dist/templates/botpress-desk/src/conversations/index.ts +16 -0
- package/dist/templates/botpress-desk/src/knowledge/index.ts +20 -0
- package/dist/templates/botpress-desk/src/tables/index.ts +16 -0
- package/dist/templates/botpress-desk/src/tools/handToSupport.ts +23 -0
- package/dist/templates/botpress-desk/src/triggers/index.ts +17 -0
- package/dist/templates/botpress-desk/src/workflows/index.ts +21 -0
- package/dist/templates/crm-enrichment/agent.config.ts +0 -3
- package/dist/templates/crm-enrichment/evals/example.eval.ts +29 -0
- package/dist/templates/crm-enrichment/package.json +1 -0
- package/dist/templates/crm-enrichment/tsconfig.json +1 -1
- package/dist/templates/hello-world/agent.config.ts +0 -3
- package/dist/templates/hello-world/evals/context-retention.eval.ts +37 -0
- package/dist/templates/hello-world/evals/greeting.eval.ts +43 -0
- package/dist/templates/hello-world/package.json +1 -0
- package/dist/templates/hello-world/tsconfig.json +1 -1
- package/dist/templates/knowledge-assistant/agent.config.ts +0 -3
- package/dist/templates/knowledge-assistant/evals/engineering-practices.eval.ts +45 -0
- package/dist/templates/knowledge-assistant/evals/out-of-scope.eval.ts +33 -0
- package/dist/templates/knowledge-assistant/evals/pto-policy.eval.ts +44 -0
- package/dist/templates/knowledge-assistant/package.json +1 -0
- package/dist/templates/knowledge-assistant/tsconfig.json +1 -1
- package/dist/templates/slack-triage/agent.config.ts +0 -8
- package/dist/templates/slack-triage/evals/triage-basic.eval.ts +9 -39
- package/dist/templates/slack-triage/package.json +1 -0
- package/dist/templates/slack-triage/src/conversations/slack-dm.ts +4 -1
- package/dist/templates/slack-triage/tsconfig.json +1 -1
- package/dist/templates/template.config.json +16 -16
- package/dist/test-utils/mock-module.d.ts +29 -0
- package/dist/test-utils/mock-module.d.ts.map +1 -0
- package/dist/utils/require-chat.d.ts +3 -24
- package/dist/utils/require-chat.d.ts.map +1 -1
- package/dist/utils/search-ranking.d.ts +15 -0
- package/dist/utils/search-ranking.d.ts.map +1 -0
- package/dist/utils/source-map-optimizer.d.ts +10 -11
- package/dist/utils/source-map-optimizer.d.ts.map +1 -1
- package/dist/workspace/workspace-cache.d.ts.map +1 -1
- package/package.json +23 -11
- package/dist/commands/copilot-config-reader.d.ts +0 -12
- package/dist/commands/copilot-config-reader.d.ts.map +0 -1
- package/dist/commands/copilot-server.d.ts +0 -26
- package/dist/commands/copilot-server.d.ts.map +0 -1
- package/dist/commands/opencode-config.d.ts +0 -29
- package/dist/commands/opencode-config.d.ts.map +0 -1
- package/dist/integrations/checker.d.ts +0 -41
- package/dist/integrations/checker.d.ts.map +0 -1
- package/dist/integrations/operations.d.ts +0 -140
- package/dist/integrations/operations.d.ts.map +0 -1
- package/dist/integrations/sync-manager.d.ts +0 -19
- package/dist/integrations/sync-manager.d.ts.map +0 -1
- package/dist/interfaces/operations.d.ts +0 -48
- package/dist/interfaces/operations.d.ts.map +0 -1
- package/dist/preflight/formatter.d.ts +0 -12
- package/dist/preflight/formatter.d.ts.map +0 -1
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
# Knowledge Bases
|
|
2
|
+
|
|
3
|
+
Knowledge Bases enable RAG (Retrieval Augmented Generation) by indexing documents, websites, and structured data for semantic search and AI-powered responses.
|
|
4
|
+
|
|
5
|
+
## Basic Concepts
|
|
6
|
+
|
|
7
|
+
### What are Knowledge Bases?
|
|
8
|
+
|
|
9
|
+
- **RAG implementation**: Enhance AI responses with relevant context
|
|
10
|
+
- **Multiple sources**: Index local files, websites, or table data
|
|
11
|
+
- **Semantic search**: Find relevant information based on meaning
|
|
12
|
+
- **Auto-chunking**: Documents are automatically split for optimal retrieval
|
|
13
|
+
|
|
14
|
+
### File Location
|
|
15
|
+
|
|
16
|
+
- **Location**: `src/knowledge/*.ts`
|
|
17
|
+
- **Auto-registration**: Knowledge bases are automatically available to AI
|
|
18
|
+
|
|
19
|
+
## Creating Knowledge Bases
|
|
20
|
+
|
|
21
|
+
### Basic Structure
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { Knowledge, DataSource } from "@botpress/runtime";
|
|
25
|
+
|
|
26
|
+
// Define a data source
|
|
27
|
+
const docsSource = DataSource.Directory.fromPath("src/knowledge/docs", {
|
|
28
|
+
id: "docs",
|
|
29
|
+
filter: (path) => path.endsWith(".md") || path.endsWith(".pdf"),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Create knowledge base
|
|
33
|
+
export const DocsKnowledgeBase = new Knowledge({
|
|
34
|
+
name: "docsKB",
|
|
35
|
+
description: "Documentation knowledge base",
|
|
36
|
+
sources: [docsSource],
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Data Source Types
|
|
41
|
+
|
|
42
|
+
### 1. Local Files (Directory)
|
|
43
|
+
|
|
44
|
+
Index local markdown, PDF, and text files:
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
const docsSource = DataSource.Directory.fromPath("src/knowledge", {
|
|
48
|
+
id: "docs",
|
|
49
|
+
|
|
50
|
+
// Filter specific file types
|
|
51
|
+
filter: (path) => {
|
|
52
|
+
return (
|
|
53
|
+
path.endsWith(".md") || path.endsWith(".pdf") || path.endsWith(".txt")
|
|
54
|
+
);
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Note**: Local file sources are for development only and won't work in production.
|
|
60
|
+
|
|
61
|
+
### 2. Website Crawling
|
|
62
|
+
|
|
63
|
+
Index websites via sitemap or direct URLs:
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
// From sitemap
|
|
67
|
+
const websiteSource = DataSource.Website.fromSitemap(
|
|
68
|
+
"https://docs.example.com/sitemap.xml",
|
|
69
|
+
{
|
|
70
|
+
id: "website",
|
|
71
|
+
maxPages: 500, // Maximum pages to crawl (1-50000)
|
|
72
|
+
maxDepth: 3, // Maximum crawl depth (1-20)
|
|
73
|
+
fetch: "node:fetch", // Optional: 'node:fetch' or 'integration:browser'
|
|
74
|
+
|
|
75
|
+
// Filter pages
|
|
76
|
+
filter: (context) => {
|
|
77
|
+
// Skip archive pages
|
|
78
|
+
if (context.url.includes("/archive/")) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
// Only include documentation pages
|
|
82
|
+
return context.url.includes("/docs/");
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
// From direct URLs
|
|
88
|
+
const urlsSource = DataSource.Website.fromUrls(
|
|
89
|
+
[
|
|
90
|
+
"https://example.com/page1",
|
|
91
|
+
"https://example.com/page2",
|
|
92
|
+
"https://example.com/page3",
|
|
93
|
+
],
|
|
94
|
+
{
|
|
95
|
+
id: "specific_pages",
|
|
96
|
+
},
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
// From llms.txt (AI-friendly site manifest)
|
|
100
|
+
const llmsTxtSource = DataSource.Website.fromLlmsTxt(
|
|
101
|
+
"https://example.com/llms.txt",
|
|
102
|
+
{
|
|
103
|
+
id: "llms_txt",
|
|
104
|
+
maxPages: 100,
|
|
105
|
+
},
|
|
106
|
+
);
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 3. Table-Based
|
|
110
|
+
|
|
111
|
+
Table-backed knowledge sources are not fully implemented yet. The shape below is useful as a forward-looking pattern, but today you should treat it as experimental and prefer directory- or website-backed sources for production workflows.
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import { FAQTable } from "../tables/FAQ";
|
|
115
|
+
|
|
116
|
+
const tableSource = DataSource.Table.fromTable(FAQTable, {
|
|
117
|
+
id: "faq_kb",
|
|
118
|
+
|
|
119
|
+
// Transform row data into searchable text
|
|
120
|
+
transform: ({ row }) => {
|
|
121
|
+
return `Question: ${row.question}
|
|
122
|
+
|
|
123
|
+
Answer: ${row.answer}
|
|
124
|
+
|
|
125
|
+
Category: ${row.category}
|
|
126
|
+
Tags: ${row.tags.join(", ")}`;
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
// Optional: Filter rows
|
|
130
|
+
filter: ({ row }) => {
|
|
131
|
+
return row.published === true;
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### 4. Multiple Sources
|
|
137
|
+
|
|
138
|
+
Combine different source types:
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
export const CombinedKnowledgeBase = new Knowledge({
|
|
142
|
+
name: "combinedKB",
|
|
143
|
+
description: "Knowledge from multiple sources",
|
|
144
|
+
sources: [
|
|
145
|
+
// Local documentation
|
|
146
|
+
DataSource.Directory.fromPath("src/knowledge/docs", {
|
|
147
|
+
id: "local_docs",
|
|
148
|
+
}),
|
|
149
|
+
|
|
150
|
+
// Website documentation
|
|
151
|
+
DataSource.Website.fromSitemap("https://docs.example.com/sitemap.xml", {
|
|
152
|
+
id: "online_docs",
|
|
153
|
+
maxPages: 100,
|
|
154
|
+
}),
|
|
155
|
+
|
|
156
|
+
// FAQ from database
|
|
157
|
+
DataSource.Table.fromTable(FAQTable, {
|
|
158
|
+
id: "faq",
|
|
159
|
+
transform: ({ row }) => `Q: ${row.question}\nA: ${row.answer}`,
|
|
160
|
+
}),
|
|
161
|
+
],
|
|
162
|
+
});
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Using Knowledge Bases
|
|
166
|
+
|
|
167
|
+
### In Conversations
|
|
168
|
+
|
|
169
|
+
Provide knowledge bases to AI during execution:
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
import { Conversation } from "@botpress/runtime";
|
|
173
|
+
import { DocsKnowledgeBase, FAQKnowledgeBase } from "../knowledge";
|
|
174
|
+
|
|
175
|
+
export const Chat = new Conversation({
|
|
176
|
+
channel: "chat.channel",
|
|
177
|
+
|
|
178
|
+
async handler({ execute }) {
|
|
179
|
+
await execute({
|
|
180
|
+
instructions:
|
|
181
|
+
"You are a helpful assistant. Use the provided knowledge to answer questions accurately.",
|
|
182
|
+
|
|
183
|
+
// Add knowledge bases
|
|
184
|
+
knowledge: [DocsKnowledgeBase, FAQKnowledgeBase],
|
|
185
|
+
|
|
186
|
+
// Optional: Add tools that can search knowledge
|
|
187
|
+
tools: [searchTool],
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### In Workflows
|
|
194
|
+
|
|
195
|
+
Knowledge bases work the same in workflows:
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
import { Workflow } from "@botpress/runtime";
|
|
199
|
+
import { DocsKnowledgeBase } from "../knowledge";
|
|
200
|
+
|
|
201
|
+
export const ResearchWorkflow = new Workflow({
|
|
202
|
+
name: "research",
|
|
203
|
+
|
|
204
|
+
handler: async ({ input, execute }) => {
|
|
205
|
+
const result = await execute({
|
|
206
|
+
instructions: `Research the topic: ${input.topic}`,
|
|
207
|
+
knowledge: [DocsKnowledgeBase],
|
|
208
|
+
model: "openai:gpt-4o",
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
return { research: result };
|
|
212
|
+
},
|
|
213
|
+
});
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Manual Search
|
|
217
|
+
|
|
218
|
+
Search knowledge bases programmatically:
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
import { context } from "@botpress/runtime";
|
|
222
|
+
import { DocsKnowledgeBase } from "../knowledge";
|
|
223
|
+
|
|
224
|
+
export const searchAction = new Action({
|
|
225
|
+
name: "searchDocs",
|
|
226
|
+
input: z.object({ query: z.string() }),
|
|
227
|
+
|
|
228
|
+
async handler({ input }) {
|
|
229
|
+
const client = context.get("client");
|
|
230
|
+
|
|
231
|
+
// Search knowledge base
|
|
232
|
+
const { passages } = await client.searchFiles({
|
|
233
|
+
query: input.query,
|
|
234
|
+
tags: {
|
|
235
|
+
source: "knowledge-base",
|
|
236
|
+
kbName: [DocsKnowledgeBase.name],
|
|
237
|
+
},
|
|
238
|
+
limit: 5,
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
return {
|
|
242
|
+
results: passages.map((p) => ({
|
|
243
|
+
content: p.content,
|
|
244
|
+
score: p.score,
|
|
245
|
+
source: p.file.key,
|
|
246
|
+
})),
|
|
247
|
+
};
|
|
248
|
+
},
|
|
249
|
+
});
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Syncing Knowledge Bases
|
|
253
|
+
|
|
254
|
+
As of ADK 1.9+, knowledge bases are synced using the `adk kb` command, which runs automatically during `adk dev` and `adk deploy`.
|
|
255
|
+
|
|
256
|
+
### CLI Sync (Recommended)
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
# Interactive KB management
|
|
260
|
+
adk kb
|
|
261
|
+
|
|
262
|
+
# Non-interactive sync
|
|
263
|
+
adk kb sync -y
|
|
264
|
+
|
|
265
|
+
# Check sync status
|
|
266
|
+
adk kb status
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
The KB sync:
|
|
270
|
+
|
|
271
|
+
1. Detects all knowledge bases in your project
|
|
272
|
+
2. Identifies sources (directories, websites, tables)
|
|
273
|
+
3. Computes file hashes to detect changes
|
|
274
|
+
4. Syncs only changed content to Botpress Cloud
|
|
275
|
+
5. Handles orphaned sources (sources removed from code)
|
|
276
|
+
|
|
277
|
+
### Automatic Sync
|
|
278
|
+
|
|
279
|
+
KB sync runs automatically during:
|
|
280
|
+
|
|
281
|
+
- `adk dev` - Syncs on startup and file changes
|
|
282
|
+
- `adk deploy` - Syncs before deployment
|
|
283
|
+
|
|
284
|
+
## Refreshing Knowledge Bases
|
|
285
|
+
|
|
286
|
+
Refresh knowledge bases programmatically:
|
|
287
|
+
|
|
288
|
+
```typescript
|
|
289
|
+
// Smart refresh - only changed files (uses SHA256 hashing)
|
|
290
|
+
await MyKnowledgeBase.refresh();
|
|
291
|
+
|
|
292
|
+
// Force refresh - re-indexes everything
|
|
293
|
+
await MyKnowledgeBase.refresh({ force: true });
|
|
294
|
+
|
|
295
|
+
// Refresh specific source
|
|
296
|
+
await MyKnowledgeBase.refreshSource("docs");
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
For scheduled or triggered refresh, use the same refresh methods in workflows, actions, or conversation handlers.
|
|
300
|
+
|
|
301
|
+
## Citations and References
|
|
302
|
+
|
|
303
|
+
Track knowledge sources used in responses:
|
|
304
|
+
|
|
305
|
+
```typescript
|
|
306
|
+
const citations = context.get("citations");
|
|
307
|
+
|
|
308
|
+
// Register source when using knowledge passage
|
|
309
|
+
const { tag } = citations.registerSource({
|
|
310
|
+
file: passage.file.key,
|
|
311
|
+
title: passage.file.tags.title,
|
|
312
|
+
url: passage.file.tags.url,
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
// Include citation tag in content
|
|
316
|
+
const citedContent = `<${tag}>${passage.content}</${tag}>`;
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
For complete citation implementation examples, see the autonomous execution documentation.
|
|
320
|
+
|
|
321
|
+
## Advanced Patterns
|
|
322
|
+
|
|
323
|
+
### Dynamic Knowledge Sources
|
|
324
|
+
|
|
325
|
+
Select knowledge bases based on user context:
|
|
326
|
+
|
|
327
|
+
```typescript
|
|
328
|
+
// Select knowledge based on user department
|
|
329
|
+
const knowledgeBases = [GeneralKB];
|
|
330
|
+
|
|
331
|
+
if (user.department === "engineering") {
|
|
332
|
+
knowledgeBases.push(EngineeringKB, TechnicalDocsKB);
|
|
333
|
+
} else if (user.department === "sales") {
|
|
334
|
+
knowledgeBases.push(SalesKB, ProductKB);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// Pass to execute()
|
|
338
|
+
await execute({
|
|
339
|
+
instructions: "Answer based on department-specific knowledge",
|
|
340
|
+
knowledge: knowledgeBases,
|
|
341
|
+
});
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### Content Transformation
|
|
345
|
+
|
|
346
|
+
Enhance content with metadata before indexing (Table and Website sources support transform):
|
|
347
|
+
|
|
348
|
+
```typescript
|
|
349
|
+
// Table source with transformation
|
|
350
|
+
const docsTableSource = DataSource.Table.fromTable(DocsTable, {
|
|
351
|
+
id: "docs_table",
|
|
352
|
+
|
|
353
|
+
// Filter specific rows
|
|
354
|
+
filter: ({ row }) => {
|
|
355
|
+
return row.status === "published" && !row.deprecated;
|
|
356
|
+
},
|
|
357
|
+
|
|
358
|
+
// Transform row data into searchable text with metadata
|
|
359
|
+
transform: ({ row }) => {
|
|
360
|
+
return `
|
|
361
|
+
Title: ${row.title}
|
|
362
|
+
Category: ${row.category}
|
|
363
|
+
Tags: ${row.tags.join(", ")}
|
|
364
|
+
Author: ${row.author}
|
|
365
|
+
|
|
366
|
+
${row.content}`;
|
|
367
|
+
},
|
|
368
|
+
});
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
**Note**: Directory sources only support `filter`, not `transform`. Use Table or Website sources for content transformation.
|
|
372
|
+
|
|
373
|
+
### Multi-Language Support
|
|
374
|
+
|
|
375
|
+
Create separate knowledge bases per language:
|
|
376
|
+
|
|
377
|
+
```typescript
|
|
378
|
+
export const EnglishKB = new Knowledge({
|
|
379
|
+
name: "englishKB",
|
|
380
|
+
sources: [DataSource.Directory.fromPath("src/knowledge/en", { id: "docs_en" })],
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
export const SpanishKB = new Knowledge({
|
|
384
|
+
name: "spanishKB",
|
|
385
|
+
sources: [DataSource.Directory.fromPath("src/knowledge/es", { id: "docs_es" })],
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
// Select based on user language
|
|
389
|
+
const kb = userLanguage === "es" ? SpanishKB : EnglishKB;
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
## Best Practices
|
|
393
|
+
|
|
394
|
+
### 1. Organize Content Logically
|
|
395
|
+
|
|
396
|
+
```
|
|
397
|
+
src/knowledge/
|
|
398
|
+
├── docs/
|
|
399
|
+
│ ├── getting-started/
|
|
400
|
+
│ ├── api-reference/
|
|
401
|
+
│ └── tutorials/
|
|
402
|
+
├── policies/
|
|
403
|
+
│ ├── privacy.md
|
|
404
|
+
│ └── terms.md
|
|
405
|
+
└── faqs/
|
|
406
|
+
├── technical.md
|
|
407
|
+
└── billing.md
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
### 2. Use Clear Naming
|
|
411
|
+
|
|
412
|
+
```typescript
|
|
413
|
+
// ✅ Good
|
|
414
|
+
export const TechnicalDocsKB = new Knowledge({ name: "technicalDocs" });
|
|
415
|
+
export const CustomerFAQKB = new Knowledge({ name: "customerFAQ" });
|
|
416
|
+
|
|
417
|
+
// ❌ Bad
|
|
418
|
+
export const KB1 = new Knowledge({ name: "kb1" });
|
|
419
|
+
export const Stuff = new Knowledge({ name: "stuff" });
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
### 3. Refresh Frequently-Changing Content
|
|
423
|
+
|
|
424
|
+
Use `adk kb sync` during development, or call `refresh()` programmatically for dynamic content.
|
|
425
|
+
|
|
426
|
+
### 4. Structure Content for Search
|
|
427
|
+
|
|
428
|
+
Add summaries, keywords, and clear headings to improve retrieval quality.
|
|
429
|
+
|
|
430
|
+
### 5. Monitor Search Performance
|
|
431
|
+
|
|
432
|
+
Track search metrics (query, result count, duration) to identify slow queries or poor results.
|
|
433
|
+
|
|
434
|
+
## Troubleshooting
|
|
435
|
+
|
|
436
|
+
### Common Issues
|
|
437
|
+
|
|
438
|
+
1. **Knowledge not found by AI**
|
|
439
|
+
- Verify knowledge base is included in `execute()` call
|
|
440
|
+
- Check that content has been indexed (`refresh()`)
|
|
441
|
+
- Ensure file types are supported
|
|
442
|
+
|
|
443
|
+
2. **Poor search results**
|
|
444
|
+
- Review content structure and formatting
|
|
445
|
+
- Add metadata and keywords
|
|
446
|
+
- Adjust the `factor` parameter for ranking
|
|
447
|
+
|
|
448
|
+
3. **Refresh not working**
|
|
449
|
+
- Check file permissions
|
|
450
|
+
- Verify source paths are correct
|
|
451
|
+
- Look for errors in transform functions
|
|
452
|
+
|
|
453
|
+
4. **Large files causing issues**
|
|
454
|
+
- Files are automatically chunked, but very large files may need manual splitting
|
|
455
|
+
- Consider breaking into smaller documents
|
|
456
|
+
- Use filtering to exclude unnecessary content
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# ADK MCP Server
|
|
2
|
+
|
|
3
|
+
The ADK includes a built-in MCP (Model Context Protocol) server that enables AI assistants like Claude Code, Cursor, and VS Code to interact with your ADK project.
|
|
4
|
+
|
|
5
|
+
## Quick Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# From your ADK project root (auto-detects project)
|
|
9
|
+
adk mcp:init --all
|
|
10
|
+
|
|
11
|
+
# Or specify project directory (for monorepos)
|
|
12
|
+
adk mcp:init --all --project-dir ./bot
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This generates configuration files for:
|
|
16
|
+
- **Claude Code**: `.mcp.json`
|
|
17
|
+
- **VS Code**: `.vscode/mcp.json`
|
|
18
|
+
- **Cursor**: `.cursor/mcp.json`
|
|
19
|
+
|
|
20
|
+
## What It Provides
|
|
21
|
+
|
|
22
|
+
Once configured, AI assistants gain tools to:
|
|
23
|
+
|
|
24
|
+
- **Debug** - Query traces, get dev logs, check build status
|
|
25
|
+
- **Test** - Send messages to your running bot and receive responses
|
|
26
|
+
- **Discover** - Search and explore integrations on the Botpress Hub
|
|
27
|
+
- **Manage** - Add integrations, start workflows, get agent info
|
|
28
|
+
- **Docs** - Search Botpress documentation (proxied from Mintlify)
|
|
29
|
+
|
|
30
|
+
The MCP server exposes its own tool descriptions - your AI assistant will see what's available.
|
|
31
|
+
|
|
32
|
+
> **Current limitation:** The MCP server is useful for inspection, testing, and project-aware tooling, but its init flow is not the most reliable unattended bootstrap path right now. The MCP `adk_init_project` tool is out of sync with the CLI template names and can still fall into interactive login/link flows. For scripted setup, prefer the shell flow: `adk login --token "$BOTPRESS_TOKEN"`, then `adk init <name> --yes --skip-link`.
|
|
33
|
+
|
|
34
|
+
## Commands
|
|
35
|
+
|
|
36
|
+
### adk mcp
|
|
37
|
+
|
|
38
|
+
Start the MCP server (called automatically by AI assistants via config).
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
adk mcp [--cwd <path>]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### adk mcp:init
|
|
45
|
+
|
|
46
|
+
Generate MCP configuration files.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
adk mcp:init [options]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Options:**
|
|
53
|
+
- `--tool <name>` - Generate for specific tool (claude-code, vscode, cursor)
|
|
54
|
+
- `--all` - Generate for all supported tools
|
|
55
|
+
- `--force` - Overwrite existing config
|
|
56
|
+
- `--project-dir <path>` - ADK project subdirectory (for monorepos)
|
|
57
|
+
|
|
58
|
+
## Monorepo Setup
|
|
59
|
+
|
|
60
|
+
When your ADK project is in a subdirectory:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
my-monorepo/
|
|
64
|
+
├── bot/ # ADK project (agent.config.ts here)
|
|
65
|
+
├── frontend/
|
|
66
|
+
└── .mcp.json # Config created at root
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The generated config includes `--cwd` to target the correct directory:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"mcpServers": {
|
|
74
|
+
"adk": {
|
|
75
|
+
"command": "adk",
|
|
76
|
+
"args": ["mcp", "--cwd", "./bot"]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Requirements
|
|
83
|
+
|
|
84
|
+
- **ADK CLI** installed and in PATH
|
|
85
|
+
- **For project tools:** Valid ADK project with `agent.config.ts`
|
|
86
|
+
- **For messaging/workflow tools:** `adk dev` server running on the default console port `3001`
|
|
87
|
+
|
|
88
|
+
## Troubleshooting
|
|
89
|
+
|
|
90
|
+
**"Not in an ADK project directory"**
|
|
91
|
+
- Ensure `--cwd` points to directory with `agent.config.ts`
|
|
92
|
+
|
|
93
|
+
**"Dev server is not running"**
|
|
94
|
+
- Start the dev server: `adk dev`
|
|
95
|
+
|
|
96
|
+
**"MCP can connect, but messaging/workflow tools fail"**
|
|
97
|
+
- Use the default console port: `adk dev --port-console 3001`
|
|
98
|
+
- Current MCP dev-server-backed tools assume `http://localhost:3001`
|
|
99
|
+
|
|
100
|
+
**"No chat or webchat integration found"**
|
|
101
|
+
- Add an integration: `adk add chat` or `adk add webchat`
|
|
102
|
+
|
|
103
|
+
**Inspect the MCP server:**
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
npx @modelcontextprotocol/inspector adk mcp
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## See Also
|
|
110
|
+
|
|
111
|
+
- **[CLI Reference](./cli.md)** - All ADK CLI commands
|
|
112
|
+
- **[Agent Configuration](./agent-config.md)** - agent.config.ts setup
|