langbot-plugin-dev
它能做什么
这个技能指导 AI 智能体为 LangBot(一个机器人平台)编写和修复插件。适合用新功能扩展 LangBot 的开发者。
适用场景
- ✓当你想创建一个带有命令、事件监听器或工具的新 LangBot 插件时。
- ✓当某个 LangBot 插件有需要修复和测试的错误时。
- ✓当你想对运行中的 LangBot 实例测试插件时。
技能链接
https://github.com/langbot-app/LangBot/blob/master/skills/skills/langbot-plugin-dev/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我想构建一个 LangBot 插件,添加一个用于总结聊天消息的命令。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会遵循插件的目录结构,包括清单文件、主文件,以及用于监听器、命令和工具的组件文件。然后它会通过自动化的 WebSocket 检查来测试插件。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
LangBot Plugin Development & Debugging
Controlling a running instance via MCP
Beyond writing code, you can drive a live LangBot instance over MCP — no raw
HTTP needed. Two MCP servers exist (both reuse existing API keys; see AGENTS.md):
- LangBot instance —
http://<host>:5300/mcp(auth: web-UIlbk_key or theapi.global_api_keyfromconfig.yaml). Manage bots, pipelines, models, knowledge bases, and skills. See thelangbot-mcp-opsskill. - LangBot Space marketplace —
https://space.langbot.app/mcp(auth: Personal Access Token). Search plugins / MCP servers / skills. See thelangbot-space-opsskill.
Any change to an agent-accessible HTTP API endpoint must keep the matching MCP tool and these skills in sync.
Plugin Architecture
A LangBot plugin consists of:
MyPlugin/
├── manifest.yaml # Plugin metadata, config schema
├── main.py # BasePlugin subclass (entry point, shared state)
├── components/
│ ├── event_listener/ # Hook pipeline events
│ │ ├── collector.yaml
│ │ └── collector.py
│ ├── commands/ # !command handlers
│ │ ├── mycommand.yaml
│ │ └── mycommand.py
│ └── tools/ # LLM function-call tools
│ ├── mytool.yaml
│ └── mytool.py
Each component has a .yaml (metadata) and .py (implementation).
README & i18n convention (enforced on the marketplace)
A plugin published to LangBot Space serves a localized README on its detail page.
The resolver (langbot-space PluginService.GetPluginREADME) works like this:
- Root
README.mdMUST be in English. It is the default and the fallback — when no per-language README matches the viewer's locale, the page serves the rootREADME.md. A non-English root README makes the English/default view show the wrong language. - All other languages live under
readme/README_{lang}.md— e.g.readme/README_zh_Hans.md,readme/README_ja_JP.md. The 8 supported locales:en_US, zh_Hans, zh_Hant, ja_JP, th_TH, vi_VN, es_ES, ru_RU. manifest.yamlmetadata.label/metadata.descriptionshould carry the same 8-locale i18n set (repositorymust be a real, alive URL).
MyPlugin/
├── manifest.yaml
├── README.md # English (default + fallback) — REQUIRED, must be English
└── readme/
├── README_zh_Hans.md
├── README_zh_Hant.md
├── README_ja_JP.md
├── README_th_TH.md
├── README_vi_VN.md
├── README_es_ES.md
└── README_ru_RU.md
manifest.yaml (incl. repository) is the source of truth — the marketplace
syncs from it, so edit the package and re-publish rather than patching live data.
Critical SDK Pitfalls
1. MessageChain is a RootModel — iterate directly
# ❌ WRONG — MessageChain has no .components attribute
for component in event.message_chain.components:
# ✅ CORRECT — MessageChain is a Pydantic RootModel, iterate directly
for component in event.message_chain:
2. Message.content must be list[ContentElement] or str, not a single ContentElement
from langbot_plugin.api.entities.builtin.provider import message as provider_message
# ❌ WRONG — single ContentElement
Message(role="user", content=ContentElement.from_text("hello"))
# ✅ CORRECT — list of ContentElement
Message(role="user", content=[ContentElement.from_text("hello")])
# ✅ ALSO CORRECT — plain string
Message(role="user", content="hello")
3. invoke_llm does NOT accept timeout
# ❌ WRONG
await self.invoke_llm(llm_model_uuid=uuid, messages=msgs, timeout=60)
# ✅ CORRECT
await self.invoke_llm(llm_model_uuid=uuid, messages=msgs)
4. invoke_llm response.content can be str OR list
response = await self.invoke_llm(...)
if response.content:
if isinstance(response.content, str):
return response.content
elif isinstance(response.content, list):
parts = [e.text for e in response.content if hasattr(e, "text") and e.text]
return "\n".join(parts)
5. get_llm_models() returns UUIDs
# Returns list[str] of model UUIDs
models = await self.get_llm_models()
model_uuid = models[0] # First available model UUID
Known bug (v4.9.3): The host handler may return list[dict] instead of list[str]. If you hit TypeError: unhashable type: 'dict' in invoke_llm, the fix is in LangBot/src/langbot/pkg/plugin/handler.py — change 'llm_models': llm_models to `'llm_models': [m['uuid'] for m in ll
常见问题
LangBot 插件由哪些部分组成?
插件包含一个清单文件、一个主文件,以及用于事件监听器、命令和工具的文件夹。每个组件都有一个设置文件和一个代码文件。
智能体能不通过网页界面测试插件吗?
可以。该技能说明了基于 WebSocket 的自动化测试,这些测试会针对运行中的实例执行。
智能体也能管理正在运行的实例吗?
可以。该技能指向用于控制运行中实例的 LangBot MCP 操作技能。
详情
作者的原始描述
Develop, debug, and test LangBot plugins. Use when creating new LangBot plugins, fixing plugin bugs, setting up a LangBot test environment, or testing plugins via WebSocket. Covers plugin component architecture (EventListener, Command, Tool), the plugin SDK API (invoke_llm, get_llm_models, send_message, plugin storage), common pitfalls, and automated WebSocket-based testing. Triggers on "langbot plugin", "lbp", "GroupChatSummary", "plugin debug", "langbot test".
repo: langbot-app/LangBot
热度
- GitHub 星标
- 19k
- 排名
- #10512
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
langbot-deploy
19k帮你的智能体使用 Docker、Compose 或 Kubernetes 部署并配置自托管的 LangBot 实例,包括其模型和 API 密钥设置。
langbot-env-setup
19k帮你的智能体在本地运行 LangBot 测试环境,包括启动检查、代理设置,以及保持登录状态的浏览器。
langbot-mcp-ops
19k让你的智能体通过 LangBot 内置的 MCP 服务器管理实例,处理机器人、流水线、模型和知识库,无需原始网页调用。
langbot-space-ops
19k让你的智能体在 LangBot Space 市场中搜索插件、MCP 服务器和技能,并获得用于设置的排序模型列表。