[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M77837HGP680MFYVHKZHT10V":3,"skill-same:01M77837HGP680MFYVHKZHT10V":55},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":32,"commitSha":33,"skillDirectory":34,"forksCount":35,"repositoryHtmlUrl":36,"repositoryHomepageUrl":6,"ownerHtmlUrl":37,"ownerBlogUrl":38,"ownerDescription":39,"updatedAt":40,"install":41,"resources":54},"01M77837HGP680MFYVHKZHT10V","adk",null,"A guide to build AI bots with Botpress's Agent Development Kit (ADK)","javimosch\u002Fopen-claw-skills","javimosch","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F12900508?v=4","01M6D3F2AS6PV75ET9PZ1QGP8J","Javier Leandro Arancibia","01M75B8NCTAJG9WH5YNZH7C3D8",0,"MIT","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fyueranlu\u002Fbotpress-adk\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: adk\ndescription: A guide to build AI bots with Botpress's Agent Development Kit (ADK)\nversion: 1.0.0\nauthor: yueranlu\ntags: [botpress, adk, chatbot, ai, typescript]\nhomepage: https:\u002F\u002Fgithub.com\u002Fbotpress\u002Fadk\n---\n\n# Botpress ADK Development Guide\n\nA comprehensive guide for building AI bots with the Botpress Agent Development Kit (ADK).\n\n## When to Use\n\n- User asks to build a Botpress bot or chatbot\n- User mentions ADK, Agent Development Kit, or Botpress\n- User wants to create actions, tools, workflows, conversations, tables, triggers, or knowledge bases\n- User needs help with `adk` CLI commands (init, dev, deploy, link)\n- User has ADK-related errors or needs troubleshooting\n- User asks about bot configuration, state management, or integrations\n\n## Quick Reference\n\nThe ADK is a **convention-based TypeScript framework** where **file structure maps directly to bot behavior**.\n\n**Your role:** Guide users through the entire bot development lifecycle - from project setup to deployment. Use the patterns and code examples in this skill to write correct, working ADK code.\n\n**Key principle:** In ADK, **where you put files matters**. Each component type has a specific `src\u002F` subdirectory, and files are auto-discovered based on location.\n\n## How to Use This Skill\n\n**This skill is your primary reference for building Botpress bots.** When a user asks you to build something with the ADK:\n\n1. **Identify what they need** - Is it a new bot, a feature (action, tool, workflow), data storage (table), or event handling (trigger)?\n2. **Check the correct directory** - Each component type goes in a specific `src\u002F` subdirectory\n3. **Use the patterns below** - Follow the code examples exactly, they represent the correct ADK conventions\n4. **Run `adk --help`** - For CLI commands not covered here, or `adk \u003Ccommand> --help` for specific help\n\n**Decision Guide - What Component to Create:**\n\n| User Wants To... | Create This | Location |\n|------------------|-------------|----------|\n| Handle user messages | Conversation | `src\u002Fconversations\u002F` |\n| Add a function the AI can call | Tool | `src\u002Ftools\u002F` |\n| Add reusable business logic | Action | `src\u002Factions\u002F` |\n| Run background\u002Fscheduled tasks | Workflow | `src\u002Fworkflows\u002F` |\n| Store structured data | Table | `src\u002Ftables\u002F` |\n| React to events (user created, etc.) | Trigger | `src\u002Ftriggers\u002F` |\n| Give AI access to docs\u002Fdata | Knowledge Base | `src\u002Fknowledge\u002F` |\n| Connect external service (Slack, etc.) | Integration | `adk add \u003Cname>` |\n\n**If the information in this skill isn't enough**, fetch the corresponding GitHub reference file (links provided in each section) for more detailed specifications.\n\n## Important: ADK is AI-Native\n\nThe ADK does **NOT** use traditional chatbot patterns. Don't create intents, entities, or dialog flows.\n\n**Instead of:**\n- Defining intents (`greet`, `orderPizza`, `checkStatus`)\n- Training entity extraction (`@pizzaSize`, `@toppings`)\n- Manually routing to intent handlers\n\n**ADK uses:**\n- `execute()` - The AI understands user intent naturally from instructions\n- Tools - AI autonomously decides when to call your functions\n- `zai.extract()` - Schema-based structured data extraction\n- Knowledge bases - RAG for grounding responses in your docs\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002F\n**GitHub:** https:\u002F\u002Fgithub.com\u002Fbotpress\u002Fskills\u002Ftree\u002Fmaster\u002Fskills\u002Fadk\n\n---\n\n## Prerequisites & Installation\n\nBefore using the ADK, ensure the user has:\n\n- **Botpress Account** - Create at https:\u002F\u002Fapp.botpress.cloud\n- **Node.js v22.0.0+** - Check with `node --version`\n- **Package Manager** - bun (recommended), pnpm, yarn, or npm\n\n**Install the ADK CLI:**\n\nmacOS & Linux:\n```bash\ncurl -fsSL https:\u002F\u002Fgithub.com\u002Fbotpress\u002Fadk\u002Freleases\u002Flatest\u002Fdownload\u002Finstall.sh | bash\n```\n\nWindows (PowerShell):\n```powershell\npowershell -c \"irm https:\u002F\u002Fgithub.com\u002Fbotpress\u002Fadk\u002Freleases\u002Flatest\u002Fdownload\u002Finstall.ps1 | iex\"\n```\n\n**Verify installation:**\n```bash\nadk --version\n```\n\nIf installation fails, check https:\u002F\u002Fgithub.com\u002Fbotpress\u002Fadk\u002Freleases for manual download options.\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fquickstart\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fcli.md\n\n---\n\n## Quick Start\n\nOnce the ADK CLI is installed, create a new bot:\n\n```bash\nadk init my-bot         # Create project (choose \"Hello World\" template for beginners)\ncd my-bot\nnpm install             # Or bun\u002Fpnpm\u002Fyarn\nadk login               # Authenticate with Botpress Cloud\nadk add chat            # Add the chat integration for testing\nadk dev                 # Start dev server with hot reload\nadk chat                # Test in CLI (run in separate terminal)\nadk deploy              # Deploy to production when ready\n```\n\nThe visual console at **http:\u002F\u002Flocalhost:3001\u002F** lets you configure integrations and test the bot.\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fquickstart\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fcli.md\n\n---\n\n## Linking and Deploying Your Bot\n\n**IMPORTANT:** Your bot must be linked to Botpress Cloud and deployed for it to work. The ADK runs locally during development but the bot itself lives in Botpress Cloud.\n\n### The Correct Order: Link → Dev → Deploy\n\nFollow this order to get your bot working:\n\n```bash\n# 1. LINK - Connect your project to Botpress Cloud (creates agent.json)\nadk link\n\n# 2. DEV - Start the development server (hot reload, testing)\nadk dev\n\n# 3. DEPLOY - Push to production when ready\nadk deploy\n```\n\n**Step-by-step:**\n\n1. **`adk link`** - Links your local project to a bot in Botpress Cloud. This creates `agent.json` with your workspace and bot IDs. Run this first before anything else.\n\n2. **`adk dev`** - Starts the local development server with hot reloading. Opens the dev console at http:\u002F\u002Flocalhost:3001 where you can configure integrations and test your bot. Use `adk chat` in a separate terminal to test.\n\n3. **`adk deploy`** - Deploys your bot to production. Run this when you're ready for your bot to be live and accessible through production channels (Slack, WhatsApp, webchat, etc.).\n\n### Troubleshooting Errors\n\n**If you encounter errors when running `adk dev` or `adk deploy`:**\n\n1. **Check the logs** - Look at the terminal output or the logs panel in the dev console at http:\u002F\u002Flocalhost:3001\n2. **Copy the error message** - Select and copy the full error message from the logs\n3. **Ask for help** - Paste the error back to the AI assistant and ask it to help fix the issue\n\nCommon error scenarios:\n- **Integration configuration errors:** Usually means an integration needs to be configured in the UI at localhost:3001\n- **Type errors:** Often caused by incorrect imports or schema mismatches\n- **Deployment failures:** May indicate missing environment variables or invalid configuration\n\n**Example workflow for fixing errors:**\n```\n1. Run `adk dev` or `adk deploy`\n2. See error in terminal\u002Flogs\n3. Copy the error message\n4. Tell the AI: \"I got this error when running adk dev: [paste error]\"\n5. The AI will help diagnose and fix the issue\n```\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fquickstart\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fcli.md\n\n---\n\n## Project Structure\n\n**Critical rule:** File location determines behavior. Place components in the correct `src\u002F` subdirectory or they won't be discovered.\n\n```\nmy-bot\u002F\n├── agent.config.ts    # Bot configuration: name, models, state schemas, integrations\n├── agent.json         # Workspace\u002Fbot IDs (auto-generated by adk link\u002Fdev, add to .gitignore)\n├── package.json       # Node.js dependencies and scripts (dev, build, deploy)\n├── tsconfig.json      # TypeScript configuration\n├── .env               # API keys and secrets (never commit!)\n├── .gitignore         # Should include: agent.json, .env, node_modules\u002F, .botpress\u002F\n├── src\u002F\n│   ├── conversations\u002F # Handle incoming messages → use execute() for AI responses\n│   ├── workflows\u002F     # Background processes → use step() for resumable operations\n│   ├── actions\u002F       # Reusable functions → call from anywhere with actions.name()\n│   ├── tools\u002F         # AI-callable functions → AI decides when to invoke these\n│   ├── tables\u002F        # Data storage → auto-synced to cloud, supports semantic search\n│   ├── triggers\u002F      # Event handlers → react to user.created, integration events, etc.\n│   └── knowledge\u002F     # RAG sources → index docs, websites, or tables for AI context\n└── .botpress\u002F         # Auto-generated types (never edit manually)\n```\n\n**Key Configuration Files:**\n\n- **agent.config.ts** - Primary configuration defining bot metadata, AI models, state schemas, and integrations (you edit this)\n- **agent.json** - Links agent to workspace\u002Fbot IDs. Auto-generated by `adk link` or `adk dev`. **Add to .gitignore** - contains environment-specific IDs that differ per developer\n- **package.json** - Node.js config with `@botpress\u002Fruntime` dependency and scripts for `dev`, `build`, `deploy`\n- **tsconfig.json** - TypeScript configuration for the project\n- **.env** - Environment variables for API keys and secrets (never commit!)\n- **.gitignore** - Should include: `agent.json`, `.env`, `node_modules\u002F`, `.botpress\u002F`\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fproject-structure\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fagent-config.md\n\n---\n\n## Agent Configuration\n\nThe `agent.config.ts` file defines your bot's identity, AI models, state schemas, and integrations. Always start here when setting up a new bot.\n\n```typescript\nimport { defineConfig, z } from \"@botpress\u002Fruntime\";\n\nexport default defineConfig({\n  name: \"my-support-bot\",\n  description: \"AI customer support assistant\",\n\n  \u002F\u002F AI models for different operations\n  defaultModels: {\n    autonomous: \"openai:gpt-4o\",      \u002F\u002F Used by execute() for conversations\n    zai: \"openai:gpt-4o-mini\"         \u002F\u002F Used by zai operations (cheaper, faster)\n  },\n\n  \u002F\u002F Global bot state - shared across all conversations and users\n  bot: {\n    state: z.object({\n      maintenanceMode: z.boolean().default(false),\n      totalConversations: z.number().default(0)\n    })\n  },\n\n  \u002F\u002F Per-user state - persists across all conversations for each user\n  user: {\n    state: z.object({\n      name: z.string().optional(),\n      tier: z.enum([\"free\", \"pro\"]).default(\"free\"),\n      preferredLanguage: z.enum([\"en\", \"es\", \"fr\"]).default(\"en\")\n    }),\n    tags: {\n      source: z.string(),\n      region: z.string().optional()\n    }\n  },\n\n  \u002F\u002F Per-conversation state\n  conversation: {\n    state: z.object({\n      context: z.string().optional()\n    }),\n    tags: {\n      category: z.enum([\"support\", \"sales\", \"general\"]),\n      priority: z.enum([\"low\", \"medium\", \"high\"]).optional()\n    }\n  },\n\n  \u002F\u002F Integrations your bot uses (ADK 1.9+ format)\n  dependencies: {\n    integrations: {\n      chat: { version: \"chat@0.7.3\", enabled: true },\n      slack: { version: \"slack@2.5.5\", enabled: true }\n    }\n  }\n});\n```\n\n**Available models:**\n- OpenAI: `openai:gpt-4o`, `openai:gpt-4o-mini`, `openai:gpt-4-turbo`\n- Anthropic: `anthropic:claude-3-5-sonnet`, `anthropic:claude-3-opus`\n- Google: `google:gemini-1.5-pro`, `google:gemini-1.5-flash`\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fproject-structure\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fagent-config.md\n\n---\n\n## Core Concepts\n\n### 1. Actions - Reusable Business Logic\n\n**When to create an Action:**\n- You need reusable logic that will be called from multiple places (workflows, conversations, triggers)\n- You're wrapping an external API or database operation\n- You want testable, composable business logic\n- You need to call integration APIs (Slack, Linear, etc.) with custom logic\n\n**When NOT to use an Action (use a Tool instead):**\n- You want the AI to decide when to call it autonomously\n- The function should be available during `execute()`\n\nActions are **not** directly callable by the AI - convert them to tools with `.asTool()` if the AI needs to use them.\n\n**Location:** `src\u002Factions\u002F*.ts`\n\n```typescript\nimport { Action, z } from \"@botpress\u002Fruntime\";\n\nexport const fetchUser = new Action({\n  name: \"fetchUser\",\n  description: \"Retrieves user details from the database\",\n\n  \u002F\u002F Define input\u002Foutput with Zod schemas for type safety\n  input: z.object({ userId: z.string() }),\n  output: z.object({ name: z.string(), email: z.string() }),\n\n  \u002F\u002F IMPORTANT: Handler receives { input, client } - destructure input INSIDE the handler\n  async handler({ input, client }) {\n    const { user } = await client.getUser({ id: input.userId });\n    return { name: user.name, email: user.tags.email };\n  }\n});\n```\n\n**Calling actions:**\n```typescript\nimport { actions } from \"@botpress\u002Fruntime\";\nconst userData = await actions.fetchUser({ userId: \"123\" });\n\n\u002F\u002F To make an action callable by the AI, convert it to a tool:\ntools: [actions.fetchUser.asTool()]\n```\n\n**Key Rules:**\n- Handler receives `{ input, client }` - must destructure `input` inside the handler\n- Cannot destructure input fields directly in parameters\n- Can call other actions, integration actions, access state\n- Can be converted to tools with `.asTool()`\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Factions\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Factions.md\n\n---\n\n### 2. Tools - AI-Callable Functions\n\n**When to create a Tool:**\n- You want the AI to autonomously decide when to use this function\n- The function retrieves information the AI needs (search, lookup, fetch)\n- The function performs actions on behalf of the user (create ticket, send message)\n- You're building capabilities the AI should have during conversations\n\n**The AI decides when to use tools based on:**\n1. The tool's `description` - Make this clear and specific about WHEN to use it\n2. The input schema's `.describe()` fields - Help AI understand what parameters mean\n3. The conversation context and user's intent\n\n**Key difference from Actions:** Tools can destructure input directly; Actions cannot.\n\n**Location:** `src\u002Ftools\u002F*.ts`\n\n```typescript\nimport { Autonomous, z } from \"@botpress\u002Fruntime\";\n\nexport const searchProducts = new Autonomous.Tool({\n  name: \"searchProducts\",\n  \u002F\u002F This description is critical - it tells the AI when to use this tool\n  description: \"Search the product catalog. Use when user asks about products, availability, pricing, or wants to browse items.\",\n\n  input: z.object({\n    query: z.string().describe(\"Search keywords\"),\n    category: z.string().optional().describe(\"Filter by category\")\n  }),\n  output: z.object({\n    products: z.array(z.object({ id: z.string(), name: z.string(), price: z.number() }))\n  }),\n\n  \u002F\u002F Unlike actions, tools CAN destructure input directly in the handler\n  handler: async ({ query, category }) => {\n    \u002F\u002F Your search logic here\n    return { products: [] };\n  }\n});\n```\n\n**Using ThinkSignal:** When a tool can't complete but you want to give the AI context:\n```typescript\nimport { Autonomous } from \"@botpress\u002Fruntime\";\n\n\u002F\u002F Inside handler - AI will see this message and can respond appropriately\nthrow new Autonomous.ThinkSignal(\n  \"No results found\",\n  \"No products found matching that query. Ask user to try different search terms.\"\n);\n```\n\n**Advanced Tool Properties:**\n```typescript\nexport const myTool = new Autonomous.Tool({\n  name: \"myTool\",\n  description: \"Tool description\",\n  input: z.object({...}),\n  output: z.object({...}),\n  aliases: [\"searchDocs\", \"findDocs\"],  \u002F\u002F Alternative names\n  handler: async (input, ctx) => {\n    console.log(`Call ID: ${ctx.callId}`);  \u002F\u002F Unique call identifier\n    \u002F\u002F ...\n  },\n  retry: async ({ attempt, error }) => {\n    if (attempt \u003C 3 && error?.code === 'RATE_LIMIT') {\n      await new Promise(r => setTimeout(r, 1000 * attempt));\n      return true;  \u002F\u002F Retry\n    }\n    return false;  \u002F\u002F Don't retry\n  }\n});\n```\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Ftools\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Ftools.md\n\n---\n\n### 3. Conversations - Message Handlers\n\n**When to create a Conversation:**\n- Every bot needs at least one conversation handler to respond to users\n- Create separate handlers for different channels if they need different behavior\n- Use `channel: \"*\"` to handle all channels with one handler\n\n**Key decisions when building a conversation:**\n1. **Which channels?** - Specify `\"*\"` for all, or specific channels like `\"slack.dm\"`\n2. **What tools does the AI need?** - Pass them to `execute({ tools: [...] })`\n3. **What knowledge should ground responses?** - Pass to `execute({ knowledge: [...] })`\n4. **What instructions guide the AI?** - Define personality, rules, and context\n\n**The `execute()` function is the heart of ADK** - it runs autonomous AI logic with your tools and knowledge. Most conversation handlers will call `execute()`.\n\n**Location:** `src\u002Fconversations\u002F*.ts`\n\n```typescript\nimport { Conversation, z } from \"@botpress\u002Fruntime\";\n\nexport const Chat = new Conversation({\n  \u002F\u002F Which channels this handler responds to\n  channel: \"chat.channel\",  \u002F\u002F Or \"*\" for all, or [\"slack.dm\", \"webchat.channel\"]\n\n  \u002F\u002F Per-conversation state (optional)\n  state: z.object({\n    messageCount: z.number().default(0)\n  }),\n\n  async handler({ message, state, conversation, execute, user }) {\n    state.messageCount += 1;\n\n    \u002F\u002F Handle commands\n    if (message?.payload?.text?.startsWith(\"\u002Fhelp\")) {\n      await conversation.send({\n        type: \"text\",\n        payload: { text: \"Available commands: \u002Fhelp, \u002Fstatus\" }\n      });\n      return;\n    }\n\n    \u002F\u002F Let the AI handle the response with your tools and knowledge\n    await execute({\n      \u002F\u002F Instructions guide the AI's behavior and personality\n      instructions: `You are a helpful customer support agent for Acme Corp.\n        User's name: ${user.state.name || \"there\"}\n        User's tier: ${user.state.tier}\n        Be friendly, concise, and always offer to help further.`,\n\n      \u002F\u002F Tools the AI can use during this conversation\n      tools: [searchProducts, actions.createTicket.asTool()],\n\n      \u002F\u002F Knowledge bases for RAG - AI will search these to ground responses\n      knowledge: [DocsKnowledgeBase],\n\n      model: \"openai:gpt-4o\",\n      temperature: 0.7,\n      iterations: 10  \u002F\u002F Max tool call iterations\n    });\n  }\n});\n```\n\n**Handler Context:**\n- `message` - User's message data\n- `execute` - Run autonomous AI logic\n- `conversation` - Conversation instance methods (send, startTyping, stopTyping)\n- `state` - Mutable state (bot, user, conversation)\n- `client` - Botpress API client\n- `type` - Event classification (message, workflow_request)\n\n**Execute Function Options:**\n```typescript\nawait execute({\n  instructions: string | async function,  \u002F\u002F Required\n  tools: Tool[],                          \u002F\u002F AI-callable tools\n  knowledge: Knowledge[],                 \u002F\u002F Knowledge bases for RAG\n  exits: Exit[],                          \u002F\u002F Structured exit handlers\n  model: string,                          \u002F\u002F AI model to use\n  temperature: number,                    \u002F\u002F 0-1, default 0.7\n  iterations: number,                     \u002F\u002F Max tool calls, default 10\n  hooks: {\n    onBeforeTool: async ({ tool, input }) => { ... },\n    onAfterTool: async ({ tool, output }) => { ... },\n    onTrace: async (trace) => { ... }\n  }\n});\n```\n\n**Common channels:** `chat.channel`, `webchat.channel`, `slack.dm`, `slack.channel`, `discord.channel`, `whatsapp.channel`, `\"*\"` (all)\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Fconversations\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fconversations.md\n\n---\n\n### 4. Workflows - Background & Multi-Step Processes\n\n**When to create a Workflow:**\n- Operations that take longer than 2 minutes (the default timeout)\n- Multi-step processes that need to survive crashes\u002Frestarts\n- Scheduled\u002Frecurring tasks (daily reports, periodic syncs)\n- Background processing (order fulfillment, data migration)\n- Operations that need to wait for external events or user input\n\n**When NOT to use a Workflow (handle in conversation instead):**\n- Quick operations that complete immediately\n- Simple request-response patterns\n- Operations that don't need persistence\n\n**Key workflow concepts:**\n- **Steps are checkpoints** - If workflow crashes, it resumes from last completed step\n- **State persists** - Store progress in `state` to track across steps\n- **Always pass conversationId** - If the workflow needs to message users back\n\n**Location:** `src\u002Fworkflows\u002F*.ts`\n\n```typescript\nimport { Workflow, z } from \"@botpress\u002Fruntime\";\n\nexport const ProcessOrderWorkflow = new Workflow({\n  name: \"processOrder\",\n  description: \"Processes customer orders\",\n  timeout: \"6h\",                    \u002F\u002F Max duration\n  schedule: \"0 9 * * *\",            \u002F\u002F Optional: run daily at 9am (cron syntax)\n\n  input: z.object({\n    orderId: z.string(),\n    conversationId: z.string()      \u002F\u002F Include this to message the user back!\n  }),\n\n  state: z.object({\n    currentStep: z.number().default(0),\n    processedItems: z.array(z.string()).default([])\n  }),\n\n  output: z.object({\n    success: z.boolean(),\n    itemsProcessed: z.number()\n  }),\n\n  async handler({ input, state, step, client, execute }) {\n    \u002F\u002F State is passed as parameter, auto-tracked\n    state.currentStep = 1;\n\n    \u002F\u002F IMPORTANT: Each step needs a unique, stable name (no dynamic names!)\n    const orderData = await step(\"fetch-order\", async () => {\n      return await fetchOrderData(input.orderId);\n    });\n\n    \u002F\u002F Steps can have retry logic\n    await step(\"process-payment\", async () => {\n      return await processPayment(orderData);\n    }, { maxAttempts: 3 });\n\n    \u002F\u002F To message the user from a workflow, use client.createMessage (NOT conversation.send)\n    await step(\"notify-user\", async () => {\n      await client.createMessage({\n        conversationId: input.conversationId,\n        type: \"text\",\n        payload: { text: \"Your order has been processed!\" }\n      });\n    });\n\n    return {\n      success: true,\n      itemsProcessed: state.processedItems.length\n    };\n  }\n});\n\n\u002F\u002F Start a workflow from a conversation or trigger\nawait ProcessOrderWorkflow.start({\n  orderId: \"123\",\n  conversationId: conversation.id  \u002F\u002F Always pass this if you need to message back\n});\n\n\u002F\u002F Get or create with deduplication\nconst instance = await ProcessOrderWorkflow.getOrCreate({\n  key: `order-${orderId}`,  \u002F\u002F Prevents duplicate workflows\n  input: { orderId, conversationId }\n});\n```\n\n**Step Methods:**\n\n| Method | Purpose |\n|--------|---------|\n| `step(name, fn)` | Basic execution with caching |\n| `step.sleep(name, ms)` | Pause for milliseconds |\n| `step.sleepUntil(name, date)` | Pause until specific date |\n| `step.listen()` | Wait for external events |\n| `step.progress(msg)` | Update progress message |\n| `step.request(name, prompt)` | Request user input (blocking) |\n| `step.executeWorkflow()` | Start and await another workflow |\n| `step.waitForWorkflow(id)` | Wait for existing workflow |\n| `step.map(items, fn)` | Process array with concurrency |\n| `step.forEach(items, fn)` | Execute on items without results |\n| `step.batch(items, fn)` | Process in groups |\n| `step.fail(reason)` | Mark workflow as failed |\n| `step.abort()` | Stop immediately without failure |\n\n**Critical Rules:**\n- Step names must be **unique** and **stable** (avoid dynamic naming in loops)\n- State is passed as a parameter, not accessed via `this.state`\n- Always pass `conversationId` for workflows that need to message users\n- Default timeout is 2 minutes - use steps for longer processes\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Fworkflows\u002Foverview\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fworkflows.md\n\n---\n\n### 5. Tables - Data Storage\n\n**When to create a Table:**\n- You need to persist structured data (users, orders, tickets, logs)\n- You want to query\u002Ffilter data by fields\n- You need semantic search on text content (set `searchable: true`)\n- You're storing data that should survive bot restarts\n\n**When NOT to use a Table (use State instead):**\n- Simple key-value data per user\u002Fconversation → use `user.state` or `conversation.state`\n- Temporary data that doesn't need persistence\n- Small amounts of data that fit in state\n\n**Tables vs Knowledge Bases:**\n- **Tables** = Structured data you CRUD (create, read, update, delete)\n- **Knowledge Bases** = Documents\u002Fcontent for AI to search and reference\n\n**Location:** `src\u002Ftables\u002F*.ts`\n\n**CRITICAL RULES (violations will cause errors):**\n- Do NOT define an `id` column - it's created automatically as a number\n- Table names MUST end with \"Table\" (e.g., `OrdersTable`, not `Orders`)\n\n```typescript\nimport { Table, z } from \"@botpress\u002Fruntime\";\n\nexport const OrdersTable = new Table({\n  name: \"OrdersTable\",  \u002F\u002F Must end with \"Table\"\n  description: \"Stores order information\",\n  columns: {\n    \u002F\u002F NO id column - it's automatic!\n    orderId: z.string(),\n    userId: z.string(),\n    status: z.enum([\"pending\", \"completed\", \"cancelled\"]),\n    total: z.number(),\n    createdAt: z.date(),\n    \u002F\u002F Enable semantic search on a column:\n    notes: {\n      schema: z.string(),\n      searchable: true\n    }\n  }\n});\n```\n\n**CRUD operations:**\n```typescript\n\u002F\u002F Create - id is auto-assigned\nawait OrdersTable.createRows({\n  rows: [{ orderId: \"ord-123\", userId: \"user-456\", status: \"pending\", total: 99.99, createdAt: new Date() }]\n});\n\n\u002F\u002F Read with filters\nconst { rows } = await OrdersTable.findRows({\n  filter: { userId: \"user-456\", status: \"pending\" },\n  orderBy: \"createdAt\",\n  orderDirection: \"desc\",\n  limit: 10\n});\n\n\u002F\u002F Get single row by id\nconst row = await OrdersTable.getRow({ id: 123 });\n\n\u002F\u002F Semantic search (on searchable columns)\nconst { rows } = await OrdersTable.findRows({\n  search: \"delivery issue\",\n  limit: 5\n});\n\n\u002F\u002F Update - must include the id\nawait OrdersTable.updateRows({\n  rows: [{ id: 1, status: \"completed\" }]\n});\n\n\u002F\u002F Upsert - insert or update based on key column\nawait OrdersTable.upsertRows({\n  rows: [{ orderId: \"ord-123\", status: \"shipped\" }],\n  keyColumn: \"orderId\"\n});\n\n\u002F\u002F Delete by filter\nawait OrdersTable.deleteRows({ status: \"cancelled\" });\n\n\u002F\u002F Delete by IDs\nawait OrdersTable.deleteRowIds([123, 456]);\n```\n\n**Advanced: Computed Columns:**\n```typescript\ncolumns: {\n  basePrice: z.number(),\n  taxRate: z.number(),\n  fullPrice: {\n    computed: true,\n    schema: z.number(),\n    dependencies: [\"basePrice\", \"taxRate\"],\n    value: async (row) => row.basePrice * (1 + row.taxRate)\n  }\n}\n```\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Ftables\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Ftables.md\n\n---\n\n### 6. Knowledge Bases - RAG for AI Context\n\n**When to create a Knowledge Base:**\n- You want the AI to answer questions based on your documentation\n- You have FAQs, policies, or product info the AI should reference\n- You want AI responses grounded in specific content (not hallucinated)\n- You're building a support bot that needs access to help articles\n\n**How RAG works in ADK:**\n1. You define knowledge sources (websites, files, tables)\n2. Content is indexed and embedded for semantic search\n3. During `execute()`, the AI automatically searches relevant knowledge\n4. AI uses retrieved content to generate grounded responses\n\n**Choosing a DataSource type:**\n- **Website** - Index public documentation, help sites, blogs\n- **Directory** - Index local markdown\u002Ftext files (dev only!)\n- **Table** - Index structured data from your tables\n\n**Location:** `src\u002Fknowledge\u002F*.ts`\n\n```typescript\nimport { Knowledge, DataSource } from \"@botpress\u002Fruntime\";\n\n\u002F\u002F Website source - index via sitemap\nconst websiteSource = DataSource.Website.fromSitemap(\n  \"https:\u002F\u002Fdocs.example.com\u002Fsitemap.xml\",\n  {\n    id: \"website-docs\",\n    maxPages: 500,\n    maxDepth: 10,\n    filter: (ctx) => ctx.url.includes(\"\u002Fdocs\u002F\")  \u002F\u002F Only index \u002Fdocs\u002F pages\n  }\n);\n\n\u002F\u002F Local files (development only - won't work in production)\nconst localSource = DataSource.Directory.fromPath(\"src\u002Fknowledge\u002Fdocs\", {\n  id: \"local-docs\",\n  filter: (path) => path.endsWith(\".md\")\n});\n\n\u002F\u002F Table-based knowledge\nconst tableSource = DataSource.Table.fromTable(FAQTable, {\n  id: \"faq-table\",\n  transform: ({ row }) => `Question: ${row.question}\\nAnswer: ${row.answer}`,\n  filter: ({ row }) => row.published === true\n});\n\nexport const DocsKB = new Knowledge({\n  name: \"docsKB\",\n  description: \"Product documentation and help articles\",\n  sources: [websiteSource, localSource, tableSource]\n});\n\n\u002F\u002F Use in conversations - AI will search this knowledge base\nawait execute({\n  instructions: \"Answer based on the documentation\",\n  knowledge: [DocsKB]\n});\n\n\u002F\u002F Manually refresh knowledge base\nawait DocsKB.refresh();                  \u002F\u002F Smart refresh (only changed content)\nawait DocsKB.refresh({ force: true });   \u002F\u002F Force full re-index\nawait DocsKB.refreshSource(\"website-docs\", { force: true });  \u002F\u002F Refresh specific source\n```\n\n**Website Source Methods:**\n- `fromSitemap(url, options)` - Parse XML sitemap\n- `fromWebsite(baseUrl, options)` - Crawl from base URL (requires Browser integration)\n- `fromLlmsTxt(url, options)` - Parse llms.txt file\n- `fromUrls(urls, options)` - Index specific URLs\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Fknowledge\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fknowledge-bases.md\n\n---\n\n### 7. Triggers - Event-Driven Automation\n\n**When to create a Trigger:**\n- You need to react to events automatically (user signs up, issue created, etc.)\n- You want to start workflows when specific events occur\n- You need to sync data when external systems change\n- You want to send notifications based on events\n\n**Common trigger patterns:**\n- **User onboarding** - Trigger on `user.created` → start onboarding workflow\n- **Integration sync** - Trigger on `linear:issueCreated` → create record in table\n- **Notifications** - Trigger on `workflow.completed` → send Slack message\n\n**Finding available events:**\n- Bot events: `user.created`, `conversation.started`, `workflow.completed`, etc.\n- Integration events: Run `adk info \u003Cintegration> --events` to see available events\n\n**Location:** `src\u002Ftriggers\u002F*.ts`\n\n```typescript\nimport { Trigger } from \"@botpress\u002Fruntime\";\n\nexport default new Trigger({\n  name: \"onNewUser\",\n  description: \"Start onboarding when user created\",\n  events: [\"user.created\"],  \u002F\u002F Can listen to multiple events\n\n  handler: async ({ event, client, actions }) => {\n    const { userId, email } = event.payload;\n\n    \u002F\u002F Start an onboarding workflow\n    await OnboardingWorkflow.start({\n      userId,\n      email\n    });\n  }\n});\n\n\u002F\u002F Integration events use format: integration:eventName\nexport const LinearTrigger = new Trigger({\n  name: \"onLinearIssue\",\n  description: \"Handle Linear issue events\",\n  events: [\"linear:issueCreated\", \"linear:issueUpdated\"],\n\n  handler: async ({ event, actions }) => {\n    if (event.type === \"linear:issueCreated\") {\n      await actions.slack.sendMessage({\n        channel: \"#notifications\",\n        text: `New issue: ${event.payload.title}`\n      });\n    }\n  }\n});\n```\n\n**Common Bot Events:**\n- `user.created`, `user.updated`, `user.deleted`\n- `conversation.started`, `conversation.ended`, `message.created`\n- `workflow.started`, `workflow.completed`, `workflow.failed`\n- `bot.started`, `bot.stopped`\n\n**Common Integration Events:**\n- Slack: `slack:reactionAdded`, `slack:memberJoinedChannel`\n- Linear: `linear:issueCreated`, `linear:issueUpdated`\n- GitHub: `github:issueOpened`, `github:pullRequestOpened`\n- Intercom: `intercom:conversationEvent`, `intercom:contactEvent`\n\n**Find integration events:** Run `adk info \u003Cintegration> --events`\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Ftriggers\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Ftriggers.md\n\n---\n\n## Sending Messages\n\n**CRITICAL: The method depends on WHERE you're sending from:**\n\n| Context | Method | Why |\n|---------|--------|-----|\n| In Conversations | `conversation.send()` | Has conversation context |\n| In Workflows\u002FActions | `client.createMessage()` | Needs explicit `conversationId` |\n\n**Common mistake:** Using `client.createMessage()` in conversations. Always use `conversation.send()` instead.\n\nThe method depends on where you're sending from:\n\n**In conversations** - Use `conversation.send()`:\n```typescript\nawait conversation.send({ type: \"text\", payload: { text: \"Hello!\" } });\nawait conversation.send({ type: \"image\", payload: { imageUrl: \"https:\u002F\u002F...\" } });\nawait conversation.send({\n  type: \"choice\",\n  payload: {\n    text: \"Pick one:\",\n    choices: [\n      { title: \"Option A\", value: \"a\" },\n      { title: \"Option B\", value: \"b\" }\n    ]\n  }\n});\n```\n\n**In workflows or actions** - Use `client.createMessage()` with `conversationId`:\n```typescript\nawait client.createMessage({\n  conversationId: input.conversationId,  \u002F\u002F Must have this!\n  type: \"text\",\n  payload: { text: \"Workflow complete!\" }\n});\n```\n\n**All Message Types:**\n```typescript\n\u002F\u002F Text\n{ type: \"text\", payload: { text: \"Hello!\" } }\n\n\u002F\u002F Markdown\n{ type: \"markdown\", payload: { text: \"# Heading\\n**Bold**\" } }\n\n\u002F\u002F Image\n{ type: \"image\", payload: { imageUrl: \"https:\u002F\u002F...\" } }\n\n\u002F\u002F Audio\n{ type: \"audio\", payload: { audioUrl: \"https:\u002F\u002F...\" } }\n\n\u002F\u002F Video\n{ type: \"video\", payload: { videoUrl: \"https:\u002F\u002F...\" } }\n\n\u002F\u002F File\n{ type: \"file\", payload: { fileUrl: \"https:\u002F\u002F...\", title: \"Document.pdf\" } }\n\n\u002F\u002F Location\n{ type: \"location\", payload: { latitude: 40.7128, longitude: -74.0060, address: \"New York, NY\" } }\n\n\u002F\u002F Card\n{ type: \"card\", payload: {\n  title: \"Product Name\",\n  subtitle: \"Description\",\n  imageUrl: \"https:\u002F\u002F...\",\n  actions: [\n    { action: \"url\", label: \"View\", value: \"https:\u002F\u002F...\" },\n    { action: \"postback\", label: \"Buy\", value: \"buy_123\" }\n  ]\n}}\n\n\u002F\u002F Carousel\n{ type: \"carousel\", payload: {\n  items: [\n    { title: \"Item 1\", subtitle: \"...\", imageUrl: \"...\", actions: [...] },\n    { title: \"Item 2\", subtitle: \"...\", imageUrl: \"...\", actions: [...] }\n  ]\n}}\n\n\u002F\u002F Choice (Quick Replies)\n{ type: \"choice\", payload: {\n  text: \"Select an option:\",\n  choices: [\n    { title: \"Option 1\", value: \"opt1\" },\n    { title: \"Option 2\", value: \"opt2\" }\n  ]\n}}\n\n\u002F\u002F Dropdown\n{ type: \"dropdown\", payload: {\n  text: \"Select country:\",\n  options: [\n    { label: \"United States\", value: \"us\" },\n    { label: \"Canada\", value: \"ca\" }\n  ]\n}}\n```\n\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fmessages.md\n\n---\n\n## Zai - LLM Utility Operations\n\n**When to use Zai vs execute():**\n- **Use `zai`** for specific, structured AI operations (extract data, classify, summarize)\n- **Use `execute()`** for autonomous, multi-turn AI conversations with tools\n\n**Zai is perfect for:**\n- Extracting structured data from user messages (`zai.extract`)\n- Classifying\u002Flabeling content (`zai.check`, `zai.label`)\n- Summarizing long content (`zai.summarize`)\n- Answering questions from documents (`zai.answer`)\n- Sorting\u002Ffiltering\u002Fgrouping data intelligently (`zai.sort`, `zai.filter`, `zai.group`)\n\n**Zai operations are optimized for speed and cost** - they use the `zai` model configured in `agent.config.ts` (typically a faster\u002Fcheaper model).\n\n```typescript\nimport { adk, z } from \"@botpress\u002Fruntime\";\n\n\u002F\u002F Extract structured data from text\nconst contact = await adk.zai.extract(\n  \"Contact John at john@example.com, phone 555-0100\",\n  z.object({\n    name: z.string(),\n    email: z.string(),\n    phone: z.string()\n  })\n);\n\u002F\u002F Returns: { name: \"John\", email: \"john@example.com\", phone: \"555-0100\" }\n\n\u002F\u002F Check if text matches a condition (returns boolean)\nconst isSpam = await adk.zai.check(messageText, \"is spam or promotional\");\n\n\u002F\u002F Label text with multiple criteria\nconst labels = await adk.zai.label(customerEmail, {\n  spam: \"is spam\",\n  urgent: \"needs immediate response\",\n  complaint: \"expresses dissatisfaction\"\n});\n\u002F\u002F Returns: { spam: false, urgent: true, complaint: true }\n\n\u002F\u002F Summarize content\nconst summary = await adk.zai.summarize(longDocument, {\n  length: 200,\n  bulletPoints: true\n});\n\n\u002F\u002F Answer questions from documents (with citations)\nconst result = await adk.zai.answer(docs, \"What is the refund policy?\");\nif (result.type === \"answer\") {\n  console.log(result.answer);\n  console.log(result.citations);\n}\n\u002F\u002F Response types: \"answer\", \"ambiguous\", \"out_of_topic\", \"invalid_question\", \"missing_knowledge\"\n\n\u002F\u002F Rate items on 1-5 scale\nconst scores = await adk.zai.rate(products, \"quality score\");\n\n\u002F\u002F Sort by criteria\nconst sorted = await adk.zai.sort(tickets, \"by urgency, most urgent first\");\n\n\u002F\u002F Group items semantically\nconst groups = await adk.zai.group(emails, {\n  instructions: \"categorize by topic\"\n});\n\n\u002F\u002F Rewrite text\nconst professional = await adk.zai.rewrite(\"hey wassup\", \"make it professional and friendly\");\n\n\u002F\u002F Filter arrays\nconst activeUsers = await adk.zai.filter(users, \"have been active this month\");\n\n\u002F\u002F Generate text\nconst blogPost = await adk.zai.text(\"Write about AI in healthcare\", {\n  length: 1000,\n  temperature: 0.7\n});\n\n\u002F\u002F Patch code files\nconst patched = await adk.zai.patch(files, \"add JSDoc comments to all functions\");\n```\n\n**Zai Configuration:**\n```typescript\n\u002F\u002F Create configured instance\nconst preciseZai = adk.zai.with({\n  modelId: \"best\",        \u002F\u002F \"best\" | \"fast\" | custom model ID\n  temperature: 0.1\n});\n\n\u002F\u002F Enable active learning\nconst learningZai = adk.zai.learn(\"sentiment-analysis\");\n```\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fzai\u002Foverview\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fzai-complete-guide.md\n\n---\n\n## Integrations\n\n**When to add an Integration:**\n- You need to connect to an external service (Slack, Linear, GitHub, etc.)\n- You want to receive messages from a channel (webchat, WhatsApp, Discord)\n- You need to call external APIs with pre-built actions\n- You want to react to events from external systems\n\n**Integration workflow:**\n1. **Search** - Find integrations with `adk search \u003Cname>`\n2. **Add** - Install with `adk add \u003Cname>@\u003Cversion>`\n3. **Configure** - Set up credentials in the UI at `http:\u002F\u002Flocalhost:3001\u002F`\n4. **Use** - Call actions via `actions.\u003Cintegration>.\u003Caction>()`\n\n**Making integration actions available to AI:**\n```typescript\n\u002F\u002F Convert any integration action to an AI-callable tool\ntools: [actions.slack.sendMessage.asTool()]\n```\n\n**CLI commands:**\n```bash\nadk search slack           # Find integrations\nadk add slack@latest       # Add to project\nadk add slack --alias my-slack  # Add with custom alias\nadk info slack --events    # See available events\nadk list                   # List installed integrations\nadk upgrade slack          # Update to latest\nadk remove slack           # Remove integration\n```\n\n**Using integration actions:**\n```typescript\nimport { actions } from \"@botpress\u002Fruntime\";\n\n\u002F\u002F Slack\nawait actions.slack.sendMessage({ channel: \"#general\", text: \"Hello!\" });\nawait actions.slack.addReaction({ channel: \"C123\", timestamp: \"123\", name: \"thumbsup\" });\n\n\u002F\u002F Linear\nawait actions.linear.issueCreate({ teamId: \"123\", title: \"Bug report\", description: \"Details\" });\nconst { items } = await actions.linear.issueList({\n  first: 10,\n  filter: { state: { name: { eq: \"In Progress\" } } }\n});\n\n\u002F\u002F GitHub\nawait actions.github.createIssue({ owner: \"org\", repo: \"repo\", title: \"Issue\" });\n\n\u002F\u002F Browser (web scraping)\nconst results = await actions.browser.webSearch({ query: \"Botpress docs\", maxResults: 5 });\n\n\u002F\u002F Make integration actions available to AI as tools\nawait execute({ tools: [actions.slack.sendMessage.asTool()] });\n```\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fmanaging-integrations\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fintegration-actions.md\n\n---\n\n## State Management\n\n**Understanding the state hierarchy - choose the right level:**\n\n| State Level | Scope | Use For |\n|-------------|-------|---------|\n| `bot.state` | Global, all users | Feature flags, counters, maintenance mode |\n| `user.state` | Per user, all their conversations | User preferences, profile, tier |\n| `conversation.state` | Per conversation | Context, message count, active workflow |\n| `workflow.state` | Per workflow instance | Progress tracking, intermediate results |\n\n**State is automatically persisted** - just modify it and it saves.\n\nAccess and modify state from anywhere in your bot:\n\n```typescript\nimport { bot, user, conversation } from \"@botpress\u002Fruntime\";\n\n\u002F\u002F Bot state - global, shared across all users\nbot.state.maintenanceMode = true;\nbot.state.totalConversations += 1;\n\n\u002F\u002F User state - per user, persists across conversations\nuser.state.name = \"Alice\";\nuser.state.tier = \"pro\";\nuser.state.preferredLanguage = \"es\";\n\n\u002F\u002F In handlers, state is passed as a parameter\nasync handler({ state }) {\n  state.messageCount += 1;  \u002F\u002F Auto-persisted\n}\n\n\u002F\u002F Tags - simple string key-value pairs for categorization\nuser.tags.source = \"website\";\nuser.tags.region = \"north-america\";\nconversation.tags.category = \"support\";\nconversation.tags.priority = \"high\";\n```\n\n**State Types:**\n- **Bot State** - Global, shared across all users and conversations\n- **User State** - Per-user, persists across all their conversations\n- **Conversation State** - Per-conversation, isolated between conversations\n- **Workflow State** - Per-workflow instance, persists across steps\n\n**Tags vs State:**\n- Use **Tags** for: categorization, simple strings, filtering\u002Fquerying\n- Use **State** for: complex objects, arrays, nested data, business logic\n\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Ftags.md\n\n---\n\n## Context API\n\nAccess runtime services in any handler:\n\n```typescript\nimport { context } from \"@botpress\u002Fruntime\";\n\n\u002F\u002F Always available\nconst client = context.get(\"client\");           \u002F\u002F Botpress API client\nconst citations = context.get(\"citations\");     \u002F\u002F Citation manager\nconst cognitive = context.get(\"cognitive\");     \u002F\u002F LLM client\nconst logger = context.get(\"logger\");           \u002F\u002F Structured logger\nconst botId = context.get(\"botId\");            \u002F\u002F Current bot ID\nconst configuration = context.get(\"configuration\");  \u002F\u002F Bot config\n\n\u002F\u002F Conditionally available (use { optional: true })\nconst user = context.get(\"user\", { optional: true });\nconst conversation = context.get(\"conversation\", { optional: true });\nconst message = context.get(\"message\", { optional: true });\nconst workflow = context.get(\"workflow\", { optional: true });\nconst chat = context.get(\"chat\", { optional: true });  \u002F\u002F Conversation transcript\n\nif (user) {\n  console.log(`User: ${user.id}`);\n}\n```\n\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fcontext-api.md\n\n---\n\n## CLI Quick Reference\n\n```bash\n# Project Lifecycle\nadk init \u003Cname>              # Create new project\nadk login                    # Authenticate with Botpress\nadk dev                      # Start dev server (hot reload)\nadk dev --port 3000          # Custom port\nadk chat                     # Test in CLI\nadk build                    # Build for production\nadk deploy                   # Deploy to Botpress Cloud\nadk deploy --env production  # Deploy to specific environment\n\n# Integration Management\nadk add \u003Cintegration>        # Add integration\nadk add slack@2.5.5          # Add specific version\nadk add slack --alias my-slack  # Add with alias\nadk remove \u003Cintegration>     # Remove integration\nadk search \u003Cquery>           # Search integrations\nadk list                     # List installed integrations\nadk list --available         # List all available\nadk info \u003Cname>              # Integration details\nadk info \u003Cname> --events     # Show available events\nadk upgrade \u003Cname>           # Update integration\nadk upgrade                  # Interactive upgrade all\n\n# Knowledge & Assets\nadk kb sync --dev            # Sync knowledge bases\nadk kb sync --prod --force   # Force re-sync production\nadk assets sync              # Sync static files\n\n# Advanced\nadk run \u003Cscript.ts>          # Run TypeScript script\nadk mcp                      # Start MCP server\nadk link --workspace ws_123 --bot bot_456  # Link to existing bot\n\n# Utilities\nadk self-upgrade             # Update CLI\nadk telemetry --disable      # Disable telemetry\nadk --help                   # Full CLI help\nadk \u003Ccommand> --help         # Help for specific command\n```\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fcli-reference\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fcli.md\n\n---\n\n## Autonomous Execution with `execute()`\n\n**The `execute()` function is the core of ADK's AI capabilities.** It runs an autonomous AI agent that can:\n- Understand user intent from natural language\n- Decide which tools to call and when\n- Search knowledge bases for relevant information\n- Generate contextual responses\n- Loop through multiple tool calls until the task is complete\n\n**When to use execute():**\n- In conversation handlers to generate AI responses\n- In workflows when you need AI decision-making\n- Anywhere you want autonomous, multi-step AI behavior\n\n**Key parameters to configure:**\n- `instructions` - Tell the AI who it is and how to behave\n- `tools` - Give the AI capabilities (search, create, update, etc.)\n- `knowledge` - Ground the AI in your documentation\n- `exits` - Define structured output schemas for specific outcomes\n\nThe `execute()` function enables autonomous AI agent behavior:\n\n```typescript\nimport { Autonomous, z } from \"@botpress\u002Fruntime\";\n\n\u002F\u002F Define custom tool\nconst searchTool = new Autonomous.Tool({\n  name: \"search\",\n  description: \"Search documentation\",\n  input: z.object({ query: z.string() }),\n  output: z.string(),\n  handler: async ({ query }) => {\n    \u002F\u002F Search implementation\n    return \"results...\";\n  }\n});\n\n\u002F\u002F Define exit (structured response)\nconst AnswerExit = new Autonomous.Exit({\n  name: \"Answer\",\n  description: \"Provide final answer to the user\",\n  schema: z.object({\n    answer: z.string(),\n    confidence: z.number(),\n    sources: z.array(z.string())\n  })\n});\n\n\u002F\u002F Execute AI with tools, knowledge, and exits\nconst result = await execute({\n  instructions: \"Help the user with their request. Be helpful and concise.\",\n\n  \u002F\u002F Add tools\n  tools: [\n    searchTool,\n    actions.linear.issueCreate.asTool()\n  ],\n\n  \u002F\u002F Add knowledge bases\n  knowledge: [DocsKnowledgeBase, FAQKnowledgeBase],\n\n  \u002F\u002F Define exits for structured outputs\n  exits: [AnswerExit],\n\n  \u002F\u002F Model configuration\n  model: \"openai:gpt-4o\",\n  temperature: 0.7,\n  iterations: 10,  \u002F\u002F Max tool call iterations\n\n  \u002F\u002F Hooks for monitoring\n  hooks: {\n    onBeforeTool: async ({ tool, input }) => {\n      console.log(`Calling ${tool.name}`, input);\n      return { input: { ...input, enhanced: true } };  \u002F\u002F Modify input\n    },\n    onAfterTool: async ({ tool, output }) => {\n      console.log(`Result:`, output);\n    }\n  }\n});\n\n\u002F\u002F Handle structured exit\nif (result.is(AnswerExit)) {\n  console.log(result.output.answer);\n  console.log(result.output.sources);\n}\n```\n\n---\n\n## Troubleshooting\n\n| Error | Cause | Solution |\n|-------|-------|----------|\n| \"Cannot destructure property\" in Actions | Destructuring input directly in handler params | Use `async handler({ input, client })` then `const { field } = input` inside |\n| Table creation fails | Invalid table name or `id` defined | Remove `id` column, ensure name ends with \"Table\" |\n| Integration action not found | Integration not installed or configured | Run `adk list`, add with `adk add`, configure in UI at localhost:3001 |\n| Knowledge base not updating | KB not synced | Run `adk kb sync --dev` or `adk kb sync --force` |\n| Workflow not resuming | Dynamic step names | Use stable, unique step names (no `step(\\`item-${i}\\`)`) |\n| Types out of date | Generated types stale | Run `adk dev` or `adk build` to regenerate |\n| Can't message user from workflow | Missing conversationId | Pass `conversationId` when starting workflow, use `client.createMessage()` |\n| \"user is not defined\" | Accessing conversation context outside conversation | Use `context.get(\"user\", { optional: true })` |\n| State changes not persisting | Creating new objects instead of modifying | Modify state directly: `state.user.name = \"Alice\"` |\n| Tool not being used by AI | Poor description | Improve tool description, add detailed `.describe()` to inputs |\n\n**For more help:** Run `adk --help` or check:\n- **Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002F\n- **GitHub:** https:\u002F\u002Fgithub.com\u002Fbotpress\u002Fskills\u002Ftree\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\n\n---\n\n## Common Patterns & Best Practices\n\n### 1. Always Pass conversationId for Workflows\n```typescript\n\u002F\u002F In conversation - starting a workflow that needs to message back\nawait MyWorkflow.start({\n  conversationId: conversation.id,  \u002F\u002F Always include this!\n  data: \"...\"\n});\n\n\u002F\u002F In workflow - messaging back to user\nawait client.createMessage({\n  conversationId: input.conversationId,\n  type: \"text\",\n  payload: { text: \"Processing complete!\" }\n});\n```\n\n### 2. Use Environment Variables for Secrets\n```typescript\n\u002F\u002F In .env (never commit!)\nAPI_KEY=sk-...\nSLACK_TOKEN=xoxb-...\n\n\u002F\u002F In code\nconfig: { apiKey: process.env.API_KEY }\n```\n\n### 3. Keep Step Names Stable in Workflows\n```typescript\n\u002F\u002F GOOD - Single step for batch\nawait step(\"process-all-items\", async () => {\n  for (const item of items) {\n    await processItem(item);\n  }\n});\n\n\u002F\u002F BAD - Dynamic names break resume\nfor (let i = 0; i \u003C items.length; i++) {\n  await step(`process-${i}`, async () => { ... });  \u002F\u002F Don't do this!\n}\n```\n\n### 4. Error Handling in Actions\u002FTools\n```typescript\nexport default new Action({\n  handler: async ({ input }) => {\n    try {\n      \u002F\u002F Action logic\n      return { success: true };\n    } catch (error) {\n      console.error(\"Action failed:\", error);\n      throw new Error(`Failed to process: ${error.message}`);\n    }\n  }\n});\n```\n\n### 5. ThinkSignal for Tool Edge Cases\n```typescript\nhandler: async ({ query }) => {\n  const results = await search(query);\n\n  if (!results.length) {\n    throw new Autonomous.ThinkSignal(\n      \"No results\",\n      \"No results found. Ask the user to try different search terms.\"\n    );\n  }\n\n  return results;\n}\n```\n\n### 6. Multi-Channel Handling\n```typescript\nexport default new Conversation({\n  channels: [\"slack.channel\", \"webchat.channel\"],\n  handler: async ({ conversation }) => {\n    const channel = conversation.channel;\n\n    if (channel === \"slack.channel\") {\n      \u002F\u002F Slack-specific handling (threading, mentions, etc.)\n    } else if (channel === \"webchat.channel\") {\n      \u002F\u002F Webchat-specific handling\n    }\n  }\n});\n```\n\n---\n\n## Complete Reference Documentation\n\n### Official Botpress ADK Documentation\n**Base URL:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002F\n\n| Topic | URL |\n|-------|-----|\n| Introduction | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fintroduction |\n| Quickstart | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fquickstart |\n| Project Structure | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fproject-structure |\n| Actions | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Factions |\n| Tools | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Ftools |\n| Conversations | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Fconversations |\n| Workflows Overview | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Fworkflows\u002Foverview |\n| Workflow Steps | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Fworkflows\u002Fsteps |\n| Tables | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Ftables |\n| Triggers | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Ftriggers |\n| Knowledge Bases | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Fknowledge |\n| Managing Integrations | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fmanaging-integrations |\n| Zai Overview | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fzai\u002Foverview |\n| Zai Reference | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fzai\u002Freference |\n| CLI Reference | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fcli-reference |\n\n### GitHub Repository References (AI-Optimized)\n**Base URL:** https:\u002F\u002Fgithub.com\u002Fbotpress\u002Fskills\u002Ftree\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\n\nFor detailed specifications beyond this guide, fetch the corresponding reference file:\n\n| Topic | Reference File |\n|-------|----------------|\n| Actions | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Factions.md |\n| Tools | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Ftools.md |\n| Workflows | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fworkflows.md |\n| Conversations | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fconversations.md |\n| Tables | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Ftables.md |\n| Triggers | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Ftriggers.md |\n| Knowledge Bases | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fknowledge-bases.md |\n| Messages | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fmessages.md |\n| Agent Config | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fagent-config.md |\n| CLI | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fcli.md |\n| Integration Actions | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fintegration-actions.md |\n| Model Configuration | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fmodel-configuration.md |\n| Context API | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fcontext-api.md |\n| Tags | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Ftags.md |\n| Files | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Ffiles.md |\n| Zai Complete Guide | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fzai-complete-guide.md |\n| Zai Agent Reference | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fzai-agent-reference.md |\n| MCP Server | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fmcp-server.md |\n\n---\n\n## Common Scenarios - What to Build\n\n**\"I want to build a support bot that answers questions from our docs\"**\n1. Create a Knowledge Base with your documentation as a source\n2. Create a Conversation handler that uses `execute()` with that knowledge\n3. Add the `chat` integration for testing\n\n**\"I want the bot to create tickets in Linear when users report issues\"**\n1. Add the Linear integration: `adk add linear`\n2. Create a Tool that calls `actions.linear.issueCreate()`\n3. Pass the tool to `execute()` in your conversation\n\n**\"I need to run a daily sync job\"**\n1. Create a Workflow with `schedule: \"0 9 * * *\"` (cron syntax)\n2. Implement the sync logic in steps\n3. The workflow will run automatically at the scheduled time\n\n**\"I want to store user preferences\"**\n1. Define the schema in `agent.config.ts` under `user.state`\n2. Access\u002Fmodify via `user.state.preferenceField = value`\n3. State persists automatically\n\n**\"I need to react when a new user signs up\"**\n1. Create a Trigger listening to `user.created` event\n2. In the handler, start an onboarding workflow or send a welcome message\n\n**\"I want to store order data and search it\"**\n1. Create a Table with your schema (remember: no `id` field, name ends with \"Table\")\n2. Use `searchable: true` on text columns you want to search\n3. Use CRUD methods: `createRows`, `findRows`, `updateRows`, `deleteRows`\n\n---\n\n## Summary\n\nThis skill provides comprehensive guidance for building Botpress bots using the ADK:\n\n- **Setup & Initialization** - ADK installation and project creation\n- **Project Structure** - Conventions, files, and organization\n- **Core Concepts** - Actions, Tools, Workflows, Conversations, Tables, Knowledge, Triggers\n- **State Management** - Bot, user, conversation, and workflow state\n- **Integration Management** - Adding and configuring integrations\n- **Zai (AI Operations)** - Extract, check, label, summarize, answer, sort, group, rewrite, filter\n- **CLI Reference** - Complete command guide\n- **Testing & Deployment** - Local testing and cloud deployment\n- **Common Patterns** - Best practices and troubleshooting\n\n**Core Principle:** The ADK is a convention-based framework where file location determines behavior. Place components in the correct `src\u002F` subdirectory and they automatically become bot capabilities.\n\n**When to use this skill:**\n- User wants to create a new Botpress bot\n- User asks how to add actions, tools, workflows, conversations, tables, knowledge bases, or triggers\n- User needs help with integrations (Slack, Linear, GitHub, etc.)\n- User wants to understand ADK patterns and best practices\n- User has errors or needs troubleshooting\n- User asks about CLI commands, configuration, or deployment\n\n**Official Documentation:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002F\n**GitHub Repository:** https:\u002F\u002Fgithub.com\u002Fbotpress\u002Fadk\n**Skills Repository:** https:\u002F\u002Fgithub.com\u002Fbotpress\u002Fskills\n","# Botpress ADK Development Guide\n\nA comprehensive guide for building AI bots with the Botpress Agent Development Kit (ADK).\n\n## When to Use\n\n- User asks to build a Botpress bot or chatbot\n- User mentions ADK, Agent Development Kit, or Botpress\n- User wants to create actions, tools, workflows, conversations, tables, triggers, or knowledge bases\n- User needs help with `adk` CLI commands (init, dev, deploy, link)\n- User has ADK-related errors or needs troubleshooting\n- User asks about bot configuration, state management, or integrations\n\n## Quick Reference\n\nThe ADK is a **convention-based TypeScript framework** where **file structure maps directly to bot behavior**.\n\n**Your role:** Guide users through the entire bot development lifecycle - from project setup to deployment. Use the patterns and code examples in this skill to write correct, working ADK code.\n\n**Key principle:** In ADK, **where you put files matters**. Each component type has a specific `src\u002F` subdirectory, and files are auto-discovered based on location.\n\n## How to Use This Skill\n\n**This skill is your primary reference for building Botpress bots.** When a user asks you to build something with the ADK:\n\n1. **Identify what they need** - Is it a new bot, a feature (action, tool, workflow), data storage (table), or event handling (trigger)?\n2. **Check the correct directory** - Each component type goes in a specific `src\u002F` subdirectory\n3. **Use the patterns below** - Follow the code examples exactly, they represent the correct ADK conventions\n4. **Run `adk --help`** - For CLI commands not covered here, or `adk \u003Ccommand> --help` for specific help\n\n**Decision Guide - What Component to Create:**\n\n| User Wants To... | Create This | Location |\n|------------------|-------------|----------|\n| Handle user messages | Conversation | `src\u002Fconversations\u002F` |\n| Add a function the AI can call | Tool | `src\u002Ftools\u002F` |\n| Add reusable business logic | Action | `src\u002Factions\u002F` |\n| Run background\u002Fscheduled tasks | Workflow | `src\u002Fworkflows\u002F` |\n| Store structured data | Table | `src\u002Ftables\u002F` |\n| React to events (user created, etc.) | Trigger | `src\u002Ftriggers\u002F` |\n| Give AI access to docs\u002Fdata | Knowledge Base | `src\u002Fknowledge\u002F` |\n| Connect external service (Slack, etc.) | Integration | `adk add \u003Cname>` |\n\n**If the information in this skill isn't enough**, fetch the corresponding GitHub reference file (links provided in each section) for more detailed specifications.\n\n## Important: ADK is AI-Native\n\nThe ADK does **NOT** use traditional chatbot patterns. Don't create intents, entities, or dialog flows.\n\n**Instead of:**\n- Defining intents (`greet`, `orderPizza`, `checkStatus`)\n- Training entity extraction (`@pizzaSize`, `@toppings`)\n- Manually routing to intent handlers\n\n**ADK uses:**\n- `execute()` - The AI understands user intent naturally from instructions\n- Tools - AI autonomously decides when to call your functions\n- `zai.extract()` - Schema-based structured data extraction\n- Knowledge bases - RAG for grounding responses in your docs\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002F\n**GitHub:** https:\u002F\u002Fgithub.com\u002Fbotpress\u002Fskills\u002Ftree\u002Fmaster\u002Fskills\u002Fadk\n\n---\n\n## Prerequisites & Installation\n\nBefore using the ADK, ensure the user has:\n\n- **Botpress Account** - Create at https:\u002F\u002Fapp.botpress.cloud\n- **Node.js v22.0.0+** - Check with `node --version`\n- **Package Manager** - bun (recommended), pnpm, yarn, or npm\n\n**Install the ADK CLI:**\n\nmacOS & Linux:\n```bash\ncurl -fsSL https:\u002F\u002Fgithub.com\u002Fbotpress\u002Fadk\u002Freleases\u002Flatest\u002Fdownload\u002Finstall.sh | bash\n```\n\nWindows (PowerShell):\n```powershell\npowershell -c \"irm https:\u002F\u002Fgithub.com\u002Fbotpress\u002Fadk\u002Freleases\u002Flatest\u002Fdownload\u002Finstall.ps1 | iex\"\n```\n\n**Verify installation:**\n```bash\nadk --version\n```\n\nIf installation fails, check https:\u002F\u002Fgithub.com\u002Fbotpress\u002Fadk\u002Freleases for manual download options.\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fquickstart\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fcli.md\n\n---\n\n## Quick Start\n\nOnce the ADK CLI is installed, create a new bot:\n\n```bash\nadk init my-bot         # Create project (choose \"Hello World\" template for beginners)\ncd my-bot\nnpm install             # Or bun\u002Fpnpm\u002Fyarn\nadk login               # Authenticate with Botpress Cloud\nadk add chat            # Add the chat integration for testing\nadk dev                 # Start dev server with hot reload\nadk chat                # Test in CLI (run in separate terminal)\nadk deploy              # Deploy to production when ready\n```\n\nThe visual console at **http:\u002F\u002Flocalhost:3001\u002F** lets you configure integrations and test the bot.\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fquickstart\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fcli.md\n\n---\n\n## Linking and Deploying Your Bot\n\n**IMPORTANT:** Your bot must be linked to Botpress Cloud and deployed for it to work. The ADK runs locally during development but the bot itself lives in Botpress Cloud.\n\n### The Correct Order: Link → Dev → Deploy\n\nFollow this order to get your bot working:\n\n```bash\n# 1. LINK - Connect your project to Botpress Cloud (creates agent.json)\nadk link\n\n# 2. DEV - Start the development server (hot reload, testing)\nadk dev\n\n# 3. DEPLOY - Push to production when ready\nadk deploy\n```\n\n**Step-by-step:**\n\n1. **`adk link`** - Links your local project to a bot in Botpress Cloud. This creates `agent.json` with your workspace and bot IDs. Run this first before anything else.\n\n2. **`adk dev`** - Starts the local development server with hot reloading. Opens the dev console at http:\u002F\u002Flocalhost:3001 where you can configure integrations and test your bot. Use `adk chat` in a separate terminal to test.\n\n3. **`adk deploy`** - Deploys your bot to production. Run this when you're ready for your bot to be live and accessible through production channels (Slack, WhatsApp, webchat, etc.).\n\n### Troubleshooting Errors\n\n**If you encounter errors when running `adk dev` or `adk deploy`:**\n\n1. **Check the logs** - Look at the terminal output or the logs panel in the dev console at http:\u002F\u002Flocalhost:3001\n2. **Copy the error message** - Select and copy the full error message from the logs\n3. **Ask for help** - Paste the error back to the AI assistant and ask it to help fix the issue\n\nCommon error scenarios:\n- **Integration configuration errors:** Usually means an integration needs to be configured in the UI at localhost:3001\n- **Type errors:** Often caused by incorrect imports or schema mismatches\n- **Deployment failures:** May indicate missing environment variables or invalid configuration\n\n**Example workflow for fixing errors:**\n```\n1. Run `adk dev` or `adk deploy`\n2. See error in terminal\u002Flogs\n3. Copy the error message\n4. Tell the AI: \"I got this error when running adk dev: [paste error]\"\n5. The AI will help diagnose and fix the issue\n```\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fquickstart\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fcli.md\n\n---\n\n## Project Structure\n\n**Critical rule:** File location determines behavior. Place components in the correct `src\u002F` subdirectory or they won't be discovered.\n\n```\nmy-bot\u002F\n├── agent.config.ts    # Bot configuration: name, models, state schemas, integrations\n├── agent.json         # Workspace\u002Fbot IDs (auto-generated by adk link\u002Fdev, add to .gitignore)\n├── package.json       # Node.js dependencies and scripts (dev, build, deploy)\n├── tsconfig.json      # TypeScript configuration\n├── .env               # API keys and secrets (never commit!)\n├── .gitignore         # Should include: agent.json, .env, node_modules\u002F, .botpress\u002F\n├── src\u002F\n│   ├── conversations\u002F # Handle incoming messages → use execute() for AI responses\n│   ├── workflows\u002F     # Background processes → use step() for resumable operations\n│   ├── actions\u002F       # Reusable functions → call from anywhere with actions.name()\n│   ├── tools\u002F         # AI-callable functions → AI decides when to invoke these\n│   ├── tables\u002F        # Data storage → auto-synced to cloud, supports semantic search\n│   ├── triggers\u002F      # Event handlers → react to user.created, integration events, etc.\n│   └── knowledge\u002F     # RAG sources → index docs, websites, or tables for AI context\n└── .botpress\u002F         # Auto-generated types (never edit manually)\n```\n\n**Key Configuration Files:**\n\n- **agent.config.ts** - Primary configuration defining bot metadata, AI models, state schemas, and integrations (you edit this)\n- **agent.json** - Links agent to workspace\u002Fbot IDs. Auto-generated by `adk link` or `adk dev`. **Add to .gitignore** - contains environment-specific IDs that differ per developer\n- **package.json** - Node.js config with `@botpress\u002Fruntime` dependency and scripts for `dev`, `build`, `deploy`\n- **tsconfig.json** - TypeScript configuration for the project\n- **.env** - Environment variables for API keys and secrets (never commit!)\n- **.gitignore** - Should include: `agent.json`, `.env`, `node_modules\u002F`, `.botpress\u002F`\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fproject-structure\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fagent-config.md\n\n---\n\n## Agent Configuration\n\nThe `agent.config.ts` file defines your bot's identity, AI models, state schemas, and integrations. Always start here when setting up a new bot.\n\n```typescript\nimport { defineConfig, z } from \"@botpress\u002Fruntime\";\n\nexport default defineConfig({\n  name: \"my-support-bot\",\n  description: \"AI customer support assistant\",\n\n  \u002F\u002F AI models for different operations\n  defaultModels: {\n    autonomous: \"openai:gpt-4o\",      \u002F\u002F Used by execute() for conversations\n    zai: \"openai:gpt-4o-mini\"         \u002F\u002F Used by zai operations (cheaper, faster)\n  },\n\n  \u002F\u002F Global bot state - shared across all conversations and users\n  bot: {\n    state: z.object({\n      maintenanceMode: z.boolean().default(false),\n      totalConversations: z.number().default(0)\n    })\n  },\n\n  \u002F\u002F Per-user state - persists across all conversations for each user\n  user: {\n    state: z.object({\n      name: z.string().optional(),\n      tier: z.enum([\"free\", \"pro\"]).default(\"free\"),\n      preferredLanguage: z.enum([\"en\", \"es\", \"fr\"]).default(\"en\")\n    }),\n    tags: {\n      source: z.string(),\n      region: z.string().optional()\n    }\n  },\n\n  \u002F\u002F Per-conversation state\n  conversation: {\n    state: z.object({\n      context: z.string().optional()\n    }),\n    tags: {\n      category: z.enum([\"support\", \"sales\", \"general\"]),\n      priority: z.enum([\"low\", \"medium\", \"high\"]).optional()\n    }\n  },\n\n  \u002F\u002F Integrations your bot uses (ADK 1.9+ format)\n  dependencies: {\n    integrations: {\n      chat: { version: \"chat@0.7.3\", enabled: true },\n      slack: { version: \"slack@2.5.5\", enabled: true }\n    }\n  }\n});\n```\n\n**Available models:**\n- OpenAI: `openai:gpt-4o`, `openai:gpt-4o-mini`, `openai:gpt-4-turbo`\n- Anthropic: `anthropic:claude-3-5-sonnet`, `anthropic:claude-3-opus`\n- Google: `google:gemini-1.5-pro`, `google:gemini-1.5-flash`\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fproject-structure\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fagent-config.md\n\n---\n\n## Core Concepts\n\n### 1. Actions - Reusable Business Logic\n\n**When to create an Action:**\n- You need reusable logic that will be called from multiple places (workflows, conversations, triggers)\n- You're wrapping an external API or database operation\n- You want testable, composable business logic\n- You need to call integration APIs (Slack, Linear, etc.) with custom logic\n\n**When NOT to use an Action (use a Tool instead):**\n- You want the AI to decide when to call it autonomously\n- The function should be available during `execute()`\n\nActions are **not** directly callable by the AI - convert them to tools with `.asTool()` if the AI needs to use them.\n\n**Location:** `src\u002Factions\u002F*.ts`\n\n```typescript\nimport { Action, z } from \"@botpress\u002Fruntime\";\n\nexport const fetchUser = new Action({\n  name: \"fetchUser\",\n  description: \"Retrieves user details from the database\",\n\n  \u002F\u002F Define input\u002Foutput with Zod schemas for type safety\n  input: z.object({ userId: z.string() }),\n  output: z.object({ name: z.string(), email: z.string() }),\n\n  \u002F\u002F IMPORTANT: Handler receives { input, client } - destructure input INSIDE the handler\n  async handler({ input, client }) {\n    const { user } = await client.getUser({ id: input.userId });\n    return { name: user.name, email: user.tags.email };\n  }\n});\n```\n\n**Calling actions:**\n```typescript\nimport { actions } from \"@botpress\u002Fruntime\";\nconst userData = await actions.fetchUser({ userId: \"123\" });\n\n\u002F\u002F To make an action callable by the AI, convert it to a tool:\ntools: [actions.fetchUser.asTool()]\n```\n\n**Key Rules:**\n- Handler receives `{ input, client }` - must destructure `input` inside the handler\n- Cannot destructure input fields directly in parameters\n- Can call other actions, integration actions, access state\n- Can be converted to tools with `.asTool()`\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Factions\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Factions.md\n\n---\n\n### 2. Tools - AI-Callable Functions\n\n**When to create a Tool:**\n- You want the AI to autonomously decide when to use this function\n- The function retrieves information the AI needs (search, lookup, fetch)\n- The function performs actions on behalf of the user (create ticket, send message)\n- You're building capabilities the AI should have during conversations\n\n**The AI decides when to use tools based on:**\n1. The tool's `description` - Make this clear and specific about WHEN to use it\n2. The input schema's `.describe()` fields - Help AI understand what parameters mean\n3. The conversation context and user's intent\n\n**Key difference from Actions:** Tools can destructure input directly; Actions cannot.\n\n**Location:** `src\u002Ftools\u002F*.ts`\n\n```typescript\nimport { Autonomous, z } from \"@botpress\u002Fruntime\";\n\nexport const searchProducts = new Autonomous.Tool({\n  name: \"searchProducts\",\n  \u002F\u002F This description is critical - it tells the AI when to use this tool\n  description: \"Search the product catalog. Use when user asks about products, availability, pricing, or wants to browse items.\",\n\n  input: z.object({\n    query: z.string().describe(\"Search keywords\"),\n    category: z.string().optional().describe(\"Filter by category\")\n  }),\n  output: z.object({\n    products: z.array(z.object({ id: z.string(), name: z.string(), price: z.number() }))\n  }),\n\n  \u002F\u002F Unlike actions, tools CAN destructure input directly in the handler\n  handler: async ({ query, category }) => {\n    \u002F\u002F Your search logic here\n    return { products: [] };\n  }\n});\n```\n\n**Using ThinkSignal:** When a tool can't complete but you want to give the AI context:\n```typescript\nimport { Autonomous } from \"@botpress\u002Fruntime\";\n\n\u002F\u002F Inside handler - AI will see this message and can respond appropriately\nthrow new Autonomous.ThinkSignal(\n  \"No results found\",\n  \"No products found matching that query. Ask user to try different search terms.\"\n);\n```\n\n**Advanced Tool Properties:**\n```typescript\nexport const myTool = new Autonomous.Tool({\n  name: \"myTool\",\n  description: \"Tool description\",\n  input: z.object({...}),\n  output: z.object({...}),\n  aliases: [\"searchDocs\", \"findDocs\"],  \u002F\u002F Alternative names\n  handler: async (input, ctx) => {\n    console.log(`Call ID: ${ctx.callId}`);  \u002F\u002F Unique call identifier\n    \u002F\u002F ...\n  },\n  retry: async ({ attempt, error }) => {\n    if (attempt \u003C 3 && error?.code === 'RATE_LIMIT') {\n      await new Promise(r => setTimeout(r, 1000 * attempt));\n      return true;  \u002F\u002F Retry\n    }\n    return false;  \u002F\u002F Don't retry\n  }\n});\n```\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Ftools\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Ftools.md\n\n---\n\n### 3. Conversations - Message Handlers\n\n**When to create a Conversation:**\n- Every bot needs at least one conversation handler to respond to users\n- Create separate handlers for different channels if they need different behavior\n- Use `channel: \"*\"` to handle all channels with one handler\n\n**Key decisions when building a conversation:**\n1. **Which channels?** - Specify `\"*\"` for all, or specific channels like `\"slack.dm\"`\n2. **What tools does the AI need?** - Pass them to `execute({ tools: [...] })`\n3. **What knowledge should ground responses?** - Pass to `execute({ knowledge: [...] })`\n4. **What instructions guide the AI?** - Define personality, rules, and context\n\n**The `execute()` function is the heart of ADK** - it runs autonomous AI logic with your tools and knowledge. Most conversation handlers will call `execute()`.\n\n**Location:** `src\u002Fconversations\u002F*.ts`\n\n```typescript\nimport { Conversation, z } from \"@botpress\u002Fruntime\";\n\nexport const Chat = new Conversation({\n  \u002F\u002F Which channels this handler responds to\n  channel: \"chat.channel\",  \u002F\u002F Or \"*\" for all, or [\"slack.dm\", \"webchat.channel\"]\n\n  \u002F\u002F Per-conversation state (optional)\n  state: z.object({\n    messageCount: z.number().default(0)\n  }),\n\n  async handler({ message, state, conversation, execute, user }) {\n    state.messageCount += 1;\n\n    \u002F\u002F Handle commands\n    if (message?.payload?.text?.startsWith(\"\u002Fhelp\")) {\n      await conversation.send({\n        type: \"text\",\n        payload: { text: \"Available commands: \u002Fhelp, \u002Fstatus\" }\n      });\n      return;\n    }\n\n    \u002F\u002F Let the AI handle the response with your tools and knowledge\n    await execute({\n      \u002F\u002F Instructions guide the AI's behavior and personality\n      instructions: `You are a helpful customer support agent for Acme Corp.\n        User's name: ${user.state.name || \"there\"}\n        User's tier: ${user.state.tier}\n        Be friendly, concise, and always offer to help further.`,\n\n      \u002F\u002F Tools the AI can use during this conversation\n      tools: [searchProducts, actions.createTicket.asTool()],\n\n      \u002F\u002F Knowledge bases for RAG - AI will search these to ground responses\n      knowledge: [DocsKnowledgeBase],\n\n      model: \"openai:gpt-4o\",\n      temperature: 0.7,\n      iterations: 10  \u002F\u002F Max tool call iterations\n    });\n  }\n});\n```\n\n**Handler Context:**\n- `message` - User's message data\n- `execute` - Run autonomous AI logic\n- `conversation` - Conversation instance methods (send, startTyping, stopTyping)\n- `state` - Mutable state (bot, user, conversation)\n- `client` - Botpress API client\n- `type` - Event classification (message, workflow_request)\n\n**Execute Function Options:**\n```typescript\nawait execute({\n  instructions: string | async function,  \u002F\u002F Required\n  tools: Tool[],                          \u002F\u002F AI-callable tools\n  knowledge: Knowledge[],                 \u002F\u002F Knowledge bases for RAG\n  exits: Exit[],                          \u002F\u002F Structured exit handlers\n  model: string,                          \u002F\u002F AI model to use\n  temperature: number,                    \u002F\u002F 0-1, default 0.7\n  iterations: number,                     \u002F\u002F Max tool calls, default 10\n  hooks: {\n    onBeforeTool: async ({ tool, input }) => { ... },\n    onAfterTool: async ({ tool, output }) => { ... },\n    onTrace: async (trace) => { ... }\n  }\n});\n```\n\n**Common channels:** `chat.channel`, `webchat.channel`, `slack.dm`, `slack.channel`, `discord.channel`, `whatsapp.channel`, `\"*\"` (all)\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Fconversations\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fconversations.md\n\n---\n\n### 4. Workflows - Background & Multi-Step Processes\n\n**When to create a Workflow:**\n- Operations that take longer than 2 minutes (the default timeout)\n- Multi-step processes that need to survive crashes\u002Frestarts\n- Scheduled\u002Frecurring tasks (daily reports, periodic syncs)\n- Background processing (order fulfillment, data migration)\n- Operations that need to wait for external events or user input\n\n**When NOT to use a Workflow (handle in conversation instead):**\n- Quick operations that complete immediately\n- Simple request-response patterns\n- Operations that don't need persistence\n\n**Key workflow concepts:**\n- **Steps are checkpoints** - If workflow crashes, it resumes from last completed step\n- **State persists** - Store progress in `state` to track across steps\n- **Always pass conversationId** - If the workflow needs to message users back\n\n**Location:** `src\u002Fworkflows\u002F*.ts`\n\n```typescript\nimport { Workflow, z } from \"@botpress\u002Fruntime\";\n\nexport const ProcessOrderWorkflow = new Workflow({\n  name: \"processOrder\",\n  description: \"Processes customer orders\",\n  timeout: \"6h\",                    \u002F\u002F Max duration\n  schedule: \"0 9 * * *\",            \u002F\u002F Optional: run daily at 9am (cron syntax)\n\n  input: z.object({\n    orderId: z.string(),\n    conversationId: z.string()      \u002F\u002F Include this to message the user back!\n  }),\n\n  state: z.object({\n    currentStep: z.number().default(0),\n    processedItems: z.array(z.string()).default([])\n  }),\n\n  output: z.object({\n    success: z.boolean(),\n    itemsProcessed: z.number()\n  }),\n\n  async handler({ input, state, step, client, execute }) {\n    \u002F\u002F State is passed as parameter, auto-tracked\n    state.currentStep = 1;\n\n    \u002F\u002F IMPORTANT: Each step needs a unique, stable name (no dynamic names!)\n    const orderData = await step(\"fetch-order\", async () => {\n      return await fetchOrderData(input.orderId);\n    });\n\n    \u002F\u002F Steps can have retry logic\n    await step(\"process-payment\", async () => {\n      return await processPayment(orderData);\n    }, { maxAttempts: 3 });\n\n    \u002F\u002F To message the user from a workflow, use client.createMessage (NOT conversation.send)\n    await step(\"notify-user\", async () => {\n      await client.createMessage({\n        conversationId: input.conversationId,\n        type: \"text\",\n        payload: { text: \"Your order has been processed!\" }\n      });\n    });\n\n    return {\n      success: true,\n      itemsProcessed: state.processedItems.length\n    };\n  }\n});\n\n\u002F\u002F Start a workflow from a conversation or trigger\nawait ProcessOrderWorkflow.start({\n  orderId: \"123\",\n  conversationId: conversation.id  \u002F\u002F Always pass this if you need to message back\n});\n\n\u002F\u002F Get or create with deduplication\nconst instance = await ProcessOrderWorkflow.getOrCreate({\n  key: `order-${orderId}`,  \u002F\u002F Prevents duplicate workflows\n  input: { orderId, conversationId }\n});\n```\n\n**Step Methods:**\n\n| Method | Purpose |\n|--------|---------|\n| `step(name, fn)` | Basic execution with caching |\n| `step.sleep(name, ms)` | Pause for milliseconds |\n| `step.sleepUntil(name, date)` | Pause until specific date |\n| `step.listen()` | Wait for external events |\n| `step.progress(msg)` | Update progress message |\n| `step.request(name, prompt)` | Request user input (blocking) |\n| `step.executeWorkflow()` | Start and await another workflow |\n| `step.waitForWorkflow(id)` | Wait for existing workflow |\n| `step.map(items, fn)` | Process array with concurrency |\n| `step.forEach(items, fn)` | Execute on items without results |\n| `step.batch(items, fn)` | Process in groups |\n| `step.fail(reason)` | Mark workflow as failed |\n| `step.abort()` | Stop immediately without failure |\n\n**Critical Rules:**\n- Step names must be **unique** and **stable** (avoid dynamic naming in loops)\n- State is passed as a parameter, not accessed via `this.state`\n- Always pass `conversationId` for workflows that need to message users\n- Default timeout is 2 minutes - use steps for longer processes\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Fworkflows\u002Foverview\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fworkflows.md\n\n---\n\n### 5. Tables - Data Storage\n\n**When to create a Table:**\n- You need to persist structured data (users, orders, tickets, logs)\n- You want to query\u002Ffilter data by fields\n- You need semantic search on text content (set `searchable: true`)\n- You're storing data that should survive bot restarts\n\n**When NOT to use a Table (use State instead):**\n- Simple key-value data per user\u002Fconversation → use `user.state` or `conversation.state`\n- Temporary data that doesn't need persistence\n- Small amounts of data that fit in state\n\n**Tables vs Knowledge Bases:**\n- **Tables** = Structured data you CRUD (create, read, update, delete)\n- **Knowledge Bases** = Documents\u002Fcontent for AI to search and reference\n\n**Location:** `src\u002Ftables\u002F*.ts`\n\n**CRITICAL RULES (violations will cause errors):**\n- Do NOT define an `id` column - it's created automatically as a number\n- Table names MUST end with \"Table\" (e.g., `OrdersTable`, not `Orders`)\n\n```typescript\nimport { Table, z } from \"@botpress\u002Fruntime\";\n\nexport const OrdersTable = new Table({\n  name: \"OrdersTable\",  \u002F\u002F Must end with \"Table\"\n  description: \"Stores order information\",\n  columns: {\n    \u002F\u002F NO id column - it's automatic!\n    orderId: z.string(),\n    userId: z.string(),\n    status: z.enum([\"pending\", \"completed\", \"cancelled\"]),\n    total: z.number(),\n    createdAt: z.date(),\n    \u002F\u002F Enable semantic search on a column:\n    notes: {\n      schema: z.string(),\n      searchable: true\n    }\n  }\n});\n```\n\n**CRUD operations:**\n```typescript\n\u002F\u002F Create - id is auto-assigned\nawait OrdersTable.createRows({\n  rows: [{ orderId: \"ord-123\", userId: \"user-456\", status: \"pending\", total: 99.99, createdAt: new Date() }]\n});\n\n\u002F\u002F Read with filters\nconst { rows } = await OrdersTable.findRows({\n  filter: { userId: \"user-456\", status: \"pending\" },\n  orderBy: \"createdAt\",\n  orderDirection: \"desc\",\n  limit: 10\n});\n\n\u002F\u002F Get single row by id\nconst row = await OrdersTable.getRow({ id: 123 });\n\n\u002F\u002F Semantic search (on searchable columns)\nconst { rows } = await OrdersTable.findRows({\n  search: \"delivery issue\",\n  limit: 5\n});\n\n\u002F\u002F Update - must include the id\nawait OrdersTable.updateRows({\n  rows: [{ id: 1, status: \"completed\" }]\n});\n\n\u002F\u002F Upsert - insert or update based on key column\nawait OrdersTable.upsertRows({\n  rows: [{ orderId: \"ord-123\", status: \"shipped\" }],\n  keyColumn: \"orderId\"\n});\n\n\u002F\u002F Delete by filter\nawait OrdersTable.deleteRows({ status: \"cancelled\" });\n\n\u002F\u002F Delete by IDs\nawait OrdersTable.deleteRowIds([123, 456]);\n```\n\n**Advanced: Computed Columns:**\n```typescript\ncolumns: {\n  basePrice: z.number(),\n  taxRate: z.number(),\n  fullPrice: {\n    computed: true,\n    schema: z.number(),\n    dependencies: [\"basePrice\", \"taxRate\"],\n    value: async (row) => row.basePrice * (1 + row.taxRate)\n  }\n}\n```\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Ftables\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Ftables.md\n\n---\n\n### 6. Knowledge Bases - RAG for AI Context\n\n**When to create a Knowledge Base:**\n- You want the AI to answer questions based on your documentation\n- You have FAQs, policies, or product info the AI should reference\n- You want AI responses grounded in specific content (not hallucinated)\n- You're building a support bot that needs access to help articles\n\n**How RAG works in ADK:**\n1. You define knowledge sources (websites, files, tables)\n2. Content is indexed and embedded for semantic search\n3. During `execute()`, the AI automatically searches relevant knowledge\n4. AI uses retrieved content to generate grounded responses\n\n**Choosing a DataSource type:**\n- **Website** - Index public documentation, help sites, blogs\n- **Directory** - Index local markdown\u002Ftext files (dev only!)\n- **Table** - Index structured data from your tables\n\n**Location:** `src\u002Fknowledge\u002F*.ts`\n\n```typescript\nimport { Knowledge, DataSource } from \"@botpress\u002Fruntime\";\n\n\u002F\u002F Website source - index via sitemap\nconst websiteSource = DataSource.Website.fromSitemap(\n  \"https:\u002F\u002Fdocs.example.com\u002Fsitemap.xml\",\n  {\n    id: \"website-docs\",\n    maxPages: 500,\n    maxDepth: 10,\n    filter: (ctx) => ctx.url.includes(\"\u002Fdocs\u002F\")  \u002F\u002F Only index \u002Fdocs\u002F pages\n  }\n);\n\n\u002F\u002F Local files (development only - won't work in production)\nconst localSource = DataSource.Directory.fromPath(\"src\u002Fknowledge\u002Fdocs\", {\n  id: \"local-docs\",\n  filter: (path) => path.endsWith(\".md\")\n});\n\n\u002F\u002F Table-based knowledge\nconst tableSource = DataSource.Table.fromTable(FAQTable, {\n  id: \"faq-table\",\n  transform: ({ row }) => `Question: ${row.question}\\nAnswer: ${row.answer}`,\n  filter: ({ row }) => row.published === true\n});\n\nexport const DocsKB = new Knowledge({\n  name: \"docsKB\",\n  description: \"Product documentation and help articles\",\n  sources: [websiteSource, localSource, tableSource]\n});\n\n\u002F\u002F Use in conversations - AI will search this knowledge base\nawait execute({\n  instructions: \"Answer based on the documentation\",\n  knowledge: [DocsKB]\n});\n\n\u002F\u002F Manually refresh knowledge base\nawait DocsKB.refresh();                  \u002F\u002F Smart refresh (only changed content)\nawait DocsKB.refresh({ force: true });   \u002F\u002F Force full re-index\nawait DocsKB.refreshSource(\"website-docs\", { force: true });  \u002F\u002F Refresh specific source\n```\n\n**Website Source Methods:**\n- `fromSitemap(url, options)` - Parse XML sitemap\n- `fromWebsite(baseUrl, options)` - Crawl from base URL (requires Browser integration)\n- `fromLlmsTxt(url, options)` - Parse llms.txt file\n- `fromUrls(urls, options)` - Index specific URLs\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Fknowledge\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fknowledge-bases.md\n\n---\n\n### 7. Triggers - Event-Driven Automation\n\n**When to create a Trigger:**\n- You need to react to events automatically (user signs up, issue created, etc.)\n- You want to start workflows when specific events occur\n- You need to sync data when external systems change\n- You want to send notifications based on events\n\n**Common trigger patterns:**\n- **User onboarding** - Trigger on `user.created` → start onboarding workflow\n- **Integration sync** - Trigger on `linear:issueCreated` → create record in table\n- **Notifications** - Trigger on `workflow.completed` → send Slack message\n\n**Finding available events:**\n- Bot events: `user.created`, `conversation.started`, `workflow.completed`, etc.\n- Integration events: Run `adk info \u003Cintegration> --events` to see available events\n\n**Location:** `src\u002Ftriggers\u002F*.ts`\n\n```typescript\nimport { Trigger } from \"@botpress\u002Fruntime\";\n\nexport default new Trigger({\n  name: \"onNewUser\",\n  description: \"Start onboarding when user created\",\n  events: [\"user.created\"],  \u002F\u002F Can listen to multiple events\n\n  handler: async ({ event, client, actions }) => {\n    const { userId, email } = event.payload;\n\n    \u002F\u002F Start an onboarding workflow\n    await OnboardingWorkflow.start({\n      userId,\n      email\n    });\n  }\n});\n\n\u002F\u002F Integration events use format: integration:eventName\nexport const LinearTrigger = new Trigger({\n  name: \"onLinearIssue\",\n  description: \"Handle Linear issue events\",\n  events: [\"linear:issueCreated\", \"linear:issueUpdated\"],\n\n  handler: async ({ event, actions }) => {\n    if (event.type === \"linear:issueCreated\") {\n      await actions.slack.sendMessage({\n        channel: \"#notifications\",\n        text: `New issue: ${event.payload.title}`\n      });\n    }\n  }\n});\n```\n\n**Common Bot Events:**\n- `user.created`, `user.updated`, `user.deleted`\n- `conversation.started`, `conversation.ended`, `message.created`\n- `workflow.started`, `workflow.completed`, `workflow.failed`\n- `bot.started`, `bot.stopped`\n\n**Common Integration Events:**\n- Slack: `slack:reactionAdded`, `slack:memberJoinedChannel`\n- Linear: `linear:issueCreated`, `linear:issueUpdated`\n- GitHub: `github:issueOpened`, `github:pullRequestOpened`\n- Intercom: `intercom:conversationEvent`, `intercom:contactEvent`\n\n**Find integration events:** Run `adk info \u003Cintegration> --events`\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Ftriggers\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Ftriggers.md\n\n---\n\n## Sending Messages\n\n**CRITICAL: The method depends on WHERE you're sending from:**\n\n| Context | Method | Why |\n|---------|--------|-----|\n| In Conversations | `conversation.send()` | Has conversation context |\n| In Workflows\u002FActions | `client.createMessage()` | Needs explicit `conversationId` |\n\n**Common mistake:** Using `client.createMessage()` in conversations. Always use `conversation.send()` instead.\n\nThe method depends on where you're sending from:\n\n**In conversations** - Use `conversation.send()`:\n```typescript\nawait conversation.send({ type: \"text\", payload: { text: \"Hello!\" } });\nawait conversation.send({ type: \"image\", payload: { imageUrl: \"https:\u002F\u002F...\" } });\nawait conversation.send({\n  type: \"choice\",\n  payload: {\n    text: \"Pick one:\",\n    choices: [\n      { title: \"Option A\", value: \"a\" },\n      { title: \"Option B\", value: \"b\" }\n    ]\n  }\n});\n```\n\n**In workflows or actions** - Use `client.createMessage()` with `conversationId`:\n```typescript\nawait client.createMessage({\n  conversationId: input.conversationId,  \u002F\u002F Must have this!\n  type: \"text\",\n  payload: { text: \"Workflow complete!\" }\n});\n```\n\n**All Message Types:**\n```typescript\n\u002F\u002F Text\n{ type: \"text\", payload: { text: \"Hello!\" } }\n\n\u002F\u002F Markdown\n{ type: \"markdown\", payload: { text: \"# Heading\\n**Bold**\" } }\n\n\u002F\u002F Image\n{ type: \"image\", payload: { imageUrl: \"https:\u002F\u002F...\" } }\n\n\u002F\u002F Audio\n{ type: \"audio\", payload: { audioUrl: \"https:\u002F\u002F...\" } }\n\n\u002F\u002F Video\n{ type: \"video\", payload: { videoUrl: \"https:\u002F\u002F...\" } }\n\n\u002F\u002F File\n{ type: \"file\", payload: { fileUrl: \"https:\u002F\u002F...\", title: \"Document.pdf\" } }\n\n\u002F\u002F Location\n{ type: \"location\", payload: { latitude: 40.7128, longitude: -74.0060, address: \"New York, NY\" } }\n\n\u002F\u002F Card\n{ type: \"card\", payload: {\n  title: \"Product Name\",\n  subtitle: \"Description\",\n  imageUrl: \"https:\u002F\u002F...\",\n  actions: [\n    { action: \"url\", label: \"View\", value: \"https:\u002F\u002F...\" },\n    { action: \"postback\", label: \"Buy\", value: \"buy_123\" }\n  ]\n}}\n\n\u002F\u002F Carousel\n{ type: \"carousel\", payload: {\n  items: [\n    { title: \"Item 1\", subtitle: \"...\", imageUrl: \"...\", actions: [...] },\n    { title: \"Item 2\", subtitle: \"...\", imageUrl: \"...\", actions: [...] }\n  ]\n}}\n\n\u002F\u002F Choice (Quick Replies)\n{ type: \"choice\", payload: {\n  text: \"Select an option:\",\n  choices: [\n    { title: \"Option 1\", value: \"opt1\" },\n    { title: \"Option 2\", value: \"opt2\" }\n  ]\n}}\n\n\u002F\u002F Dropdown\n{ type: \"dropdown\", payload: {\n  text: \"Select country:\",\n  options: [\n    { label: \"United States\", value: \"us\" },\n    { label: \"Canada\", value: \"ca\" }\n  ]\n}}\n```\n\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fmessages.md\n\n---\n\n## Zai - LLM Utility Operations\n\n**When to use Zai vs execute():**\n- **Use `zai`** for specific, structured AI operations (extract data, classify, summarize)\n- **Use `execute()`** for autonomous, multi-turn AI conversations with tools\n\n**Zai is perfect for:**\n- Extracting structured data from user messages (`zai.extract`)\n- Classifying\u002Flabeling content (`zai.check`, `zai.label`)\n- Summarizing long content (`zai.summarize`)\n- Answering questions from documents (`zai.answer`)\n- Sorting\u002Ffiltering\u002Fgrouping data intelligently (`zai.sort`, `zai.filter`, `zai.group`)\n\n**Zai operations are optimized for speed and cost** - they use the `zai` model configured in `agent.config.ts` (typically a faster\u002Fcheaper model).\n\n```typescript\nimport { adk, z } from \"@botpress\u002Fruntime\";\n\n\u002F\u002F Extract structured data from text\nconst contact = await adk.zai.extract(\n  \"Contact John at john@example.com, phone 555-0100\",\n  z.object({\n    name: z.string(),\n    email: z.string(),\n    phone: z.string()\n  })\n);\n\u002F\u002F Returns: { name: \"John\", email: \"john@example.com\", phone: \"555-0100\" }\n\n\u002F\u002F Check if text matches a condition (returns boolean)\nconst isSpam = await adk.zai.check(messageText, \"is spam or promotional\");\n\n\u002F\u002F Label text with multiple criteria\nconst labels = await adk.zai.label(customerEmail, {\n  spam: \"is spam\",\n  urgent: \"needs immediate response\",\n  complaint: \"expresses dissatisfaction\"\n});\n\u002F\u002F Returns: { spam: false, urgent: true, complaint: true }\n\n\u002F\u002F Summarize content\nconst summary = await adk.zai.summarize(longDocument, {\n  length: 200,\n  bulletPoints: true\n});\n\n\u002F\u002F Answer questions from documents (with citations)\nconst result = await adk.zai.answer(docs, \"What is the refund policy?\");\nif (result.type === \"answer\") {\n  console.log(result.answer);\n  console.log(result.citations);\n}\n\u002F\u002F Response types: \"answer\", \"ambiguous\", \"out_of_topic\", \"invalid_question\", \"missing_knowledge\"\n\n\u002F\u002F Rate items on 1-5 scale\nconst scores = await adk.zai.rate(products, \"quality score\");\n\n\u002F\u002F Sort by criteria\nconst sorted = await adk.zai.sort(tickets, \"by urgency, most urgent first\");\n\n\u002F\u002F Group items semantically\nconst groups = await adk.zai.group(emails, {\n  instructions: \"categorize by topic\"\n});\n\n\u002F\u002F Rewrite text\nconst professional = await adk.zai.rewrite(\"hey wassup\", \"make it professional and friendly\");\n\n\u002F\u002F Filter arrays\nconst activeUsers = await adk.zai.filter(users, \"have been active this month\");\n\n\u002F\u002F Generate text\nconst blogPost = await adk.zai.text(\"Write about AI in healthcare\", {\n  length: 1000,\n  temperature: 0.7\n});\n\n\u002F\u002F Patch code files\nconst patched = await adk.zai.patch(files, \"add JSDoc comments to all functions\");\n```\n\n**Zai Configuration:**\n```typescript\n\u002F\u002F Create configured instance\nconst preciseZai = adk.zai.with({\n  modelId: \"best\",        \u002F\u002F \"best\" | \"fast\" | custom model ID\n  temperature: 0.1\n});\n\n\u002F\u002F Enable active learning\nconst learningZai = adk.zai.learn(\"sentiment-analysis\");\n```\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fzai\u002Foverview\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fzai-complete-guide.md\n\n---\n\n## Integrations\n\n**When to add an Integration:**\n- You need to connect to an external service (Slack, Linear, GitHub, etc.)\n- You want to receive messages from a channel (webchat, WhatsApp, Discord)\n- You need to call external APIs with pre-built actions\n- You want to react to events from external systems\n\n**Integration workflow:**\n1. **Search** - Find integrations with `adk search \u003Cname>`\n2. **Add** - Install with `adk add \u003Cname>@\u003Cversion>`\n3. **Configure** - Set up credentials in the UI at `http:\u002F\u002Flocalhost:3001\u002F`\n4. **Use** - Call actions via `actions.\u003Cintegration>.\u003Caction>()`\n\n**Making integration actions available to AI:**\n```typescript\n\u002F\u002F Convert any integration action to an AI-callable tool\ntools: [actions.slack.sendMessage.asTool()]\n```\n\n**CLI commands:**\n```bash\nadk search slack           # Find integrations\nadk add slack@latest       # Add to project\nadk add slack --alias my-slack  # Add with custom alias\nadk info slack --events    # See available events\nadk list                   # List installed integrations\nadk upgrade slack          # Update to latest\nadk remove slack           # Remove integration\n```\n\n**Using integration actions:**\n```typescript\nimport { actions } from \"@botpress\u002Fruntime\";\n\n\u002F\u002F Slack\nawait actions.slack.sendMessage({ channel: \"#general\", text: \"Hello!\" });\nawait actions.slack.addReaction({ channel: \"C123\", timestamp: \"123\", name: \"thumbsup\" });\n\n\u002F\u002F Linear\nawait actions.linear.issueCreate({ teamId: \"123\", title: \"Bug report\", description: \"Details\" });\nconst { items } = await actions.linear.issueList({\n  first: 10,\n  filter: { state: { name: { eq: \"In Progress\" } } }\n});\n\n\u002F\u002F GitHub\nawait actions.github.createIssue({ owner: \"org\", repo: \"repo\", title: \"Issue\" });\n\n\u002F\u002F Browser (web scraping)\nconst results = await actions.browser.webSearch({ query: \"Botpress docs\", maxResults: 5 });\n\n\u002F\u002F Make integration actions available to AI as tools\nawait execute({ tools: [actions.slack.sendMessage.asTool()] });\n```\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fmanaging-integrations\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fintegration-actions.md\n\n---\n\n## State Management\n\n**Understanding the state hierarchy - choose the right level:**\n\n| State Level | Scope | Use For |\n|-------------|-------|---------|\n| `bot.state` | Global, all users | Feature flags, counters, maintenance mode |\n| `user.state` | Per user, all their conversations | User preferences, profile, tier |\n| `conversation.state` | Per conversation | Context, message count, active workflow |\n| `workflow.state` | Per workflow instance | Progress tracking, intermediate results |\n\n**State is automatically persisted** - just modify it and it saves.\n\nAccess and modify state from anywhere in your bot:\n\n```typescript\nimport { bot, user, conversation } from \"@botpress\u002Fruntime\";\n\n\u002F\u002F Bot state - global, shared across all users\nbot.state.maintenanceMode = true;\nbot.state.totalConversations += 1;\n\n\u002F\u002F User state - per user, persists across conversations\nuser.state.name = \"Alice\";\nuser.state.tier = \"pro\";\nuser.state.preferredLanguage = \"es\";\n\n\u002F\u002F In handlers, state is passed as a parameter\nasync handler({ state }) {\n  state.messageCount += 1;  \u002F\u002F Auto-persisted\n}\n\n\u002F\u002F Tags - simple string key-value pairs for categorization\nuser.tags.source = \"website\";\nuser.tags.region = \"north-america\";\nconversation.tags.category = \"support\";\nconversation.tags.priority = \"high\";\n```\n\n**State Types:**\n- **Bot State** - Global, shared across all users and conversations\n- **User State** - Per-user, persists across all their conversations\n- **Conversation State** - Per-conversation, isolated between conversations\n- **Workflow State** - Per-workflow instance, persists across steps\n\n**Tags vs State:**\n- Use **Tags** for: categorization, simple strings, filtering\u002Fquerying\n- Use **State** for: complex objects, arrays, nested data, business logic\n\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Ftags.md\n\n---\n\n## Context API\n\nAccess runtime services in any handler:\n\n```typescript\nimport { context } from \"@botpress\u002Fruntime\";\n\n\u002F\u002F Always available\nconst client = context.get(\"client\");           \u002F\u002F Botpress API client\nconst citations = context.get(\"citations\");     \u002F\u002F Citation manager\nconst cognitive = context.get(\"cognitive\");     \u002F\u002F LLM client\nconst logger = context.get(\"logger\");           \u002F\u002F Structured logger\nconst botId = context.get(\"botId\");            \u002F\u002F Current bot ID\nconst configuration = context.get(\"configuration\");  \u002F\u002F Bot config\n\n\u002F\u002F Conditionally available (use { optional: true })\nconst user = context.get(\"user\", { optional: true });\nconst conversation = context.get(\"conversation\", { optional: true });\nconst message = context.get(\"message\", { optional: true });\nconst workflow = context.get(\"workflow\", { optional: true });\nconst chat = context.get(\"chat\", { optional: true });  \u002F\u002F Conversation transcript\n\nif (user) {\n  console.log(`User: ${user.id}`);\n}\n```\n\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fcontext-api.md\n\n---\n\n## CLI Quick Reference\n\n```bash\n# Project Lifecycle\nadk init \u003Cname>              # Create new project\nadk login                    # Authenticate with Botpress\nadk dev                      # Start dev server (hot reload)\nadk dev --port 3000          # Custom port\nadk chat                     # Test in CLI\nadk build                    # Build for production\nadk deploy                   # Deploy to Botpress Cloud\nadk deploy --env production  # Deploy to specific environment\n\n# Integration Management\nadk add \u003Cintegration>        # Add integration\nadk add slack@2.5.5          # Add specific version\nadk add slack --alias my-slack  # Add with alias\nadk remove \u003Cintegration>     # Remove integration\nadk search \u003Cquery>           # Search integrations\nadk list                     # List installed integrations\nadk list --available         # List all available\nadk info \u003Cname>              # Integration details\nadk info \u003Cname> --events     # Show available events\nadk upgrade \u003Cname>           # Update integration\nadk upgrade                  # Interactive upgrade all\n\n# Knowledge & Assets\nadk kb sync --dev            # Sync knowledge bases\nadk kb sync --prod --force   # Force re-sync production\nadk assets sync              # Sync static files\n\n# Advanced\nadk run \u003Cscript.ts>          # Run TypeScript script\nadk mcp                      # Start MCP server\nadk link --workspace ws_123 --bot bot_456  # Link to existing bot\n\n# Utilities\nadk self-upgrade             # Update CLI\nadk telemetry --disable      # Disable telemetry\nadk --help                   # Full CLI help\nadk \u003Ccommand> --help         # Help for specific command\n```\n\n**Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fcli-reference\n**GitHub:** https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fcli.md\n\n---\n\n## Autonomous Execution with `execute()`\n\n**The `execute()` function is the core of ADK's AI capabilities.** It runs an autonomous AI agent that can:\n- Understand user intent from natural language\n- Decide which tools to call and when\n- Search knowledge bases for relevant information\n- Generate contextual responses\n- Loop through multiple tool calls until the task is complete\n\n**When to use execute():**\n- In conversation handlers to generate AI responses\n- In workflows when you need AI decision-making\n- Anywhere you want autonomous, multi-step AI behavior\n\n**Key parameters to configure:**\n- `instructions` - Tell the AI who it is and how to behave\n- `tools` - Give the AI capabilities (search, create, update, etc.)\n- `knowledge` - Ground the AI in your documentation\n- `exits` - Define structured output schemas for specific outcomes\n\nThe `execute()` function enables autonomous AI agent behavior:\n\n```typescript\nimport { Autonomous, z } from \"@botpress\u002Fruntime\";\n\n\u002F\u002F Define custom tool\nconst searchTool = new Autonomous.Tool({\n  name: \"search\",\n  description: \"Search documentation\",\n  input: z.object({ query: z.string() }),\n  output: z.string(),\n  handler: async ({ query }) => {\n    \u002F\u002F Search implementation\n    return \"results...\";\n  }\n});\n\n\u002F\u002F Define exit (structured response)\nconst AnswerExit = new Autonomous.Exit({\n  name: \"Answer\",\n  description: \"Provide final answer to the user\",\n  schema: z.object({\n    answer: z.string(),\n    confidence: z.number(),\n    sources: z.array(z.string())\n  })\n});\n\n\u002F\u002F Execute AI with tools, knowledge, and exits\nconst result = await execute({\n  instructions: \"Help the user with their request. Be helpful and concise.\",\n\n  \u002F\u002F Add tools\n  tools: [\n    searchTool,\n    actions.linear.issueCreate.asTool()\n  ],\n\n  \u002F\u002F Add knowledge bases\n  knowledge: [DocsKnowledgeBase, FAQKnowledgeBase],\n\n  \u002F\u002F Define exits for structured outputs\n  exits: [AnswerExit],\n\n  \u002F\u002F Model configuration\n  model: \"openai:gpt-4o\",\n  temperature: 0.7,\n  iterations: 10,  \u002F\u002F Max tool call iterations\n\n  \u002F\u002F Hooks for monitoring\n  hooks: {\n    onBeforeTool: async ({ tool, input }) => {\n      console.log(`Calling ${tool.name}`, input);\n      return { input: { ...input, enhanced: true } };  \u002F\u002F Modify input\n    },\n    onAfterTool: async ({ tool, output }) => {\n      console.log(`Result:`, output);\n    }\n  }\n});\n\n\u002F\u002F Handle structured exit\nif (result.is(AnswerExit)) {\n  console.log(result.output.answer);\n  console.log(result.output.sources);\n}\n```\n\n---\n\n## Troubleshooting\n\n| Error | Cause | Solution |\n|-------|-------|----------|\n| \"Cannot destructure property\" in Actions | Destructuring input directly in handler params | Use `async handler({ input, client })` then `const { field } = input` inside |\n| Table creation fails | Invalid table name or `id` defined | Remove `id` column, ensure name ends with \"Table\" |\n| Integration action not found | Integration not installed or configured | Run `adk list`, add with `adk add`, configure in UI at localhost:3001 |\n| Knowledge base not updating | KB not synced | Run `adk kb sync --dev` or `adk kb sync --force` |\n| Workflow not resuming | Dynamic step names | Use stable, unique step names (no `step(\\`item-${i}\\`)`) |\n| Types out of date | Generated types stale | Run `adk dev` or `adk build` to regenerate |\n| Can't message user from workflow | Missing conversationId | Pass `conversationId` when starting workflow, use `client.createMessage()` |\n| \"user is not defined\" | Accessing conversation context outside conversation | Use `context.get(\"user\", { optional: true })` |\n| State changes not persisting | Creating new objects instead of modifying | Modify state directly: `state.user.name = \"Alice\"` |\n| Tool not being used by AI | Poor description | Improve tool description, add detailed `.describe()` to inputs |\n\n**For more help:** Run `adk --help` or check:\n- **Docs:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002F\n- **GitHub:** https:\u002F\u002Fgithub.com\u002Fbotpress\u002Fskills\u002Ftree\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\n\n---\n\n## Common Patterns & Best Practices\n\n### 1. Always Pass conversationId for Workflows\n```typescript\n\u002F\u002F In conversation - starting a workflow that needs to message back\nawait MyWorkflow.start({\n  conversationId: conversation.id,  \u002F\u002F Always include this!\n  data: \"...\"\n});\n\n\u002F\u002F In workflow - messaging back to user\nawait client.createMessage({\n  conversationId: input.conversationId,\n  type: \"text\",\n  payload: { text: \"Processing complete!\" }\n});\n```\n\n### 2. Use Environment Variables for Secrets\n```typescript\n\u002F\u002F In .env (never commit!)\nAPI_KEY=sk-...\nSLACK_TOKEN=xoxb-...\n\n\u002F\u002F In code\nconfig: { apiKey: process.env.API_KEY }\n```\n\n### 3. Keep Step Names Stable in Workflows\n```typescript\n\u002F\u002F GOOD - Single step for batch\nawait step(\"process-all-items\", async () => {\n  for (const item of items) {\n    await processItem(item);\n  }\n});\n\n\u002F\u002F BAD - Dynamic names break resume\nfor (let i = 0; i \u003C items.length; i++) {\n  await step(`process-${i}`, async () => { ... });  \u002F\u002F Don't do this!\n}\n```\n\n### 4. Error Handling in Actions\u002FTools\n```typescript\nexport default new Action({\n  handler: async ({ input }) => {\n    try {\n      \u002F\u002F Action logic\n      return { success: true };\n    } catch (error) {\n      console.error(\"Action failed:\", error);\n      throw new Error(`Failed to process: ${error.message}`);\n    }\n  }\n});\n```\n\n### 5. ThinkSignal for Tool Edge Cases\n```typescript\nhandler: async ({ query }) => {\n  const results = await search(query);\n\n  if (!results.length) {\n    throw new Autonomous.ThinkSignal(\n      \"No results\",\n      \"No results found. Ask the user to try different search terms.\"\n    );\n  }\n\n  return results;\n}\n```\n\n### 6. Multi-Channel Handling\n```typescript\nexport default new Conversation({\n  channels: [\"slack.channel\", \"webchat.channel\"],\n  handler: async ({ conversation }) => {\n    const channel = conversation.channel;\n\n    if (channel === \"slack.channel\") {\n      \u002F\u002F Slack-specific handling (threading, mentions, etc.)\n    } else if (channel === \"webchat.channel\") {\n      \u002F\u002F Webchat-specific handling\n    }\n  }\n});\n```\n\n---\n\n## Complete Reference Documentation\n\n### Official Botpress ADK Documentation\n**Base URL:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002F\n\n| Topic | URL |\n|-------|-----|\n| Introduction | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fintroduction |\n| Quickstart | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fquickstart |\n| Project Structure | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fproject-structure |\n| Actions | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Factions |\n| Tools | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Ftools |\n| Conversations | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Fconversations |\n| Workflows Overview | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Fworkflows\u002Foverview |\n| Workflow Steps | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Fworkflows\u002Fsteps |\n| Tables | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Ftables |\n| Triggers | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Ftriggers |\n| Knowledge Bases | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fconcepts\u002Fknowledge |\n| Managing Integrations | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fmanaging-integrations |\n| Zai Overview | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fzai\u002Foverview |\n| Zai Reference | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fzai\u002Freference |\n| CLI Reference | https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002Fcli-reference |\n\n### GitHub Repository References (AI-Optimized)\n**Base URL:** https:\u002F\u002Fgithub.com\u002Fbotpress\u002Fskills\u002Ftree\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\n\nFor detailed specifications beyond this guide, fetch the corresponding reference file:\n\n| Topic | Reference File |\n|-------|----------------|\n| Actions | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Factions.md |\n| Tools | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Ftools.md |\n| Workflows | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fworkflows.md |\n| Conversations | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fconversations.md |\n| Tables | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Ftables.md |\n| Triggers | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Ftriggers.md |\n| Knowledge Bases | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fknowledge-bases.md |\n| Messages | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fmessages.md |\n| Agent Config | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fagent-config.md |\n| CLI | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fcli.md |\n| Integration Actions | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fintegration-actions.md |\n| Model Configuration | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fmodel-configuration.md |\n| Context API | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fcontext-api.md |\n| Tags | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Ftags.md |\n| Files | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Ffiles.md |\n| Zai Complete Guide | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fzai-complete-guide.md |\n| Zai Agent Reference | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fzai-agent-reference.md |\n| MCP Server | https:\u002F\u002Fraw.githubusercontent.com\u002Fbotpress\u002Fskills\u002Fmaster\u002Fskills\u002Fadk\u002Freferences\u002Fmcp-server.md |\n\n---\n\n## Common Scenarios - What to Build\n\n**\"I want to build a support bot that answers questions from our docs\"**\n1. Create a Knowledge Base with your documentation as a source\n2. Create a Conversation handler that uses `execute()` with that knowledge\n3. Add the `chat` integration for testing\n\n**\"I want the bot to create tickets in Linear when users report issues\"**\n1. Add the Linear integration: `adk add linear`\n2. Create a Tool that calls `actions.linear.issueCreate()`\n3. Pass the tool to `execute()` in your conversation\n\n**\"I need to run a daily sync job\"**\n1. Create a Workflow with `schedule: \"0 9 * * *\"` (cron syntax)\n2. Implement the sync logic in steps\n3. The workflow will run automatically at the scheduled time\n\n**\"I want to store user preferences\"**\n1. Define the schema in `agent.config.ts` under `user.state`\n2. Access\u002Fmodify via `user.state.preferenceField = value`\n3. State persists automatically\n\n**\"I need to react when a new user signs up\"**\n1. Create a Trigger listening to `user.created` event\n2. In the handler, start an onboarding workflow or send a welcome message\n\n**\"I want to store order data and search it\"**\n1. Create a Table with your schema (remember: no `id` field, name ends with \"Table\")\n2. Use `searchable: true` on text columns you want to search\n3. Use CRUD methods: `createRows`, `findRows`, `updateRows`, `deleteRows`\n\n---\n\n## Summary\n\nThis skill provides comprehensive guidance for building Botpress bots using the ADK:\n\n- **Setup & Initialization** - ADK installation and project creation\n- **Project Structure** - Conventions, files, and organization\n- **Core Concepts** - Actions, Tools, Workflows, Conversations, Tables, Knowledge, Triggers\n- **State Management** - Bot, user, conversation, and workflow state\n- **Integration Management** - Adding and configuring integrations\n- **Zai (AI Operations)** - Extract, check, label, summarize, answer, sort, group, rewrite, filter\n- **CLI Reference** - Complete command guide\n- **Testing & Deployment** - Local testing and cloud deployment\n- **Common Patterns** - Best practices and troubleshooting\n\n**Core Principle:** The ADK is a convention-based framework where file location determines behavior. Place components in the correct `src\u002F` subdirectory and they automatically become bot capabilities.\n\n**When to use this skill:**\n- User wants to create a new Botpress bot\n- User asks how to add actions, tools, workflows, conversations, tables, knowledge bases, or triggers\n- User needs help with integrations (Slack, Linear, GitHub, etc.)\n- User wants to understand ADK patterns and best practices\n- User has errors or needs troubleshooting\n- User asks about CLI commands, configuration, or deployment\n\n**Official Documentation:** https:\u002F\u002Fwww.botpress.com\u002Fdocs\u002Fadk\u002F\n**GitHub Repository:** https:\u002F\u002Fgithub.com\u002Fbotpress\u002Fadk\n**Skills Repository:** https:\u002F\u002Fgithub.com\u002Fbotpress\u002Fskills\n",{"name":5,"tags":24,"author":29,"version":30,"homepage":31,"description":7},[25,5,26,27,28],"botpress","chatbot","ai","typescript","yueranlu","1.0.0","https:\u002F\u002Fgithub.com\u002Fbotpress\u002Fadk","main","f9d3fe7cf9ac8f1ea63a0d96e98e1f510a3814db","skills\u002Fyueranlu\u002Fbotpress-adk",1,"https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills","https:\u002F\u002Fgithub.com\u002Fjavimosch","intrane.fr","Building robust, open-source infrastructure for the commons. AI-leveraged, self-hosted, built to last.","2026-06-07 03:34:58",{"source":8,"skillName":5,"commands":42,"prompt":52,"zipAvailable":53},[43,46,49],{"tool":44,"command":45},"npx","npx skills add javimosch\u002Fopen-claw-skills --skill adk",{"tool":47,"command":48},"bunx","bunx skills add javimosch\u002Fopen-claw-skills --skill adk",{"tool":50,"command":51},"pnpm","pnpm dlx skills add javimosch\u002Fopen-claw-skills --skill adk","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fyueranlu\u002Fbotpress-adk\u002FSKILL.md",true,[],[56,63,70,77,84,91],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M778GGXG2VQ0YF31W2MKGMQZ","crowd-prompting","A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzzadrian\u002Fcrowd-prompting\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M778G7BH8SBJ9FJ6C3G7CB1K","ceaser","Interact with the Ceaser privacy protocol on Base L2 using the ceaser-mcp MCP tools. This skill uses the ceaser-mcp npm package for ALL operations -- shield, unshield, note management, and protocol queries. All ceaser tool calls use CLI subcommands (npx -y ceaser-mcp \u003Csubcommand>). Ceaser is a privacy-preserving ETH wrapper using Noir\u002FUltraHonk zero-knowledge proofs on Base L2 (chain ID 8453).","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyra-v21\u002Fceaser\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M778FYCJQZWFKKX5FYMK3S47","ceaser-send","Fully automated private ETH transfer via Ceaser Protocol on Base L2 using the ceaser-mcp MCP tools. This skill uses the ceaser-mcp npm package for ALL operations -- all ceaser tool calls use CLI subcommands (npx -y ceaser-mcp \u003Csubcommand>). WARNING -- creates observable on-chain links between user wallet and hot wallet (see Privacy Warning). Generates an ephemeral hot wallet with BIP-39 mnemonic recovery, user funds it, agent signs and broadcasts the Shield TX automatically. Exactly one manual step required (funding the hot wallet with ETH). Uses Noir\u002FUltraHonk zero-knowledge proofs.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyra-v21\u002Fceaser-send\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M778FQQNSEYA3HJKZBPQ4M9Z","dilemm-ai","Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyori\u002Fdilemm-ai\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M778FGVZX7QA2TF9BFMM37FY","moldium","Post and manage content on the Moldium blog platform. Triggered by \"post to Moldium\", \"write a blog post\", \"publish an article\", etc.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyom45\u002Fmoldium\u002FSKILL.md",[],[],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":19},"01M778F88D8PQ9MQ0KNW2TJ8ZH","arxiv-paper-reviews","Interact with arXiv Crawler API to fetch papers, read reviews, submit comments, search papers, and import papers. Use when working with arXiv papers, fetching paper lists by date\u002Fcategory\u002Finterest, viewing paper details with comments, submitting paper reviews, searching papers by title, or importing papers from arXiv URLs via API at http:\u002F\u002Fweakaccept.top:8000\u002F.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzxrys\u002Farxiv-paper-reviews\u002FSKILL.md",[],[]]