# DingTalk Source: https://docs.cowagent.ai/channels/dingtalk Connect CowAgent to DingTalk: create an app with the bot capability on the DingTalk Open Platform, add the credentials, and chat in direct and group chats, with optional streaming cards. Integrate CowAgent into DingTalk by creating an intelligent robot app on the DingTalk Open Platform. ## 1. Create App 1. Go to [DingTalk Developer Console](https://open-dev.dingtalk.com/fe/app#/corp/app), log in and click **Create App**, fill in the app information: ![](https://img-1317903499.cos.ap-guangzhou.myqcloud.com/docs/dingtalk-create-app.png) 2. Click **Add App Capability**, select **Robot** capability and click **Add**: ![](https://img-1317903499.cos.ap-guangzhou.myqcloud.com/docs/dingtalk-add-bot.png) > Optional: to reply with streaming Markdown cards, request the `Card.Instance.Write` and `Card.Streaming.Write` permissions under **Permission Management**, and add `"dingtalk_card_enabled": true` to `config.json`. 3. Configure the robot information and click **Publish**. After publishing, click "**Debug**" to automatically create a test group chat, which can be viewed in the client: ![](https://img-1317903499.cos.ap-guangzhou.myqcloud.com/docs/dingtalk-config-bot.png) 4. Click **Version Management & Release**, create a new version and publish: ![](https://img-1317903499.cos.ap-guangzhou.myqcloud.com/docs/dingtalk-publish-bot.png) ## 2. Project Configuration 1. Click **Credentials & Basic Info**, get the `Client ID` and `Client Secret`: ![](https://img-1317903499.cos.ap-guangzhou.myqcloud.com/docs/dingtalk-get-secret.png) 2. Add the following configuration to `config.json` in the project root: ```json theme={null} { "channel_type": "dingtalk", "dingtalk_client_id": "YOUR_CLIENT_ID", "dingtalk_client_secret": "YOUR_CLIENT_SECRET" } ``` 3. Install the dependency: ```bash theme={null} pip3 install dingtalk_stream ``` ![](https://img-1317903499.cos.ap-guangzhou.myqcloud.com/docs/dingtalk-app-config.png) 4. After starting the project, go to the DingTalk Developer Console, click **Event Subscription**, then click **Connection verified, verify channel**. When "**Connection successful**" is displayed, the configuration is complete: ![](https://img-1317903499.cos.ap-guangzhou.myqcloud.com/docs/dingtalk-event-sub.png) ## 3. Usage Chat privately with the robot or add it to an enterprise group to start a conversation: ![](https://img-1317903499.cos.ap-guangzhou.myqcloud.com/docs/dingtalk-hosting-demo.png) # Discord Source: https://docs.cowagent.ai/channels/discord Connect CowAgent to a Discord bot for DMs and server channels (@mention or reply). The Gateway WebSocket connection needs no public IP or callback URL; create the app and bot token to get started. > Integrate CowAgent into Discord via a Discord Bot using the **Gateway** (persistent WebSocket). Supports direct messages (DM) and server channels (triggered by @mention or replying to the bot). The Gateway uses a persistent WebSocket connection — no public IP or callback URL required, works out of the box. ## 1. Setup ### Step 1: Create a Discord Application and Bot 1. Open the [Discord Developer Portal](https://discord.com/developers/applications), click **New Application**, enter a name (e.g. `CowAgent`), and create it. 2. Go to the **Bot** page in the left sidebar, click **Reset Token** to generate a Bot Token, then copy and store it safely (shown only once). > [!TIP] > > This token is your bot's password — keep it secret. If it leaks, click **Reset Token** again on the Bot page to regenerate it. ### Step 2: Enable the Message Content Intent Reading message text in both DMs and channels depends on this privileged intent. 1. On the **Bot** page, find **Privileged Gateway Intents**. 2. Turn on **Message Content Intent** and save. > [!NOTE] > > Without this intent enabled, incoming message content will be empty and the bot will not respond. ### Step 3: Invite the Bot to a Server 1. Go to **OAuth2 → URL Generator** in the left sidebar. 2. Under **Scopes**, check `bot`. 3. Under **Bot Permissions**, check at least: `Send Messages`, `Read Message History`, `Attach Files`, `View Channels`. 4. Copy the generated authorization URL at the bottom, open it in a browser, and authorize it for your target server. > [!NOTE] > > You can skip this step if you only need DMs, but you still need a DM channel with the bot (e.g. the user messages the bot directly). ### Step 4: Connect to CowAgent **Web Console (Recommended)** Open the Web Console (default `http://127.0.0.1:9899`), go to **Channels**, click **Add Channel**, choose **Discord**, paste the Bot Token, and click connect. **Config File** Add the following to `config.json` and start Cow: ```json theme={null} { "channel_type": "discord", "discord_token": "your-discord-bot-token", "discord_group_trigger": "mention_or_reply" } ``` | Key | Description | Default | | - | - | - | | `discord_token` | Bot Token generated on the Bot page of the Developer Portal | - | | `discord_group_trigger` | Channel trigger: `mention_or_reply` (@ or reply to bot) / `mention_only` (@ only) / `all` (all messages) | `mention_or_reply` | The integration is ready when you see logs like: ``` [Discord] Bot logged in as CowAgent#1234 (id=123456789) [Discord] ✅ Discord bot ready, listening for messages ``` ## 2. Capabilities | Feature | Support | | - | - | | Direct message (DM) | ✅ | | Server channel (@bot / reply to bot) | ✅ | | Text messages | ✅ send / receive | | Image messages | ✅ send / receive | | File messages | ✅ send / receive (PDF / Word / Excel, etc.) | > [!NOTE] > > A single Discord message is capped at 2000 characters; long replies are automatically split across multiple messages by line breaks. ## 3. Usage Once connected: * **Direct message (DM)**: find your bot in the server member list, click its avatar, and message it directly. * **Channel**: in a channel where the bot is invited, trigger it with `@your-bot hello` or by **replying to one of the bot's messages**. When sending an image or file, you can **add a text caption** (description / question) in the attachment input — the bot will answer based on both. Sending an attachment first and then a follow-up question also works; the two messages are merged automatically. # Feishu (Lark) Source: https://docs.cowagent.ai/channels/feishu Connect CowAgent to a Feishu (Lark) custom app for direct and group chats. It uses a WebSocket connection with no public IP, supports one-scan app creation, streaming replies and voice messages. > Integrate CowAgent into Feishu via a custom enterprise app. Supports p2p chat and group chat (@bot), uses WebSocket long connection (no public IP needed), supports streaming typewriter replies and voice messages. > [!NOTE] > > You need to be a Feishu enterprise user with admin privileges. ## 1. Setup ### Option 1: One-click Scan to Create (Recommended) No need to manually create an app on the Feishu Developer Platform. Start the Cow project, open the web console (default `http://127.0.0.1:9899/`), go to **Channels**, click **Add Channel**, choose **Feishu**, then under the **Scan QR** tab click **One-click Create Feishu App** and scan with the **Feishu App** to complete app creation and connection automatically. ![](https://cdn.link-ai.tech/doc/20260505181126.png) > [!NOTE] > > 1. Requires `lark-oapi` ≥ 1.5.5. > 2. The created app comes with all required permissions (messaging, card read/write, group events, etc.) and event subscriptions pre-configured — no manual setup on the developer console needed. Currently only the Feishu mainland version is supported (Lark international not yet supported). When starting from CLI without `feishu_app_id` configured, the QR code is also printed to the terminal. ### Option 2: Manual Setup Manually create a custom app on the Feishu Developer Platform, then connect via Web Console or config file. **Step 1: Create the App** 1. Go to [Feishu Developer Platform](https://open.feishu.cn/app/), click **Create Enterprise Custom App**: ![](https://img-1317903499.cos.ap-guangzhou.myqcloud.com/docs/feishu-hosting-create-app.jpg) 2. In **Add App Capabilities**, add the **Bot** capability: ![](https://img-1317903499.cos.ap-guangzhou.myqcloud.com/docs/feishu-hosting-add-bot.jpg) 3. In **Permission Management**, paste the following permissions and **Batch Enable** all: ``` im:message,im:message.group_at_msg,im:message.group_at_msg:readonly,im:message.p2p_msg,im:message.p2p_msg:readonly,im:message:send_as_bot,im:resource,cardkit:card:write ``` ![](https://cdn.link-ai.tech/doc/feishu-hosting-add-auth2.png) 4. Get `App ID` and `App Secret` from **Credentials & Basic Info**: ![](https://img-1317903499.cos.ap-guangzhou.myqcloud.com/docs/feishu-hosting-appid-secret.jpg) **Step 2: Connect to CowAgent** **Web Console** Open the web console, go to **Channels**, click **Add Channel**, choose **Feishu**, switch to the **Manual** tab, enter App ID and App Secret, then click connect. **Config File** Add the following to `config.json` and start the program: ```json theme={null} { "channel_type": "feishu", "feishu_app_id": "YOUR_APP_ID", "feishu_app_secret": "YOUR_APP_SECRET", "feishu_stream_reply": true } ``` | Parameter | Description | Default | | - | - | - | | `feishu_app_id` | Feishu app App ID | - | | `feishu_app_secret` | Feishu app App Secret | - | | `feishu_stream_reply` | Enable streaming typewriter reply | `true` | | `feishu_detailed_card` | Use a detailed card (tool calls, thinking process, elapsed time) for streaming replies; off keeps the plain typewriter card | `true` | **Step 3: Publish the App** 1. After Cow is running, go to **Events & Callbacks** in the Feishu Developer Platform, choose **Long Connection** mode and save: ![](https://cdn.link-ai.tech/doc/202601311731183.png) 2. Click **Add Event**, search for "Receive Message" and choose **Receive Message v2.0**. 3. (Optional) Under **Callbacks**, add **Card Action Trigger** (`card.action.trigger`) to enable `/tasks` scheduler commands; add the **Message Recalled** (`im.message.recalled_v1`) event to cancel a task by recalling its message. 4. Click **Version Management & Release**, create a version and apply for **Production Release**. Approve the request in the Feishu client: ![](https://cdn.link-ai.tech/doc/202601311807356.png) ## 2. Features | Feature | Status | | - | - | | P2P chat | ✅ | | Group chat (@bot) | ✅ | | Text messages | ✅ send/receive | | Image messages | ✅ send/receive | | Voice messages | ✅ send/receive | | Quoted replies | ✅ quoted text and rich-post context | | Streaming reply | ✅ (powered by Feishu cardkit streaming card) | | Markdown card | ✅ remote images are uploaded to Feishu for static and final streaming cards | | Detailed card | ✅ tool calls, thinking process and elapsed time (controlled by `feishu_detailed_card`, on by default) | | Scheduler controls | ✅ `/tasks` list with enable, disable and delete buttons | > [!NOTE] > > Streaming reply requires the `cardkit:card:write` permission (already enabled by one-click creation) and Feishu client version ≥ 7.20. Older clients see an upgrade prompt; if the permission or version is not satisfied, replies fall back to plain text automatically. ## 3. Usage After connection, search for the bot name in Feishu to start a chat. To use in groups, add the bot to a group and @-mention it. Send `/tasks` in a private chat, or @-mention the bot with `/tasks` in a group, to manage tasks belonging to that chat. # Channels Overview Source: https://docs.cowagent.ai/channels/index All channels CowAgent supports, with a matrix comparing image, file, voice and group chat support across WeChat, Feishu, DingTalk, WeCom, QQ, Telegram, Slack, Discord and the web console. CowAgent supports multiple chat channels. Switch between them at startup via `channel_type`. The Web Console is enabled by default and can run in parallel with other channels. ## Capability Matrix The table below summarizes the inbound message types, bot reply types, and group chat capabilities supported by each channel, making it easy to choose by scenario. | Channel | Text | Image | File | Voice | Group Chat | | - | :-: | :-: | :-: | :-: | :-: | | [WeChat](/channels/weixin) | ✅ | ✅ | ✅ | ✅ | | | [Web Console](/channels/web) | ✅ | ✅ | ✅ | ✅ | | | [Feishu](/channels/feishu) | ✅ | ✅ | ✅ | ✅ | ✅ | | [DingTalk](/channels/dingtalk) | ✅ | ✅ | ✅ | ✅ | ✅ | | [WeCom Bot](/channels/wecom-bot) | ✅ | ✅ | ✅ | ✅ | ✅ | | [QQ](/channels/qq) | ✅ | ✅ | ✅ | ✅ | ✅ | | [WeCom App](/channels/wecom) | ✅ | ✅ | ✅ | ✅ | | | [Official Account](/channels/wechatmp) | ✅ | ✅ | | ✅ | | | [WeChat Customer Service](/channels/wechat-kf) | ✅ | ✅ | ✅ | ✅ | | | [Telegram](/channels/telegram) | ✅ | ✅ | ✅ | ✅ | ✅ | | [Slack](/channels/slack) | ✅ | ✅ | ✅ | | ✅ | | [Discord](/channels/discord) | ✅ | ✅ | ✅ | | ✅ | * The **Image / File / Voice** columns indicate that the channel can send and receive the corresponding message types; see each channel's docs for details * The **Group Chat** column indicates the ability to recognize and respond to group messages > [!TIP] > > The voice / image capabilities of each channel depend on the configuration of the corresponding model provider. See [Models Overview](/models/index) for details. ## Channel List * [Web Console](/channels/web) — built-in browser-based chat and management panel, enabled by default * [WeChat](/channels/weixin) — log in via personal WeChat QR scan * [Feishu](/channels/feishu) — Feishu custom bot * [DingTalk](/channels/dingtalk) — DingTalk custom bot * [WeCom Bot](/channels/wecom-bot) — WeCom AI Bot via WebSocket long connection * [QQ](/channels/qq) — QQ Official Bot open platform * [WeCom App](/channels/wecom) — WeCom custom app integration * [Official Account](/channels/wechatmp) — WeChat Official Account (subscription / service) * [Telegram](/channels/telegram) — global IM, 5-minute setup, no public IP needed * [Slack](/channels/slack) — team collaboration IM, Socket Mode integration, no public IP needed * [Discord](/channels/discord) — community IM, Gateway connection, no public IP needed # QQ Bot Source: https://docs.cowagent.ai/channels/qq Connect CowAgent to a QQ bot for direct chats, group chats (@bot), guild channel messages and DMs. Built on the QQ Open Platform with a WebSocket connection, so no public IP or domain is needed. > Connect CowAgent via QQ Open Platform's bot API, supporting QQ direct messages, group chats (@bot), guild channel messages, and guild DMs. No public IP required — uses WebSocket long connection. > [!NOTE] > > QQ Bot is created through the QQ Open Platform. It uses WebSocket long connection to receive messages and OpenAPI to send messages. No public IP or domain is required. ## 1. Create a QQ Bot > Visit the [QQ Open Platform](https://q.qq.com), sign in with QQ. If you haven't registered, please complete [account registration](https://q.qq.com/#/register) first. 1.Go to the [QQ Open Platform - Bot List](https://q.qq.com/#/apps), and click **Create Bot**: ![](https://cdn.link-ai.tech/doc/20260317162900.png) 2.Fill in the bot name, avatar, and other basic information to complete the creation: ![](https://cdn.link-ai.tech/doc/20260317163005.png) 3.Enter the bot configuration page, go to **Development Management**, and complete the following steps: * Copy and save the **AppID** (Bot ID) * Generate and save the **AppSecret** (Bot Secret) ![](https://cdn.link-ai.tech/doc/20260317164955.png) ## 2. Configuration and Running ### Option A: Web Console Start the program and open the Web console (local access: [http://127.0.0.1:9899/](http://127.0.0.1:9899/)). Go to the **Channels** tab, click **Connect Channel**, select **QQ Bot**, fill in the AppID and AppSecret from the previous step, and click Connect. ![](https://cdn.link-ai.tech/doc/20260317165425.png) ### Option B: Config File Add the following to your `config.json`: ```json theme={null} { "channel_type": "qq", "qq_app_id": "YOUR_APP_ID", "qq_app_secret": "YOUR_APP_SECRET" } ``` | Parameter | Description | | - | - | | `qq_app_id` | AppID of the QQ Bot, found in Development Management on the open platform | | `qq_app_secret` | AppSecret of the QQ Bot, found in Development Management on the open platform | After configuration, start the program. The log message `[QQ] ✅ Connected successfully` indicates a successful connection. ## 3. Usage In the QQ Open Platform, go to **Management → Usage Scope & Members**, scan the "Add to group and message list" QR code with your QQ client to start chatting with the bot: ![](https://cdn.link-ai.tech/doc/20260317165947.png) Chat example: ![](https://cdn.link-ai.tech/doc/20260317171508.png) ## 4. Supported Features > Note: To use the QQ bot in group chats and guild channels, you need to complete the publishing review and configure usage scope permissions. | Feature | Status | | - | - | | QQ Direct Messages | ✅ | | QQ Group Chat (@bot) | ✅ | | Guild Channel (@bot) | ✅ | | Guild DM | ✅ | | Text Messages | ✅ Send & Receive | | Image Messages | ✅ Send & Receive (group & direct) | | File Messages | ✅ Send (group & direct) | | Scheduled Tasks | ✅ Active push (4 per user per month) | ## 5. Notes * **Passive message limits**: QQ direct message replies are valid for 60 minutes (max 5 replies per message); group chat replies are valid for 5 minutes. * **Active message limits**: Both direct and group chats have a monthly limit of 4 active messages. Keep this in mind when using the scheduled tasks feature. * **Event permissions**: By default, `GROUP_AND_C2C_EVENT` (QQ group/direct) and `PUBLIC_GUILD_MESSAGES` (guild public messages) are subscribed. Apply for additional permissions on the open platform if needed. # Slack Source: https://docs.cowagent.ai/channels/slack Connect CowAgent to a Slack app for DMs and channel conversations (@mention or thread replies). Socket Mode needs no public IP or callback URL; follow the steps to create the app and tokens. > Integrate CowAgent into Slack via a Slack App in **Socket Mode**. Supports direct messages (DM) and channels (triggered by @mention or replying within a thread). Socket Mode uses a persistent WebSocket connection — no public IP or callback URL required, works out of the box. ## 1. Setup ### Step 1: Create a Slack App 1. Open the [Slack API apps page](https://api.slack.com/apps), click **Create New App** → **From scratch**. 2. Enter an **App Name** (e.g. `CowAgent`), pick the **Workspace** to install into, and create it. ### Step 2: Enable Socket Mode and get the App Token 1. In the left sidebar go to **Settings → Socket Mode** and turn on **Enable Socket Mode**. 2. You will be prompted to generate an **App-Level Token** with the `connections:write` scope. Save this token starting with `xapp-`. > [!TIP] > > Socket Mode receives events over a WebSocket connection, so you don't need to expose a public callback URL — ideal for local or intranet deployments. ### Step 3: Configure bot scopes and install 1. Go to **Features → OAuth & Permissions**, click **Add an OAuth Scope** under **Bot Token Scopes**, and add the following scopes one by one: ``` app_mentions:read channels:history chat:write commands files:read files:write groups:history im:history mpim:history users:read ``` > [!NOTE] > > `files:read` / `files:write` are used for sending/receiving images and files; omit them if you only need text conversations. 2. Go to **Features → Event Subscriptions**, turn on **Enable Events**, and under **Subscribe to bot events** click **Add Bot User Event** to add: ``` app_mention message.im message.channels ``` > [!NOTE] > > Add `message.groups` if you need to use the bot in private channels. 3. Go to **Features → App Home**, enable **Messages Tab** under **Show Tabs**, and check **Allow users to send Slash commands and messages from the messages tab**. Otherwise the DM input box is disabled and users cannot message the bot. 4. Back in **OAuth & Permissions**, click **Install to Workspace**. After installing, copy the **Bot User OAuth Token** starting with `xoxb-`. > [!TIP] > > If the Slack client still shows "Sending messages to this app has been turned off", make sure you completed the App Home step above, then refresh or restart the Slack client (remove the app from your conversations and reopen it if needed). ### Step 4: Connect to CowAgent **Web Console (Recommended)** Open the Web Console (default `http://127.0.0.1:9899`), go to **Channels**, click **Add Channel**, choose **Slack**, paste the Bot Token (`xoxb-`) and App Token (`xapp-`), and click connect. **Config File** Add the following to `config.json` and start Cow: ```json theme={null} { "channel_type": "slack", "slack_bot_token": "xoxb-xxxxxxxxxxxx", "slack_app_token": "xapp-xxxxxxxxxxxx", "slack_group_trigger": "mention_or_reply" } ``` | Key | Description | Default | | - | - | - | | `slack_bot_token` | Bot User OAuth Token, like `xoxb-...` | - | | `slack_app_token` | App-Level Token (generated after enabling Socket Mode), like `xapp-...` | - | | `slack_group_trigger` | Channel trigger: `mention_or_reply` (@ or reply in thread) / `mention_only` (@ only) / `all` (all messages) | `mention_or_reply` | The integration is ready when you see logs like: ``` [Slack] Bot logged in as user_id=U0XXXXXXX, team=Txxxxxxxx [Slack] ✅ Slack bot ready, listening for events ``` ## 2. Capabilities | Feature | Support | | - | - | | Direct message (DM) | ✅ | | Channel (@bot / reply in thread) | ✅ | | Text messages | ✅ send / receive | | Image messages | ✅ send / receive | | File messages | ✅ send / receive (PDF / Word / Excel, etc.) | | Thread replies | ✅ replies are posted to the thread of the triggering message | > [!NOTE] > > Slack organizes conversations into threads. The bot posts replies into the thread of the triggering message, keeping channels tidy. ## 3. Usage Once connected: * **Direct message (DM)**: find your App under **Apps** in the Slack sidebar and message it directly. * **Channel**: invite the App into a channel (`/invite @your-app`), then trigger it with `@your-app hello`; continue the conversation by replying within the same thread. When sending an image or file, you can **add a text caption** (description / question) in the attachment input — the bot will answer based on both. Sending an attachment first and then a follow-up question also works; the two messages are merged automatically. # Telegram Source: https://docs.cowagent.ai/channels/telegram Connect CowAgent to a Telegram bot: create it with BotFather, add the token, and chat in DMs or groups (@mention or reply). Uses long polling, so no public IP is required. > Integrate CowAgent into Telegram via the official Bot API. Supports private chat and group chat (triggered by @mention or replying to the bot). Uses Long Polling — no public IP required, works out of the box. ## 1. Setup ### Step 1: Create a Bot via BotFather 1. Open the official account [@BotFather](https://t.me/BotFather) in Telegram. 2. Send `/newbot` and follow the prompts: * **Bot name** (display name, e.g. `My CowAgent Bot`) * **Bot username** (must end with `bot`, e.g. `my_cowagent_bot`) 3. Once created, BotFather returns an **HTTP API Token** (e.g. `123456789:ABCdefGhIJKlmNoPQRsTUVwxyZ`). Keep it safe. > [!TIP] > > The token is the password of your bot — never share it. If it leaks, send `/revoke` to `@BotFather` to reset it. ### Step 2: (Group chat only) Disable Privacy Mode Skip this step if you only use private chat. Telegram bots run in **Privacy Mode** by default — in groups they can only see commands suffixed with `@bot` (e.g. `/start@your_bot`) and replies to bot messages; **plain `@bot hello` text messages are not delivered**, so the bot will appear unresponsive in groups. Send the following to `@BotFather`: 1. `/setprivacy` 2. Pick the bot you just created 3. Choose `Disable` > [!NOTE] > > If the bot is still silent in groups after this, try removing it from the group and adding it back. ### Step 3: Connect to CowAgent **Web Console (Recommended)** Open the Web Console (default `http://127.0.0.1:9899`), go to **Channels**, click **Add Channel**, choose **Telegram**, paste the Bot Token, and click connect. **Config File** Add the following to `config.json` and start Cow: ```json theme={null} { "channel_type": "telegram", "telegram_token": "123456789:ABCdefGhIJKlmNoPQRsTUVwxyZ", "telegram_group_trigger": "mention_or_reply" } ``` | Key | Description | Default | | - | - | - | | `telegram_token` | HTTP API Token returned by BotFather | - | | `telegram_group_trigger` | Group trigger: `mention_or_reply` (@ or reply) / `mention_only` (@ only) / `all` (all messages) | `mention_or_reply` | | `telegram_register_commands` | Whether to register the command menu with BotFather on startup | `true` | The integration is ready when you see logs like: ``` [Telegram] Bot logged in as @my_cowagent_bot (id=123456789) [Telegram] Registered 10 bot commands [Telegram] ✅ Telegram bot ready, polling for updates ``` ## 2. Capabilities | Feature | Support | | - | - | | Private chat | ✅ | | Group chat (@bot / reply to bot) | ✅ | | Text messages | ✅ send / receive | | Image messages | ✅ send / receive | | Voice messages | ✅ send / receive (OGG/Opus) | | Video messages | ✅ send / receive | | File messages | ✅ send / receive (PDF / Word / Excel, etc.) | | Command menu | ✅ aligned with Web Console slash commands | ### Command Menu On startup, the channel registers a command menu with BotFather. Typing `/` in Telegram shows a dropdown: | Command | Description | | - | - | | `/help` | Show command help | | `/status` | View runtime status | | `/context` | View conversation context (`/context clear` to clear) | | `/skill` | Skill management (`/skill list`, `/skill install`, ...) | | `/memory` | Memory management (`/memory dream`) | | `/knowledge` | Knowledge base (`/knowledge list` / `on` / `off`) | | `/config` | View current config | | `/cancel` | Cancel the running Agent task | | `/steer` | Guide the running Agent task (`/steer `) | | `/logs` | View recent logs | | `/version` | Show version | > [!NOTE] > > Telegram's command menu only displays top-level commands; subcommands are entered with a space, e.g. `/skill list`, `/context clear`. ## 3. Usage Once connected: * **Private chat**: search for your bot username (e.g. `@my_cowagent_bot`) in Telegram, click `Start` and chat away. * **Group chat**: add the bot to a group, then trigger it with `@bot hello` or by **replying to one of the bot's messages**. If the bot doesn't respond in groups, double-check Privacy Mode in [Step 2](#step-2-group-chat-only-disable-privacy-mode). When sending an image or file, you can **add a caption** (description / question) directly in the attachment input — the bot will answer based on both. Sending an attachment first and then a follow-up question also works; the two messages are merged automatically. # Web Console Source: https://docs.cowagent.ai/channels/web The web console is CowAgent's default channel: chat in your browser, manage models, skills, memory and channels online, protect it with a password, and enable an OpenAI-compatible chat API. The Web Console is CowAgent's default channel. It runs automatically once started, letting you chat with the Agent in a browser and manage models, skills, memory, channels, and other configuration online. ## Configuration ```json theme={null} { "channel_type": "web", "web_host": "0.0.0.0", "web_port": 9899, "web_password": "", "external_api_enabled": false, "external_api_token": "", "enable_thinking": false } ``` | Parameter | Description | Default | | - | - | - | | `channel_type` | Set to `web` | `web` | | `web_host` | Web service listen address. Defaults to `127.0.0.1` (local only); set to `0.0.0.0` for public access and configure a password | `""` | | `web_port` | Web service listen port | `9899` | | `web_password` | Access password. Leave empty to disable password protection; recommended when listening on `0.0.0.0` | `""` | | `external_api_enabled` | Turn on the [Chat API](/extensions/chat-api) | `false` | | `external_api_token` | API key of the [Chat API](/extensions/chat-api), kept while the API is off | `""` | | `web_session_expire_days` | Login session validity in days | `30` | | `web_file_serve_root` | Additional root directory the web console can directly read/send files from (defaults to the user home directory). Configured Agent workspaces, including disabled Agents, and opened project directories are also allowed; set to `/` to allow the whole filesystem | `"~"` | | `enable_thinking` | Whether to enable deep thinking mode | `false` | Once a password is configured, you must enter it to log in when accessing the console. The login session is kept for 30 days by default, so restarting the service during that period does not require re-login. The password can also be changed online from the "Configuration" page in the console. ## Access URL After starting the project, visit: * Local: `http://localhost:9899` * Server: `http://:9899` > [!NOTE] > > Ensure the server firewall and security group allow the corresponding port. ## HTTPS and Domain Access To serve the console on a domain with HTTPS, use one of the two setups below. **Option 1: nginx reverse proxy (recommended).** Let nginx terminate TLS and forward plain HTTP to the console, and set `"web_host": "127.0.0.1"` so the console is only reachable through nginx: ```nginx theme={null} server { listen 443 ssl; server_name cow.example.com; ssl_certificate /etc/letsencrypt/live/cow.example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/cow.example.com/privkey.pem; location / { proxy_pass http://127.0.0.1:9899; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # Replies stream over SSE: keep connections open and unbuffered proxy_read_timeout 3600s; proxy_buffering off; # File uploads up to 512 MB client_max_body_size 512m; } } ``` **Option 2: direct HTTPS.** The console serves TLS itself: ```json theme={null} { "web_https_enabled": true, "web_ssl_certfile": "/etc/letsencrypt/live/cow.example.com/fullchain.pem", "web_ssl_keyfile": "/etc/letsencrypt/live/cow.example.com/privkey.pem" } ``` | Parameter | Description | Default | | - | - | - | | `web_https_enabled` | Serve the console over HTTPS directly | `false` | | `web_ssl_certfile` | PEM certificate file (full chain recommended) | `""` | | `web_ssl_keyfile` | PEM private key file | `""` | A missing or unreadable certificate stops startup with an error instead of falling back to HTTP. > [!NOTE] > > The console must be served at the root path; use a dedicated subdomain rather than a sub-path such as `/cow/`. If you use MCP servers with OAuth, also set `"mcp_oauth_redirect_base": "https://cow.example.com"`. ## Chat API The Web Console's port also serves an OpenAI-compatible chat API, `/v1/chat/completions`. It is off by default; turn it on and get an API key from the Chat API card on the settings page. See [Chat API](/extensions/chat-api). ## Features ### Chat Interface Supports streaming output with real-time display of the Agent's reasoning process and tool calls, providing intuitive observation of the Agent's decision-making. Deep thinking can be toggled via configuration or the "Agent Configuration" switch in the console. ![](https://cdn.link-ai.tech/doc/20260227180120.png) #### Multi-Session Management The chat interface supports multi-session management. All session records are persistently stored in the database: * **Session List**: Click the history icon on the left to expand/collapse the session list panel, with scroll-to-load support for all historical sessions * **AI-Generated Titles**: After the first exchange in a new session, the model is automatically called to generate a short summary title * **New Session**: Click the "New Chat" button at the top of the session list or the `+` button in the input area to create a new session * **Delete Session**: Click the delete button on a session item and confirm to permanently delete the session and all its messages * **Clear Context**: Click the clear button in the input area to insert a divider in the current session. Messages above the divider are still displayed but no longer included as context for the model * **Workspace / Model / Permission**: Set a workspace, model, and permission mode for the current session below the input box. When you work across several projects, past sessions are grouped by project automatically. See [Architecture - Project Workspace](/intro/architecture#project-workspace) ![](https://cdn.jsdelivr.net/gh/zhayujie/cowagent-assets@main/screenshots/en/web-console-workspace-project-demo.png) Sessions grouped by workspace, with a per-session workspace and model #### Permission Modes Each session can run under its own permission mode, controlling how far the Agent can reach into files and commands: read-only, workspace-write, or full-access. When a tool call is blocked, the hint is clickable so you can adjust the permission on the spot. ![](https://cdn.jsdelivr.net/gh/zhayujie/cowagent-assets@main/screenshots/en/web-console-access-mode.png) Per-session permission modes: read-only, workspace-write, full-access ### Artifacts Collects the pages, documents, images and videos your agents create on one timeline, with preview, pinning, and a jump back to the original conversation. The page is hidden by default; show it from the [Custom Menu](/extensions/custom-menu) editor: ![](https://cdn.jsdelivr.net/gh/zhayujie/cowagent-assets@main/screenshots/en/web-console-artifacts.png) ### Model Management Manage text, image, voice, and embedding model configurations for different providers online — no need to edit config files manually: ![](https://cdn.link-ai.tech/doc/20260521212949.png) ### Skill Management View and manage Agent skills (Skills) online: ![](https://cdn.link-ai.tech/doc/20260227173403.png) ### Memory Management View and manage Agent memory online: ![](https://cdn.link-ai.tech/doc/20260227173349.png) ### Channel Management Manage connected channels online with real-time connect/disconnect operations: ![](https://cdn.link-ai.tech/doc/20260227173331.png) ### Scheduled Tasks View and manage scheduled tasks online, including one-time tasks, fixed intervals, and Cron expressions: ![](https://cdn.link-ai.tech/doc/20260227173704.png) ### Logs View Agent runtime logs in real time for monitoring and troubleshooting: ![](https://cdn.link-ai.tech/doc/20260227173514.png) # WeChat Customer Service Source: https://docs.cowagent.ai/channels/wechat-kf Connect CowAgent to WeChat Customer Service through a WeCom custom app to answer external WeChat users from Official Accounts, Mini Programs and Channels, with text, image and voice messages. By binding a WeCom custom enterprise app to a WeChat Customer Service account, CowAgent can take over inbound inquiries from external WeChat users and serve them through links or QR codes embedded in WeChat Mini Programs, Official Accounts, Video Channels, and Video Channel stores. > [!NOTE] > > WeChat Customer Service only supports Docker deployment or server Python deployment. A publicly reachable callback URL is required; local run mode is not supported. ## 1. Prerequisites Required resources: 1. A server with a public IP 2. A registered and verified WeCom account 3. WeChat Customer Service capability enabled > [!NOTE] > > It is recommended to create a **dedicated** WeCom custom app for Customer Service rather than reusing the existing `wechatcom_app` one — otherwise the two channels will compete for the same callback URL. ## 2. Create a WeCom Custom App 1. In the [WeCom Admin Console](https://work.weixin.qq.com/wework_admin/frame#apps), go to **Application Management → Create Application**: ![](https://cdn.link-ai.tech/doc/20260228103156.png) 2. Click **My Enterprise** and find the **Corp ID** at the bottom of the page (it goes into `wechat_kf_corp_id`): ![](https://cdn.link-ai.tech/doc/wechatcom-hosting-companyid.png) 3. Open the app you just created and click **"View"** next to Secret. The Secret will be pushed to the admin's phone via the WeCom app, where it can be viewed: ![](https://cdn.link-ai.tech/doc/wechatcom-hosting-agent-secret.png) 4. Open the app's **Receive Messages → Set API Reception** page, click **"Random Generate"** to generate the **Token** and **EncodingAESKey**, and save them: ![](https://img-1317903499.cos.ap-guangzhou.myqcloud.com/docs/wechatcom-hosting-token-aeskey.jpg) > [!NOTE] > > Saving the API reception configuration will fail at this point because the program has not started yet. Come back to save it after the project is running. ## 3. Configuration and Run Fill in the 4 fields collected from the previous step (Corp ID / Secret / Token / EncodingAESKey): **Web Console** Start the Cow project and open the Web Console. Go to the **Channels** menu, click **Connect**, choose **WeChat Customer Service**, fill in Corp ID / Secret / Token / AES Key (port defaults to 9888, configurable), and click Connect. ![](https://cdn.link-ai.tech/doc/cow-weixinkefu-web-control.png) **Config File** Add the following configuration to `config.json` (each parameter maps to a field shown in the screenshots above): ```json theme={null} { "channel_type": "wechat_kf", "wechat_kf_corp_id": "YOUR_CORP_ID", "wechat_kf_secret": "YOUR_SECRET", "wechat_kf_token": "YOUR_TOKEN", "wechat_kf_aes_key": "YOUR_AES_KEY", "wechat_kf_port": 9888 } ``` | Parameter | Description | | - | - | | `wechat_kf_corp_id` | Corp ID | | `wechat_kf_secret` | Secret of the WeCom custom app bound to Customer Service | | `wechat_kf_token` | Token from the API reception config | | `wechat_kf_aes_key` | EncodingAESKey from the API reception config | | `wechat_kf_port` | Listening port, default 9888 | After connecting, start the program (the Web Console method restarts the channel automatically). When the log shows `Listening on http://0.0.0.0:9888/wxkf/`, the program is running successfully. You need to open this port externally (e.g., allow it in the cloud server security group). Then go back to **Receive Messages → Set API Reception** in the WeCom console and set the callback URL to `http://:9888/wxkf/`, then click Save. After saving successfully, you also need to add the server IP to **Enterprise Trusted IPs**, otherwise messages cannot be sent or received: ![](https://cdn.link-ai.tech/doc/wechat-com_config.png) ![](https://cdn.link-ai.tech/doc/20260228103224.png) > [!WARNING] > > If URL verification fails or the configuration is unsuccessful: > > 1. Ensure the server firewall is disabled and the security group allows the listening port (default 9888) > 2. Carefully check that Token, Secret, EncodingAESKey and other parameters are consistent, and the URL format is correct > 3. Verified WeCom accounts must use a filed domain matching the entity ## 4. Bind a WeChat Customer Service Account In the WeCom Admin Console, go to **WeChat Customer Service**, create a customer service account, and bind it to the custom app you created above: ![](https://img-1317903499.cos.ap-guangzhou.myqcloud.com/docs/wxcustomer-hosting-step1.jpg) ![](https://img-1317903499.cos.ap-guangzhou.myqcloud.com/docs/wxcustomer-hosting-step2.jpg) ![](https://img-1317903499.cos.ap-guangzhou.myqcloud.com/docs/wxcustomer-hosting-step3.jpg) After binding, go to **WeChat Customer Service → Account Details**, and under **"Access Link"**: * Click **"Copy Link"** to get an access link like `https://work.weixin.qq.com/kfid/kfcd83e5896b9ba07be` * Click **"Generate QR Code"** to get the corresponding QR code Distribute the link or QR code to your WeChat customers: ![](https://cdn.link-ai.tech/doc/wechat-customer-service_use.png) ## 5. Usage After WeChat users enter the customer service conversation via the link or QR code, they can chat with the AI across multiple turns, with support for text, image, and voice messages: ![](https://img-1317903499.cos.ap-guangzhou.myqcloud.com/docs/wxcustomer-hosting-chat-demo.jpg) Beyond that, leveraging the official WeChat ecosystem, WeChat Customer Service can also be embedded into Official Accounts, Mini Programs, Video Channels and more. See the **WeChat Customer Service → Access Scenarios** section in the [WeCom Admin Console](https://work.weixin.qq.com/wework_admin/frame#/app/servicer) for details: ![](https://img-1317903499.cos.ap-guangzhou.myqcloud.com/docs/wxcustomer-hosting-interface-demo.png) ## FAQ Make sure the following dependencies are installed: ```bash theme={null} pip install websocket-client pycryptodome ``` # WeChat Official Account Source: https://docs.cowagent.ai/channels/wechatmp Connect CowAgent to a WeChat Official Account, either a personal subscription account or a service account. Requires server or Docker deployment and server configuration in the account backend. CowAgent supports both personal subscription accounts and enterprise service accounts. | Type | Requirements | Features | | - | - | - | | **Personal Subscription** | Available to individuals | Sends a placeholder reply first; users must send a message to retrieve the full response | | **Enterprise Service** | Enterprise with verified customer service API | Can proactively push replies to users | > [!NOTE] > > Official Accounts only support server and Docker deployment, not local run mode. Install extended dependencies: `pip3 install -r requirements-optional.txt` ## 1. Personal Subscription Account Add the following configuration to `config.json`: ```json theme={null} { "channel_type": "wechatmp", "single_chat_prefix": [""], "wechatmp_app_id": "wx73f9******d1e48", "wechatmp_app_secret": "YOUR_APP_SECRET", "wechatmp_aes_key": "", "wechatmp_token": "YOUR_TOKEN", "wechatmp_port": 80 } ``` ### Setup Steps These configurations must be consistent with the [WeChat Official Account Platform](https://mp.weixin.qq.com/advanced/advanced?action=dev\&t=advanced/dev). Navigate to **Settings & Development → Basic Configuration → Server Configuration** and configure as shown below: ![](https://cdn.link-ai.tech/doc/20260228103506.png) 1. Enable the developer secret on the platform (corresponds to `wechatmp_app_secret`), and add the server IP to the whitelist 2. Fill in the `config.json` with the official account parameters matching the platform configuration 3. Start the program, which listens on port 80 (use `sudo` if you don't have permission; stop any process occupying port 80) 4. **Enable server configuration** on the official account platform and submit. A successful save means the configuration is complete. Note that the **"Server URL"** must be in the format `http://{HOST}/wx`, where `{HOST}` can be the server IP or domain After following the account and sending a message, you should see the following result: ![](https://cdn.link-ai.tech/doc/20260228103522.png) Due to subscription account limitations, short replies (within 15s) can be returned immediately, but longer replies will first send a "Thinking..." placeholder, requiring users to send any text to retrieve the answer. Enterprise service accounts can solve this with the customer service API. > [!TIP] > > **Voice Recognition**: You can use WeChat's built-in voice recognition. Enable "Receive Voice Recognition Results" under "Settings & Development → API Permissions" on the official account management page. ## 2. Enterprise Service Account The setup process for enterprise service accounts is essentially the same as personal subscription accounts, with the following differences: 1. Register an enterprise service account on the platform and complete WeChat certification. Confirm that the **Customer Service API** permission has been granted 2. Set `"channel_type": "wechatmp_service"` in `config.json`; other configurations remain the same 3. Even for longer replies, they can be proactively pushed to users without requiring manual retrieval ```json theme={null} { "channel_type": "wechatmp_service", "single_chat_prefix": [""], "wechatmp_app_id": "YOUR_APP_ID", "wechatmp_app_secret": "YOUR_APP_SECRET", "wechatmp_aes_key": "", "wechatmp_token": "YOUR_TOKEN", "wechatmp_port": 80 } ``` # WeCom Source: https://docs.cowagent.ai/channels/wecom Connect CowAgent to a WeCom custom app for direct chats inside your organization. Needs a server with a public IP and Docker or server deployment; follow the steps to set up the app and callbacks. Integrate CowAgent into WeCom through a custom enterprise app, supporting one-on-one chat for internal employees. > [!NOTE] > > WeCom only supports Docker deployment or server Python deployment. Local run mode is not supported. ## 1. Prerequisites Required resources: 1. A server with public IP (overseas server, or domestic server with a proxy for international API access) 2. A registered WeCom account (individual registration is possible but cannot be certified) 3. Certified WeCom accounts additionally require a domain filed under the corresponding entity ## 2. Create WeCom App 1. In the [WeCom Admin Console](https://work.weixin.qq.com/wework_admin/frame#profile), click **My Enterprise** and find the **Corp ID** at the bottom of the page. Save this ID for the `wechatcom_corp_id` configuration field. 2. Switch to **Application Management** and click Create Application: ![](https://cdn.link-ai.tech/doc/20260228103156.png) 3. On the application creation page, record the `AgentId` and `Secret`: ![](https://cdn.link-ai.tech/doc/20260228103218.png) 4. Click **Set API Reception** to configure the application interface: ![](https://cdn.link-ai.tech/doc/20260228103211.png) * URL format: `http://ip:port/wxcomapp` (certified enterprises must use a filed domain) * Generate random `Token` and `EncodingAESKey` and save them for the configuration file > [!NOTE] > > The API reception configuration cannot be saved at this point because the program hasn't started yet. Come back to save it after the project is running. ## 3. Configuration and Run Add the following configuration to `config.json` (the mapping between each parameter and the WeCom console is shown in the screenshots above): ```json theme={null} { "channel_type": "wechatcom_app", "single_chat_prefix": [""], "wechatcom_corp_id": "YOUR_CORP_ID", "wechatcomapp_token": "YOUR_TOKEN", "wechatcomapp_secret": "YOUR_SECRET", "wechatcomapp_agent_id": "YOUR_AGENT_ID", "wechatcomapp_aes_key": "YOUR_AES_KEY", "wechatcomapp_port": 9898 } ``` | Parameter | Description | | - | - | | `wechatcom_corp_id` | Corp ID | | `wechatcomapp_token` | Token from API reception config | | `wechatcomapp_secret` | App Secret | | `wechatcomapp_agent_id` | App AgentId | | `wechatcomapp_aes_key` | EncodingAESKey from API reception config | | `wechatcomapp_port` | Listen port, default 9898 | After configuration, start the program. When the log shows `http://0.0.0.0:9898/`, the program is running successfully. You need to open this port externally (e.g., allow it in the cloud server security group). After the program starts, return to the WeCom Admin Console to save the **Message Server Configuration**. After saving successfully, you also need to add the server IP to **Enterprise Trusted IPs**, otherwise messages cannot be sent or received: ![](https://cdn.link-ai.tech/doc/20260228103224.png) > [!WARNING] > > If the URL configuration callback fails or the configuration is unsuccessful: > > 1. Ensure the server firewall is disabled and the security group allows the listening port > 2. Carefully check that Token, Secret Key and other parameter configurations are consistent, and that the URL format is correct > 3. Certified WeCom accounts must configure a filed domain matching the entity ## 4. Usage Search for the app name you just created in WeCom to start chatting directly. You can run multiple instances listening on different ports to create multiple WeCom apps: ![](https://cdn.link-ai.tech/doc/20260228103228.png) To allow external personal WeChat users to use the app, go to **My Enterprise → WeChat Plugin**, share the invite QR code. After scanning and following, personal WeChat users can join and chat with the app: ![](https://cdn.link-ai.tech/doc/20260228103232.png) ## FAQ Make sure the following dependencies are installed: ```bash theme={null} pip install websocket-client pycryptodome ``` # WeCom Bot Source: https://docs.cowagent.ai/channels/wecom-bot Connect CowAgent to a WeCom smart bot for internal direct and group chats. It uses a WebSocket connection with no public IP or domain, supports one-scan setup, Markdown and streaming output. > Connect CowAgent via WeCom AI Bot, supporting both internal direct messages and group chats. No public IP required — uses a WebSocket long connection, with Markdown rendering and streaming output. > [!NOTE] > > WeCom Bot and WeCom App are two different integration methods. WeCom Bot uses a WebSocket long connection and requires no public IP or domain, making setup much simpler. ## 1. Connection methods ### Option A: One-click QR scan (recommended) No need to create the bot ahead of time. Start CowAgent and open the Web console (local URL: [http://127.0.0.1:9899/](http://127.0.0.1:9899/)), go to the **Channels** tab, click **Connect Channel**, choose **WeCom Bot**, switch to **QR scan** mode, and scan the QR code with **WeCom** — bot creation and connection complete automatically. ![](https://cdn.link-ai.tech/doc/20260401121213.png) > [!NOTE] > > After a successful scan, you can further configure the bot (name, avatar, visibility scope, etc.) in **WeCom Workbench → AI Bot**. ### Option B: Manual creation Create the AI Bot in WeCom and obtain the Bot ID and Secret, then connect via the Web console or config file. **Step 1: Create the AI Bot** 1. Open the WeCom client, go to **Workbench**, and click **AI Bot**: ![](https://cdn.link-ai.tech/doc/20260316180959.png) 2. Click **Create Bot → Manual Creation**: ![](https://cdn.link-ai.tech/doc/20260316181118.png) 3. Scroll to the bottom of the right panel and select **API Mode**: ![](https://cdn.link-ai.tech/doc/20260316181215.png) 4. Set the bot name, avatar, and visibility scope. Choose **Long Connection** mode, save the **Bot ID** and **Secret**, then click Save. **Step 2: Connect to CowAgent** **Web Console** Open the Web console, go to the **Channels** tab, click **Connect Channel**, choose **WeCom Bot**, switch to **Manual** mode, enter the Bot ID and Secret, and click Connect. ![](https://cdn.link-ai.tech/doc/20260316181711.png) **Config File** Add the following to `config.json`, then start CowAgent: ```json theme={null} { "channel_type": "wecom_bot", "wecom_bot_id": "YOUR_BOT_ID", "wecom_bot_secret": "YOUR_SECRET" } ``` | Parameter | Description | | - | - | | `wecom_bot_id` | Bot ID of the AI Bot | | `wecom_bot_secret` | Secret of the AI Bot | The log line `[WecomBot] Subscribe success` confirms the connection is established. > [!NOTE] > > A **webhook (HTTP callback) mode** is also supported: when creating the bot, choose **Use URL callback**, set the receive-message URL to `http(s)://:9892/wecombot`, and copy the Token and EncodingAESKey from that page. This mode needs a publicly reachable address and does not support file sending or scheduled push, so the long connection is generally recommended. The corresponding `config.json`: > > ```json theme={null} > { > "channel_type": "wecom_bot", > "wecom_bot_mode": "webhook", > "wecom_bot_token": "YOUR_TOKEN", > "wecom_bot_encoding_aes_key": "YOUR_ENCODING_AES_KEY", > "wecom_bot_port": 9892 > } > ``` ## 2. Supported features | Feature | Status | | - | - | | Direct chat | ✅ | | Group chat (@bot) | ✅ | | Text messages | ✅ Send / Receive | | Image messages | ✅ Send / Receive | | File messages | ✅ Send / Receive | | Streaming replies | ✅ | | Scheduled push messages | ✅ | ## 3. Usage Search for the bot's name inside WeCom to start a direct chat. To use the bot in an internal group chat, add it to the group and @-mention it. ![](https://cdn.link-ai.tech/doc/20260316182902.png) # WeChat Source: https://docs.cowagent.ai/channels/weixin Connect CowAgent to personal WeChat through the official API. Log in by scanning a QR code to chat privately with text, images, voice, files and video, without affecting your account. > Connect CowAgent to your personal WeChat — scan to log in, no public IP required. Supports text, image, voice, file, and video messages in 1-on-1 chats. Backed by WeChat's official API; safe to use. After connecting, a bot assistant is added to your conversation list without affecting normal account usage. ## 1. Setup and run ### Option A: Web console Start CowAgent and open the Web console (local URL: [http://127.0.0.1:9899/](http://127.0.0.1:9899/)). Go to the **Channels** tab, click **Connect Channel**, select **WeChat**, and follow the prompts to scan in. ![](https://cdn.link-ai.tech/doc/20260322195114.png) ### Option B: Config file Set `channel_type` to `weixin` in `config.json`: ```json theme={null} { "channel_type": "weixin" } ``` After starting CowAgent, a QR code is displayed in the terminal. Scan it with WeChat to complete login. ![](https://cdn.link-ai.tech/doc/20260322195509.png) > [!NOTE] > > 1. For backward compatibility, setting `channel_type` to `wx` also activates the WeChat channel. > 2. The WeChat client must be on version **8.0.69** or higher. ## 2. Usage Once authorized, the integration completes and you can start chatting. A bot assistant is created in your WeChat conversation list, leaving normal account usage unaffected. > You can find the bot at any time by searching for **"微信ClawBot"**. You may also rename it, change its avatar, pin it to the top of your conversation list, and so on. ![](https://cdn.link-ai.tech/doc/83ae8251d896219fde4803f4205205be.jpg) > [!NOTE] > > Due to WeChat platform limits, the bot can only send proactive messages within 24 hours of the user's last message. After that, scheduled task pushes will fail until the user sends any message again. ## 3. Login ### QR code login On first startup, a QR code appears in the terminal (valid for around 2 minutes). Scan it with WeChat and confirm on your phone to log in. * The QR code refreshes automatically when it expires * The `qrcode` dependency is already included in `requirements.txt`, so the QR code renders directly in the terminal after install ### Credential persistence After a successful login, credentials are saved to `~/.weixin_cow_credentials.json`. Subsequent startups reuse the saved credentials with no need to re-scan. To force a re-login, delete the credentials file and restart. ### Session expiry When the WeChat session expires (errcode `-14`), CowAgent automatically clears old credentials and initiates a new QR login — no manual intervention required. ## 4. Supported features | Feature | Status | | - | - | | Direct messages | ✅ | | Text messages | ✅ Send & Receive | | Image messages | ✅ Send & Receive | | File messages | ✅ Send & Receive | | Video messages | ✅ Send & Receive | | Voice messages | ✅ Receive (built-in speech recognition) | # Backup and Restore Source: https://docs.cowagent.ai/cli/backup Export and restore CowAgent configuration and workspace data as a portable archive, including config.json, persona files, memory, sessions, knowledge, custom skills and scheduled tasks. CowAgent can create a portable local archive for migration or disaster recovery. ## Create a backup ```bash theme={null} cow backup cow backup --output /safe/location/cow-backup.zip ``` The archive contains: * `config.json` * Agent persona and user files such as `AGENT.md`, `USER.md`, and `MEMORY.md` * Daily memory, session history, knowledge, custom skills, and scheduled tasks in the configured workspace * The Agent registry, channel bindings, and every configured Agent workspace when multi-Agent mode is configured * Legacy `user_datas.pkl`, when present Transient `tmp/` data, caches, Git metadata, and symbolic links are skipped. The archive is written with owner-only permissions where the operating system supports them. > [!WARNING] > > A backup may contain API keys, conversation history, and other personal data. > Store and transfer it as a secret. The ZIP file is not encrypted. ## Restore a backup Stop CowAgent before restoring: ```bash theme={null} cow stop cow restore /safe/location/cow-backup.zip ``` Use `--workspace` to migrate workspace files to a different location: ```bash theme={null} cow restore cow-backup.zip --workspace ~/cow-restored ``` For a multi-Agent archive, `--workspace` is the instance root. CowAgent restores the default Agent into that root and every other Agent into `/agents/`, the same layout the Agent registry derives on its own. Without the option, Agent IDs that already exist locally keep their current workspace, and the rest are placed under the instance root this machine already uses. Restore validates the archive format and paths before writing anything. It overwrites matching files but does not delete unrelated files already present at the destination. When current CowAgent data exists, the command first creates a `cow-pre-restore-*.zip` rollback archive beside the selected backup. For unattended scripts, pass `--yes` to acknowledge overwrites. # General Commands Source: https://docs.cowagent.ai/cli/general Reference for everyday CowAgent commands such as help, status, cancel, steer, config and context, usable with / in chat or cow in a terminal to check status, stop tasks and manage settings. The following commands can be used in chat with the `/` prefix or in the terminal with the `cow` prefix (some are chat-only). > [!TIP] > > In the Web console, typing `/` brings up an autocomplete menu with keyboard navigation and Tab completion. ## help Show help information for all available commands. ```text theme={null} /help ``` ## status View current session and service status, including process info, model configuration, message count, loaded skills, and loaded MCP servers (ready/configured). ```text theme={null} /status ``` ## cancel Abort the agent task currently running in this session. When the agent is busy with a long task (e.g. multi-turn tool calls or a long streaming response), send `/cancel` and the agent will stop before the next tool execution. Available across all channels — Web, WeChat, WeCom, Feishu, etc. ```text theme={null} /cancel ``` ## steer Redirect the Agent task currently running in this session without cancelling it. The instruction is injected at the next safe checkpoint; a tool that is already running may finish, while tools that have not started are skipped. If no task is active, `/steer` does not start or queue a new one. Available across all chat channels. ```text theme={null} /steer focus on the failing tests first ``` In the Web console, enter an instruction while a reply is running and click **Steer active task**. Sending an ordinary message still uses the session queue. ## config View or modify runtime configuration. Changes take effect immediately without restarting. **View all configurable items:** ```text theme={null} /config ``` **View a single item:** ```text theme={null} /config model ``` **Modify a config item:** ```text theme={null} /config model deepseek-flash ``` **Configurable items:** | Item | Description | Example | | - | - | - | | `model` | AI model name | `deepseek-flash` | | `agent_max_context_tokens` | Max context tokens | `200000` | | `agent_max_context_turns` | Max context memory turns | `30` | | `agent_max_steps` | Max decision steps per task | `100` | | `enable_thinking` | Enable deep thinking mode | `true` / `false` | > [!NOTE] > > When changing `model`, the system automatically matches the corresponding model API. Configuration is persisted to `config.json`. ## context View current session context statistics, including message count and content length. ```text theme={null} /context ``` **Clear current session context:** ```text theme={null} /clear ``` > [!TIP] > > Clearing context makes the Agent "forget" previous conversation, useful for switching topics or freeing context space. `/context clear` still works as an alias. ## compact Summarize older turns to free up context while keeping recent turns intact. Unlike automatic trimming, this runs immediately regardless of current token usage. ```text theme={null} /compact ``` > [!TIP] > > Use `/compact` before a long task to reclaim context space without fully clearing the conversation. Recent turns and an LLM summary of older turns are retained. ## logs View recent service logs. Shows the last 20 lines by default, up to 50. ```text theme={null} /logs ``` **Specify line count:** ```text theme={null} /logs 50 ``` ## version Show the current CowAgent version. ```text theme={null} /version ``` # Commands Overview Source: https://docs.cowagent.ai/cli/index Overview of CowAgent commands: use the cow CLI in a terminal to run, update and manage the service and skills, or type / commands in chat to check status and change settings. CowAgent provides two ways to interact via commands: * **Terminal CLI** — Run `cow ` in your system terminal for service management, skill management, and other operations * **Chat Commands** — Type `/` or `cow ` in any conversation to check status, manage skills, adjust configuration, etc. ## Cow CLI After deploying with the one-click install script, the `cow` command is automatically available. For manual installations, run: ```bash theme={null} pip install -e . ``` Then use the `cow` command from anywhere: ```bash theme={null} cow help ``` Example output: ``` 🐮 CowAgent CLI Usage: cow Service: start Start the CowAgent service stop Stop the CowAgent service restart Restart the CowAgent service update Update code and restart service status Show service status logs View service logs Skills: skill Manage skills (list / search / install / uninstall ...) Memory & Knowledge: memory Memory distillation (dream) knowledge View knowledge base stats and structure Data portability: backup Back up config and agent workspace restore Restore a CowAgent backup Others: help Show this help message version Show version ``` ## Chat Commands In the Web console or any connected channel, type `/` to see command suggestions. Supported commands: | Command | Description | | - | - | | `/help` | Show command help | | `/status` | View service status and configuration | | `/cancel` | Abort the currently running agent task | | `/steer ` | Guide the currently running agent task without queueing a new turn | | `/config` | View or modify runtime configuration | | `/skill` | Manage skills (install, uninstall, enable, disable, etc.) | | `/memory dream [N]` | Manually trigger memory distillation (default 3 days, max 30) | | `/knowledge` | View knowledge base statistics | | `/knowledge list` | View knowledge base directory structure | | `/knowledge on\|off` | Enable or disable knowledge base | | `/context` | View current session context info | | `/context clear` | Clear current session context | | `/logs` | View recent logs | | `/version` | Show version number | > [!TIP] > > Service management commands like `/start`, `/stop`, `/restart` will prompt you to use them in the terminal instead, as they involve process operations. ## Command Availability | Command | Terminal (`cow`) | Chat (`/`) | | - | :-: | :-: | | help | ✓ | ✓ | | version | ✓ | ✓ | | status | ✓ | ✓ | | logs | ✓ | ✓ | | cancel | ✗ | ✓ | | config | ✗ | ✓ | | context | — | ✓ | | memory (subcommands) | ✗ | ✓ | | knowledge (subcommands) | ✓ | ✓ | | skill (subcommands) | ✓ | ✓ | | start / stop / restart | ✓ | ✗ | | update | ✓ | ✗ | | install-browser | ✓ | ✗ | | backup / restore | ✓ | ✗ | > [!NOTE] > > `context` only shows a hint in the terminal to use it in chat. `config` is only available in chat. # Memory & Knowledge Source: https://docs.cowagent.ai/cli/memory-knowledge Memory and knowledge commands: run memory dream to distill recent daily memories into MEMORY.md and a dream diary on demand, and use knowledge to view and manage the personal knowledge base. ## memory Manage the Agent's long-term memory system. ### memory dream Manually trigger memory distillation (Deep Dream) — consolidate recent daily memories into MEMORY.md and generate a dream diary. ```text theme={null} /memory dream [N] ``` * `N`: Consolidate the last N days of memory (default 3, max 30) * Runs asynchronously in the background; you'll be notified in chat when complete * Works without Agent initialization — can be used before the first conversation **Examples:** ```text theme={null} /memory dream # Consolidate last 3 days /memory dream 7 # Consolidate last 7 days /memory dream 30 # Consolidate last 30 days (full) ``` On the Web console, the completion notification includes clickable links to view the updated MEMORY.md and dream diary. > [!TIP] > > The system automatically runs distillation daily at 23:55 (lookback 1 day). Manual trigger is useful for consolidating historical memories after first deployment, or when you need an immediate memory update. ## knowledge View and manage the personal knowledge base. Shows statistics by default. ```text theme={null} /knowledge ``` ### knowledge list View the knowledge base directory tree. ```text theme={null} /knowledge list ``` ### knowledge on / off Enable or disable the knowledge base. When disabled, knowledge prompts and file indexing are not injected. ```text theme={null} /knowledge on /knowledge off ``` > [!NOTE] > > In the terminal CLI, `cow knowledge` and `cow knowledge list` are available, but `on|off` is only supported in chat (requires runtime effect). # Process Management Source: https://docs.cowagent.ai/cli/process Manage the CowAgent background process with the cow command: start, stop, restart, update (pull code, update dependencies and restart), check status and view logs. Process management commands control the CowAgent background process. These commands are only available in the terminal. ## start Start the CowAgent service. Runs as a background daemon by default and automatically tails logs. ```bash theme={null} cow start ``` **Options:** | Option | Description | | - | - | | `-f`, `--foreground` | Run in foreground, not as a background daemon | | `--no-logs` | Don't tail logs after starting | ## stop Stop the running CowAgent service. ```bash theme={null} cow stop ``` ## restart Restart the CowAgent service (stop then start). ```bash theme={null} cow restart ``` **Options:** | Option | Description | | - | - | | `--no-logs` | Don't tail logs after restart | ## update Update code and restart the service. Automatically performs: 1. Pull latest code (`git pull`) 2. Stop current service 3. Update Python dependencies 4. Reinstall CLI 5. Start service ```bash theme={null} cow update ``` > [!WARNING] > > If `git pull` fails (e.g., uncommitted local changes), the update aborts and the service remains unaffected. ## status Check CowAgent service status, including process info, version, and current model/channel configuration. ```bash theme={null} cow status ``` ## logs View service logs. ```bash theme={null} cow logs ``` **Options:** | Option | Description | Default | | - | - | - | | `-f`, `--follow` | Continuously tail log output | No | | `-n`, `--lines` | Show last N lines | 50 | Examples: ```bash theme={null} # View last 100 lines cow logs -n 100 # Continuously tail logs cow logs -f ``` ## install-browser Install Playwright and Chromium browser for the [browser tool](/tools/browser). ```bash theme={null} cow install-browser ``` > [!TIP] > > Only needed when using browser tools (web browsing, screenshots, etc.). ## run.sh Compatibility If Cow CLI is not installed, you can use `run.sh` to manage the service: | cow command | run.sh equivalent | | - | - | | `cow start` | `./run.sh start` | | `cow stop` | `./run.sh stop` | | `cow restart` | `./run.sh restart` | | `cow update` | `./run.sh update` | | `cow status` | `./run.sh status` | | `cow logs` | `./run.sh logs` | > [!NOTE] > > The `cow` command is recommended — it provides cleaner syntax and richer features. It is automatically installed via the one-click install script. # Skill Management Source: https://docs.cowagent.ai/cli/skill Skill management commands: use /skill in chat or cow skill in a terminal to list, search, install, uninstall, enable and disable skills from the Skill Hub, GitHub, ClawHub or any URL. Skill management commands are used to install, query, and manage CowAgent skills. Use `/skill ` in chat or `cow skill ` in the terminal. ## list List installed skills and their status. ```text Chat theme={null} /skill list ``` ```bash Terminal theme={null} cow skill list ``` Example output: ``` 📦 Installed skills (3/4) ✅ pptx Use this skill any time a .pptx file is involved… Source: cowhub ✅ skill-creator Create, install, or update skills… Source: builtin ⏸️ image-vision (disabled) Image understanding and visual analysis Source: builtin ``` **Browse the Skill Hub** (view all available skills): ```text Chat theme={null} /skill list --remote ``` ```bash Terminal theme={null} cow skill list --remote ``` **Options:** | Option | Description | Default | | - | - | - | | `--remote`, `-r` | Browse Skill Hub remote skill list | No | | `--page` | Page number for remote listing | 1 | ## search Search for skills on the Skill Hub. ```text Chat theme={null} /skill search pptx ``` ```bash Terminal theme={null} cow skill search pptx ``` ## install Install skills with a single `install` command from Cow Skill Hub, GitHub, ClawHub, or any URL (zip archives, SKILL.md links) — no manual download or configuration required. **From Skill Hub (recommended):** ```text Chat theme={null} /skill install pptx ``` ```bash Terminal theme={null} cow skill install pptx ``` **From GitHub:** ```text Chat theme={null} # Install all skills in a repo (auto-discovers subdirectories with SKILL.md) /skill install larksuite/cli # Specify a subdirectory to install a single skill /skill install https://github.com/larksuite/cli/tree/main/skills/lark-im # Use # to specify a subdirectory /skill install larksuite/cli#skills/lark-minutes ``` ```bash Terminal theme={null} # Install all skills in a repo (auto-discovers subdirectories with SKILL.md) cow skill install larksuite/cli # Specify a subdirectory to install a single skill cow skill install https://github.com/larksuite/cli/tree/main/skills/lark-im # Use # to specify a subdirectory cow skill install larksuite/cli#skills/lark-minutes ``` Supports full GitHub URLs and `owner/repo` shorthand. For mono-repos (multiple skills in one repository), omitting the subdirectory auto-discovers and batch-installs all skills; specifying a subdirectory installs only that skill. **From ClawHub:** ```text Chat theme={null} /skill install clawhub:baidu-search ``` ```bash Terminal theme={null} cow skill install clawhub:baidu-search ``` **From URL:** ```text Chat theme={null} # Install from a zip archive (single or batch) /skill install https://cdn.link-ai.tech/skills/pptx.zip # Install from a SKILL.md link /skill install https://example.com/path/to/SKILL.md ``` ```bash Terminal theme={null} # Install from a zip archive (single or batch) cow skill install https://cdn.link-ai.tech/skills/pptx.zip # Install from a SKILL.md link cow skill install https://example.com/path/to/SKILL.md ``` Supports installing from zip / tar.gz archive URLs — automatically extracts and discovers directories containing `SKILL.md`, with support for single or batch install. Also supports installing directly from a `SKILL.md` file URL, automatically parsing the skill name and description. ## uninstall Uninstall an installed skill. ```text Chat theme={null} /skill uninstall pptx ``` ```bash Terminal theme={null} cow skill uninstall pptx ``` > [!WARNING] > > Uninstalling deletes all files in the skill directory. This action cannot be undone. ## enable / disable Enable or disable a skill. Disabled skills will not be invoked by the Agent. ```text Chat theme={null} /skill enable pptx /skill disable pptx ``` ```bash Terminal theme={null} cow skill enable pptx cow skill disable pptx ``` ## info View details of an installed skill, including a preview of its `SKILL.md`. ```text Chat theme={null} /skill info pptx ``` ```bash Terminal theme={null} cow skill info pptx ``` ## Skill Sources Installed skills track their origin, viewable via `/skill list`: | Source | Description | | - | - | | `builtin` | Built-in project skills | | `cowhub` | Installed from CowAgent Skill Hub | | `github` | Installed directly from a GitHub URL | | `clawhub` | Installed from ClawHub | | `url` | Installed from a SKILL.md URL | | `local` | Locally created skills | # Agent Mail Source: https://docs.cowagent.ai/extensions/agent-mail Enable the Agent Mail overlay in a Docker deployment so the agent can send, reply to, forward and search email and download attachments through agently-cli, set up in four short steps. [Agent Mail](https://agent.qq.com) lets the agent handle emails through the `agently-cli` command-line tool: sending, replying, forwarding, searching, reading emails, downloading attachments, and managing the inbox. It is provided as an optional Docker Compose overlay. The default `docker-compose.yml` deployment is unchanged; the overlay only installs Node.js and `agently-cli` into the container when you choose to enable it. ## 1. Download the overlay Run the following in the directory that contains `docker-compose.yml`: ```bash theme={null} mkdir -p agent-mail curl -o docker-compose.agent-mail.yml https://raw.githubusercontent.com/zhayujie/CowAgent/master/docker/docker-compose.agent-mail.yml curl -o agent-mail/entrypoint.sh https://raw.githubusercontent.com/zhayujie/CowAgent/master/docker/agent-mail/entrypoint.sh echo "COMPOSE_FILE=docker-compose.yml:docker-compose.agent-mail.yml" >> .env ``` The `COMPOSE_FILE` entry in `.env` makes every later `docker compose` command in this directory (including `pull` for upgrades) apply the overlay automatically. ## 2. Start the container ```bash theme={null} sudo docker compose up -d ``` On the first start, Node.js and `agently-cli` are downloaded into `./agent-mail-data/`, so later restarts, container recreation, and image upgrades do not download them again. If the download fails, CowAgent still starts normally without Agent Mail; check the `[agent-mail]` lines in `docker compose logs` and restart to retry. > [!TIP] > > If downloads are slow, change `NODE_MIRROR` and `NPM_CONFIG_REGISTRY` in `docker-compose.agent-mail.yml` to a closer mirror, for example `https://npmmirror.com/mirrors/node` and `https://registry.npmmirror.com`. ## 3. Authorize the mailbox ```bash theme={null} sudo docker compose exec -u agent chatgpt-on-wechat agently-cli auth login ``` Open the printed link in a browser to complete authorization. The command exits automatically once authorization succeeds. ## 4. Install the skill The skill teaches the agent how to use `agently-cli`. Send this in chat: ```text theme={null} /skill install https://agent.qq.com/.well-known/skills/agently-mail/SKILL.md ``` Or run it in the terminal: ```bash theme={null} sudo docker compose exec -u agent chatgpt-on-wechat cow skill install https://agent.qq.com/.well-known/skills/agently-mail/SKILL.md ``` The skill is installed into the workspace (`./cow/skills`). Once it is installed, just ask the agent to send or check emails. ## Data persistence | Host directory | Contents | | - | - | | `./agent-mail-data/config` | `agently-cli` configuration and login credentials | | `./agent-mail-data/share` | `agently-cli` local data | | `./agent-mail-data/npm-global` | Node.js runtime and `agently-cli` | > [!WARNING] > > `./agent-mail-data/config` contains your mailbox credentials. Keep it private and do not commit or share it. # Chat API Source: https://docs.cowagent.ai/extensions/chat-api Turn on the OpenAI-compatible /v1/chat/completions endpoint to call the full CowAgent from any app, SDK or workflow, with tools, skills and memory, plus reasoning, tool calls and token usage. > CowAgent serves a chat endpoint compatible with the OpenAI Chat Completions protocol, on the same port as the Web Console. Any app, SDK or workflow that speaks the OpenAI protocol can connect to it directly. Unlike calling a model, the endpoint runs the full Agent: it uses its tools, skills, memory and knowledge base to finish the task, and returns its reasoning, tool calls and token usage along with the answer. ## Turn on the API The API is off by default. Once it is on, every request must carry the API key. ### From the console Open "Config → Integrations → Chat API" and turn on the switch. After you confirm, an API key is generated, along with the base URL and ready-to-copy examples (cURL / Python / Node.js). ![Chat API config](https://cdn.jsdelivr.net/gh/zhayujie/cowagent-assets@main/screenshots/en/web-console-chat-api-config.png) The Chat API card on the Config page * **Regenerate**: issues a new API key; the old one stops working at once * **Turn off**: the API stops serving requests. The key is kept and works again once the API is back on ### From the config file Set these two keys in `config.json`, then restart the service: ```json theme={null} { "external_api_enabled": true, "external_api_token": "sk-your-random-key" } ``` | Key | Description | | - | - | | `external_api_enabled` | Whether the API is on. Defaults to `false` | | `external_api_token` | The API key; use a long random string. It is kept while the API is off | > [!NOTE] > > The API shares the Web Console's address and port. By default it listens on `127.0.0.1`, so only this machine can reach it. To call it from other machines, set `web_host` to `0.0.0.0` as described in [Web Console](/channels/web) and open the port. The API key is independent from the console password `web_password`. ## Quick start The examples assume the service runs on port `9899` of this machine. They name neither a model nor an Agent, so the default Agent answers on its own model. **cURL** ```bash theme={null} curl http://localhost:9899/v1/chat/completions \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{"messages": [{"role": "user", "content": "Summarize the files in the workspace"}]}' ``` **Python** ```python theme={null} import requests resp = requests.post( "http://localhost:9899/v1/chat/completions", headers={"Authorization": "Bearer your-api-key"}, json={"messages": [{"role": "user", "content": "Summarize the files in the workspace"}]}, ) print(resp.json()["choices"][0]["message"]["content"]) ``` **Node.js** ```javascript theme={null} const resp = await fetch("http://localhost:9899/v1/chat/completions", { method: "POST", headers: { "Authorization": "Bearer your-api-key", "Content-Type": "application/json" }, body: JSON.stringify({ messages: [{ role: "user", content: "Summarize the files in the workspace" }], }), }); const data = await resp.json(); console.log(data.choices[0].message.content); ``` ## Endpoints ### Authentication Every request carries the API key in its headers: ``` Authorization: Bearer ``` ### Chat `POST /v1/chat/completions` | Parameter | Type | Required | Description | | - | - | - | - | | `messages` | array | Yes | The conversation. Roles `system`, `developer`, `user` and `assistant` are accepted; `content` is a string or an array of `text` parts | | `model` | string | No | The model to answer on. Without it the Agent uses its own model. See [List models](#list-models) | | `agent_id` | string | No | CowAgent extension: the Agent that answers. Without it the default Agent answers. See [Choose an Agent](#choose-an-agent) | | `stream` | boolean | No | Stream the response. Defaults to `false` | | `stream_options` | object | No | With `{"include_usage": true}`, the stream ends with the token usage | | `conversation_id` | string | No | CowAgent extension: the server keeps this conversation's history. See [Conversations](#conversations) | The Agent uses its own tools and system prompt, so parameters such as `temperature`, `max_tokens` and `tools` are ignored. ### Choose an Agent With [multiple Agents](/multi-agent/team) configured, `agent_id` chooses which one answers. An Agent's ID is shown under its name on the Agents page, with a button next to it to copy it. `default` always means the default Agent. An Agent that does not exist or is archived returns 404. ```bash theme={null} curl http://localhost:9899/v1/chat/completions \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "agent_id": "research", "model": "deepseek-chat", "messages": [{"role": "user", "content": "Look into recent open-source agent frameworks"}] }' ``` `model` applies to that request only; it does not change the model set for the Agent or the conversation. ### List models `GET /v1/models` Returns the available models: the chat models of every provider configured under "Config → Models", with the provider in `owned_by`. A request naming a model that is not listed returns 404. ```json theme={null} { "object": "list", "data": [ { "id": "deepseek-chat", "object": "model", "created": 0, "owned_by": "deepseek" }, { "id": "qwen-max", "object": "model", "created": 0, "owned_by": "dashscope" } ] } ``` ## Conversations The API supports two ways of keeping a conversation: * **Stateless (default)**: without `conversation_id`, send the whole `messages` list every time, as with any model. The last `user` message is this turn's input, and the `user` / `assistant` messages before it are the context. Nothing is written to CowAgent's conversation history. * **Stateful**: with `conversation_id`, CowAgent keeps the history, so each request only sends the new message and earlier entries in `messages` are ignored. Requests in the same conversation are handled one at a time, in order. ```json theme={null} { "conversation_id": "order-bot-user-42", "messages": [{ "role": "user", "content": "Let's continue where we left off" }] } ``` > [!NOTE] > > `system` messages in the request are ignored: the Agent always keeps its own persona, skills and memory. Either way, the Agent can read and write its workspace and memory files through its tools. ## Responses ### Non-streaming Besides the standard OpenAI response, `message` carries the reasoning and a record of the tool calls: ```json theme={null} { "id": "chatcmpl-82c19c44...", "object": "chat.completion", "created": 1791861130, "model": "deepseek-chat", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "The workspace holds 4 core files and 7 folders...", "reasoning_content": "The user wants to know what is in the workspace, so list it first...", "tool_trace": [ { "type": "tool_result", "id": "call_00_wYInMZ...", "name": "ls", "arguments": { "path": "." }, "result": "AGENT.md\nMEMORY.md\n...", "status": "success", "elapsed": "0.01s" } ] }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 18151, "completion_tokens": 180, "total_tokens": 18331, "prompt_tokens_details": { "cached_tokens": 11392 } } } ``` | Field | Description | | - | - | | `model` | The model that answered | | `message.content` | The final answer | | `message.reasoning_content` | The reasoning, when deep thinking is on and the model supports it | | `message.tool_trace` | CowAgent extension: the tool calls, each with its arguments, result, status and duration. Hand-offs to other Agents and generated files are recorded here too, in the format of the [process events](#process-events) below | | `usage` | Token usage. One Agent turn may call the model several times; this is the sum of all calls. `prompt_tokens_details.cached_tokens` counts input tokens served from cache. Left out when the model reports no usage | ### Streaming With `"stream": true` the response is a stream of standard `chat.completion.chunk` events over SSE: * The answer is in `choices[0].delta.content` * The reasoning is in `choices[0].delta.reasoning_content` * Process events such as tool calls are in the top-level `cow_event` field, with an empty `delta` * The last chunk has `finish_reason` set to `stop`. With `stream_options.include_usage`, one more chunk follows with empty `choices` and the `usage` * The stream ends with `data: [DONE]` ``` data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":null}]} data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{},"finish_reason":null}],"cow_event":{"type":"tool_start","id":"call_1","name":"ls","arguments":{"path":"."}}} data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"The workspace holds"},"finish_reason":null}]} data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]} data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[],"usage":{"prompt_tokens":18151,"completion_tokens":180,"total_tokens":18331,"prompt_tokens_details":{"cached_tokens":11392}}} data: [DONE] ``` Reading the stream: ```python theme={null} import json import requests resp = requests.post( "http://localhost:9899/v1/chat/completions", headers={"Authorization": "Bearer your-api-key"}, json={"messages": [{"role": "user", "content": "Summarize the files in the workspace"}], "stream": True}, stream=True, ) for line in resp.iter_lines(decode_unicode=True): if not line.startswith("data: ") or line == "data: [DONE]": continue chunk = json.loads(line[len("data: "):]) event = chunk.get("cow_event") if event and event["type"] == "tool_start": print(f"\n[tool] {event['name']} {event['arguments']}") for choice in chunk["choices"]: print(choice["delta"].get("content") or "", end="", flush=True) ``` ### Process events `cow_event.type` takes these values: | Type | Description | Main fields | | - | - | - | | `tool_start` | A tool call starts | `id`, `name`, `arguments` | | `tool_result` | A tool call finishes | `id`, `name`, `arguments`, `result`, `status`, `elapsed` | | `subagent_step` | A step taken by a sub-agent | `card_id`, `step_id`, `phase`, `tool`, `status` | | `peer_start` | The task is handed to another Agent; the content that follows is its answer | `card_id`, `agent_id`, `agent_name` | | `peer_end` | That Agent is done | `card_id`, `agent_id`, `status` | | `artifact` | A file the Agent produced | `artifact` | | `reasoning` | Reasoning, the same text as `delta.reasoning_content` | `delta` | | `error` | The run failed | `message` | ## Errors Errors follow the OpenAI format: ```json theme={null} { "error": { "message": "Invalid authentication credentials.", "type": "api_error", "code": "invalid_api_key" } } ``` | Status | `code` | Meaning | | - | - | - | | 400 | `invalid_request` / `invalid_json` | Malformed request | | 401 | `invalid_api_key` | Wrong API key | | 404 | `model_not_found` | `model` is not in the [model list](#list-models) | | 404 | `agent_not_found` | The Agent `agent_id` names does not exist or is archived | | 503 | `api_disabled` | The API is off | | 500 | `internal_error` / `timeout` | The Agent failed or timed out | A streaming request waits up to 30 seconds for the Agent to produce the first event. A failure or a timeout before the first event returns one of the JSON errors above, and a timeout cancels that request. Once the stream has started its HTTP status can no longer change, so a later failure arrives as a `cow_event.type=error` chunk, followed by a terminal chunk with `finish_reason=error` and then `data: [DONE]`. ## Use it from other apps Any client or platform that accepts a custom OpenAI endpoint can connect. Choose the "OpenAI" or "OpenAI compatible" provider and fill in: * **Base URL**: `http://:9899/v1` (some apps only want the address and port, and add `/v1` themselves) * **API key**: the key generated in the console * **Model**: pick one from the [model list](#list-models) The default Agent answers requests from these apps. The API allows cross-origin requests (CORS), so browser apps can call it directly. > [!NOTE] > > Only text input is supported for now; images and other multimodal content are not. Caller-supplied `tools` for function calling are not supported either: the Agent finishes the task with its own tools. # Custom Menu Source: https://docs.cowagent.ai/extensions/custom-menu Customize the sidebar in the web console and desktop app: reorder and group items, hide pages you rarely use, and pin agent-generated pages, documents or any URL to open them in one click. The sidebar menu can be arranged the way you work: reorder and group it, hide the pages you rarely use, and add web pages and documents the Agent created, or any URL, so they open in one click like a built-in page. The Web Console and the desktop client share one menu. ![Custom menu](https://cdn.jsdelivr.net/gh/zhayujie/cowagent-assets@main/screenshots/en/web-console-custom-menu.png) An ops dashboard maintained by the Agent, pinned to a Workbench group and opened right inside the console ## Edit the menu ### Open the editor There are three ways in: * Hover over a group title in the sidebar and click the edit icon that appears on its right * Click the version number at the bottom left of the sidebar (Web Console) or the "More" button (desktop client), then choose "Customize menu" * While previewing a web page or Markdown document on the Artifacts page, click "Add to menu" ![Menu editor](https://cdn.jsdelivr.net/gh/zhayujie/cowagent-assets@main/screenshots/en/web-console-custom-menu-config.png) The menu editor: drag to reorder and regroup, and add artifacts and web links Changes take effect once you click Save in the editor. ### Order and groups * Hold the drag handle on the left of an entry to move it, within its group or into another one * Click "Add group" to create a group; its title can be edited in place * Before removing a group, move the built-in pages it holds to another group ### Built-in pages Built-in pages such as Chat, Agents, Config and Capabilities can be: * **Renamed and given another icon**: an empty name falls back to the default one * **Hidden**: click the eye icon to hide or show the page. Chat and Config cannot be hidden, so the settings are always within reach * **Added back**: a removed built-in page can be restored from "Add → Built-in page" The Artifacts page starts hidden; show it in the editor when you need it. ### Restore default Click "Restore default" in the editor to go back to the built-in menu. The artifacts and links you added are removed. ## Add menu entries Besides built-in pages, the menu can hold artifacts and web links, each with its own name and icon. ### Artifacts Use "Add → Artifact (HTML / Markdown)" to search the web pages and Markdown documents the Agent created and put one in the menu. Clicking the entry opens it right inside the console, always at its latest version, which suits reports, dashboards and notes the Agent keeps up to date. If the file is deleted, the entry says so, and you can remove it in the editor. ### Web links Use "Add → Web link", enter a name and a URL starting with `http://` or `https://`, and choose how it opens: * **Embed**: inside the console, which suits internal tools and dashboards * **New tab**: in a new browser tab > [!TIP] > > Some sites refuse to be embedded in other pages and show up blank. Switch the entry to "New tab" instead. An embedded page also has an "Open in new tab" button at its top right. ## Menu file ### Location The menu is saved in `system/menu.json` under the default Agent's workspace (`~/cow/system/menu.json` for a source deployment), and both the Web Console and the desktop client read it. A page one client does not have is skipped there and kept in the menu for the other. ### Format The file can also be edited by hand in the format below. A file that cannot be parsed is ignored and the built-in menu is used. ```json theme={null} { "version": 1, "groups": [ { "id": "chat", "title": "", "items": [ { "id": "chat", "type": "builtin", "view": "chat", "title": "", "icon": "", "hidden": false }, { "id": "m_report", "type": "artifact", "title": "Weekly report", "icon": "chart", "path": "/Users/me/cow/websites/report.html" }, { "id": "m_board", "type": "url", "title": "Dashboard", "icon": "gauge", "url": "https://example.com/board", "open": "embed" } ] } ] } ``` | Type | Description | Fields | | - | - | - | | `builtin` | A built-in page | `view`: the page name; `hidden`: whether it is hidden | | `artifact` | An artifact | `path`: absolute path of the file, HTML or Markdown only | | `url` | A web link | `url`: the address; `open`: `embed` or `tab` | # Guest Pages Source: https://docs.cowagent.ai/extensions/guest-share Share an Agent as a standalone chat page, or embed it in your site as a chat window. Visitors just open the link, no sign-in needed. > Share an Agent as a standalone chat page, or embed it in your own site, for product questions, docs Q\&A, customer support and the like. Visitors open the link and start chatting, no sign-in needed. The Agent on a guest page is kept apart from the one you use every day. It only gets the tools, skills and references you open up for that page, and never sees your memory, chats or workspace. ## Turn it on Go to **Config → Integrations → Guest pages** and turn on the switch. * **Set a console password first.** Guest pages share the console's port, so their links stay offline until the console has a password, then go live on their own. * **The server must be reachable from outside.** See [Web Console](/channels/web) for deployment. If you serve it through a domain or a public IP, enter that address under **Public address** on the same page; share links and embed code will use it. ## Create a page Click **New guest page**, fill it in and save. The link is created right away. ### Basics Name, model, welcome message and suggested questions. Without a model picked, the page uses the global default. Suggested questions appear on the welcome screen for visitors to tap. ### Appearance Icon and theme color, used on the page and on the embedded chat button. ### Access * **Password**: visitors must enter it before chatting. * **Questions per visitor a day**: visitors are told apart by browser. Defaults to 100; 0 means no limit. * **Expires on**: the link stops working after this date. Leave empty to keep it open. ### More settings * **Tools**: reading and writing files, searching files, sending files, web search, fetching pages, vision and the current time. New pages get all of them. Guest pages cannot run commands. * **Skills**: pick from your installed skills. Skills that rely on commands or scripts can't work on a guest page and are left out of the list. * **References**: folders the Agent may look things up in, read-only. Pick your knowledge base or one of its categories, or enter any other folder. Each one can carry a short note, such as "product docs, for feature and pricing questions", so the Agent knows when to look there. * **Guest rules**: written into the Agent's system prompt. Use them to set who it is, what it helps with and how it replies. * **Footer**: the text and link at the bottom of the page. Edit or clear them. ## Share and embed Copy the link from the page list to share it. Links look like `https:///share/`. To embed the page in your site, click **Embed** on the page. Add your site (e.g. `https://example.com`) under **Sites allowed to embed**, then put the code in your page's ``. A chat button appears in the bottom-right corner, and the dialog shows a live preview. ```html theme={null} ``` Add `data-color` to change the button color, or `data-position="left"` to move it to the bottom-left corner. ## Manage pages * **Visitor logs**: read each visitor's conversations. * **Reset link**: issues a new link; the old link and embed code stop working at once. * **Sign out visitors**: everyone has to come in again (and re-enter the password, if the page has one). Earlier chats are no longer shown to them. * **Pause / Resume**: a paused page's link stops working for now, and replies in progress are stopped. * **Delete**: removes the page, its link and all visitor logs. This cannot be undone. ## Security * The guest Agent can only reach the current conversation's scratch folder and the references and skills you picked. It never sees real paths and cannot step outside these folders. * It cannot run commands. Network tools only reach the public internet; local and private network addresses are blocked. * Page settings live in `~/cow/guests//`, so you can also ask your own Agent to change them. Changes that widen access, such as adding tools or references, turning on the network or removing the password, only take effect after you click **Confirm** in the console. # Desktop Client Source: https://docs.cowagent.ai/guide/desktop Download and install the CowAgent desktop app for macOS (Apple Silicon and Intel) and Windows. It bundles the agent runtime, so no Python or dependencies are needed to run your AI assistant locally. CowAgent ships a ready-to-use desktop client with the Agent runtime bundled in — **no need to install Python or dependencies manually**. Just download, install, and run your local super AI assistant.