- 多提供商支持 - 兼容 Anthropic、OpenAI、DeepSeek、Gemini、Groq、智谱等
- 多渠道接入 - CLI、QQ 机器人,可扩展的渠道系统
- MCP 集成 - 支持模型上下文协议工具
- 人工干预控制 - 可配置的工具调用人工审批
- 技能系统 - 组织和管理 Agent 能力
- 定时任务 - Cron 定时任务支持
- 网页工具 - 内置网页搜索和抓取功能
- 工作区管理 - 隔离文件访问,可配置安全级别
# 克隆仓库
git clone https://github.com/77z-zhou/langbot.git
cd langbot
# 使用 uv 安装(推荐)
uv sync
# 或使用 pip
pip install -e .初始化工作区和配置文件:
langbot onboard这将创建:
~/.langbot/config.json- 配置文件~/.langbot/workspace/- 工作区目录(包含模板)~/.langbot/skills/- 技能目录
编辑 ~/.langbot/config.json 添加你的 API Key:
{
"agents": {
"defaults": {
"model": "deepseek-chat",
"provider": "deepseek"
}
},
"providers": {
"deepseek": {
"apiKey": "your-api-key-here"
}
}
}启动交互式聊天:
langbot agent发送单条消息:
langbot agent -m "你好,请帮我写个排序算法"启动网关服务(用于机器人):
langbot gateway工作区目录包含重要的配置文件:
| 文件 | 说明 |
|---|---|
SOUL.md |
Agent 性格和行为设定 |
USER.md |
自定义用户指令 |
MEMORY.md |
持久学习数据(Agent 可编辑) |
支持的提供商:
{
"providers": {
"anthropic": { "apiKey": "sk-ant-..." },
"openai": { "apiKey": "sk-..." },
"deepseek": { "apiKey": "sk-..." },
"gemini": { "apiKey": "..." },
"groq": { "apiKey": "gsk_..." },
"zhipu": { "apiKey": "..." },
"ollama": { "apiBase": "http://localhost:11434" }
}
}配置工具调用审批行为:
{
"agents": {
"defaults": {
"hitl": {
"mode": "custom",
"tools": {
"execute": true,
"write_file": true,
"read_file": false
},
"exclude": ["ls", "glob"]
}
}
}
}模式说明:
all- 所有工具都需要审批none- 无需审批custom- 按工具单独配置
{
"channels": {
"sendProgress": true,
"sendToolHints": true,
"qq": {
"enabled": true,
"token": "your-qq-bot-token"
}
}
}| 命令 | 说明 |
|---|---|
langbot onboard |
初始化工作区和配置 |
langbot agent |
启动交互式聊天 |
langbot agent -m "消息" |
发送单条消息 |
langbot gateway |
启动网关服务 |
langbot status |
显示配置状态 |
langbot/
├── agent/ # Agent 工厂和工具
├── bus/ # 渠道通信消息总线
├── channels/ # 聊天渠道实现
├── cli/ # 命令行界面
├── config/ # 配置模式和加载
├── cron/ # 定时任务服务
├── providers/ # LLM 提供商注册
├── skills/ # 技能管理系统
├── store/ # 检查点和存储
└── utils/ # 工具函数
pytest# 格式化代码
ruff format .
# 代码检查
ruff check .渠道通过入口点发现。创建一个继承 BaseChannel 的类:
from langbot.channels.base import BaseChannel
class MyChannel(BaseChannel):
def default_config(self) -> dict:
return {"enabled": False}在 pyproject.toml 中注册:
[project.entry-points."langbot.channels"]
mychannel = "myapp.mychannel:MyChannel"MIT License - 详见 LICENSE