langbot-plugin-dev
Skill này làm gì
Skill này hướng dẫn một agent AI viết và sửa plugin cho LangBot, một nền tảng bot. Dành cho lập trình viên mở rộng LangBot với các tính năng mới.
Khi nào nên dùng
- ✓Khi bạn muốn tạo một plugin LangBot mới với lệnh, bộ lắng nghe sự kiện hoặc công cụ.
- ✓Khi một plugin LangBot có lỗi cần được sửa và kiểm thử.
- ✓Khi bạn muốn kiểm thử một plugin với một instance LangBot đang chạy.
Liên kết skill
https://github.com/langbot-app/LangBot/blob/master/skills/skills/langbot-plugin-dev/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Tôi muốn xây một plugin LangBot thêm một lệnh để tóm tắt tin nhắn trò chuyện.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent làm theo bố cục plugin với một manifest, một tệp chính và các tệp thành phần cho bộ lắng nghe, lệnh và công cụ. Sau đó nó kiểm thử plugin bằng các kiểm tra WebSocket tự động.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
Câu hỏi thường gặp
Những phần nào tạo nên một plugin LangBot?
Một plugin có tệp manifest, một tệp chính, và các thư mục cho bộ lắng nghe sự kiện, lệnh và công cụ. Mỗi thành phần có một tệp cài đặt và một tệp mã.
Agent có thể kiểm thử plugin mà không cần giao diện web không?
Có. Skill mô tả các kiểm thử tự động dựa trên WebSocket, chạy trên một instance đang hoạt động.
Agent có thể quản lý instance đang chạy không?
Có. Skill trỏ tới skill vận hành MCP của LangBot để điều khiển instance đang hoạt động.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 19k
- Vị trí xếp hạng
- #10512
- Giấy phép
- Apache-2.0
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
langbot-deploy
19kGiúp agent của bạn triển khai và cấu hình một instance LangBot tự lưu trữ bằng Docker, Compose hoặc Kubernetes, kèm cài đặt mô hình và khóa API.
langbot-env-setup
19kGiúp agent của bạn chạy môi trường kiểm thử LangBot cục bộ, gồm kiểm tra khởi động, cài đặt proxy và trình duyệt giữ đăng nhập.
langbot-mcp-ops
19kCho phép agent của bạn quản lý instance LangBot qua máy chủ MCP tích hợp sẵn, xử lý bot, pipeline, mô hình và cơ sở tri thức mà không cần gọi web thô.
langbot-space-ops
19kCho phép agent của bạn tìm plugin, máy chủ MCP và skill trên chợ LangBot Space, và lấy danh sách mô hình được xếp hạng để thiết lập.
Skill tương tự
api-connector-builder
280kGiúp agent của bạn xây dựng kết nối API mới theo đúng mẫu đã có, dùng khi bạn cần thêm một tích hợp mà không tạo cách làm mới.
api-design
280kGiúp agent của bạn thiết kế REST API theo các thực hành tốt nhất, hữu ích để định nghĩa cách API giao tiếp, hiển thị lỗi và tổ chức dữ liệu.
backend-patterns
280kGiúp agent của bạn với các mẫu kiến trúc phía máy chủ và tối ưu cơ sở dữ liệu, hữu ích khi xây dựng hoặc rà soát code chạy trên máy chủ.