CozeAgent

Coze Agent

langbot-team / CozeAgent
Plugin0 downloadsAgent Runner1

Run a Coze bot as a LangBot AgentRunner.

Coze Agent

Run a Coze bot as a LangBot AgentRunner.

Runner ID

plugin:langbot-team/CozeAgent/default

Configuration

FieldTypeRequiredDefaultDescription
api-keysecretyes''Coze API key
bot-idstringyes''Bot ID
api-baseselectyeshttps://api.coze.cnAPI base URL (CN or Global)
auto-save-historybooleannotrueAuto-save conversation history
timeoutnumberno120Request timeout (seconds)
langbot-assets-enabledbooleannofalseRegister a short-lived LangBot asset token for each run and pass it via custom_variables
langbot-assets-gateway-hoststringno0.0.0.0Host for the local LangBot Asset Gateway
langbot-assets-gateway-portintegerno8765Port for the local LangBot Asset Gateway
langbot-assets-gateway-request-timeoutintegerno60Timeout for individual gateway tool calls
langbot-assets-token-ttlintegerno3600Lifetime of each run token in seconds
langbot-assets-input-namestringnolangbot_asset_run_tokencustom_variables key that receives the run token

Capabilities

  • streaming: yes
  • multimodal_input: yes

LangBot Asset Callback Through Coze MCP

A Coze bot can call back into LangBot assets through the SDK Asset Gateway, the same mechanism the Dify runner uses. The gateway is a run-token-authorized MCP server (POST /mcp, JSON-RPC) exposing the run-authorized LangBot tools: langbot_list_assets, langbot_get_current_event, langbot_history_page, langbot_retrieve_knowledge, langbot_get_tool_detail, and langbot_call_tool.

How it works

  1. When langbot-assets-enabled is true, this runner registers a short-lived, run-scoped token before calling the bot and passes it through Coze custom_variables under the key langbot-assets-input-name (default langbot_asset_run_token).
  2. The bot prompt references it as {{langbot_asset_run_token}} and passes it as the run_token argument on every LangBot MCP tool call.
  3. The runner removes the token when the run ends. Tool calls without a valid token are rejected by the gateway.

The gateway accepts the token via an Authorization: Bearer header or via a run_token tool-call argument. Use the run_token argument approach here.

Configure Coze

  1. Add the LangBot Asset Gateway as an MCP plugin/tool on the bot, with a URL routing to the gateway /mcp (a public HTTPS URL for Coze Cloud).
  2. Declare a bot variable named langbot_asset_run_token (matching langbot-assets-input-name) so custom_variables can populate it.
  3. In the bot prompt, instruct it to pass {{langbot_asset_run_token}} as run_token on every LangBot MCP tool call, and to call langbot_list_assets first when it needs to discover the run's assets.

Configure LangBot

Select the Coze runner and set:

api-key = <Coze API key>
bot-id = <bot id>
api-base = https://api.coze.cn
langbot-assets-enabled = true
langbot-assets-gateway-host = 0.0.0.0
langbot-assets-gateway-port = 8765
langbot-assets-token-ttl = 3600
langbot-assets-input-name = langbot_asset_run_token

Limitations

  • Coze Cloud cannot reach localhost; use a public HTTPS URL for the gateway /mcp endpoint.
  • The run token is short-lived and run-scoped; the bot must complete its asset callbacks within the chat run.
  • The gateway exposes only the assets permitted by the current run: current event, history page, knowledge retrieval, tool detail, and tool call.
  • The bot must support attaching an external MCP tool and forwarding the custom_variables value into the tool call. Verify the tools/list handshake and end-to-end token passing in your bot before relying on it.

Legacy Runner

Migrated from coze-api in LangBot.

Use Coze Agent in Feishu/Lark bots, DingTalk bots, WeCom bots, WeChat bots, QQ bots, Slack bots, Discord bots, Telegram bots, LINE Bots, and Matrix Bots.

Host your bot on LangBot Cloud and connect this extension to the collaboration platforms your team already uses.

Open LangBot Cloud

Comments