FastClaw 是一个高性能的 AI 智能体框架,支持多智能体协作、多渠道集成和全面的扩展特性。
FastClaw 实现了一个全面的智能体框架:
fastclaw/ ├── core/ # 核心框架 │ ├── gateway.py # WebSocket 网关 │ ├── agent.py # 智能体运行时和循环 │ ├── llm_client.py # LLM 客户端集成 │ ├── tools.py # 工具注册表 │ ├── multi_agent.py # 多智能体编排器 │ ├── workspace.py # 工作空间管理 │ ├── audit.py # 审计日志记录 │ ├── error_handler.py # 错误处理 │ ├── plugin.py # 插件系统 │ ├── cli.py # CLI 接口 │ ├── llm/ # LLM 适配器 │ │ ├── base.py │ │ ├── openai_adapter.py │ │ ├── anthropic_adapter.py │ │ └── ollama_adapter.py │ ├── mcp/ # MCP 协议 │ │ ├── manager.py │ │ └── protocol.py │ └── skills/ # 技能系统 │ ├── base.py │ ├── manager.py │ └── registry.py ├── adapters/ # 渠道适配器 │ ├── base.py │ ├── telegram.py │ ├── slack.py │ ├── discord.py │ ├── feishu.py │ ├── dingtalk.py │ ├── qq.py │ ├── wecom.py │ ├── whatsapp.py │ └── webhook.py ├── storage/ # 存储实现 │ ├── session_store.py │ └── memory_store.py ├── workspace/ # 智能体工作空间(Markdown 文件) │ ├── AGENTS.md │ ├── SOUL.md │ ├── TOOLS.md │ └── MEMORY.md ├── state/ # 运行时状态 │ ├── sessions/ │ └── memory/ ├── ui/ # Web 界面 │ └── index.html ├── main.py # 入口点 ├── config.yaml # 配置文件 ├── ARCHITECTURE.md # 架构文档 ├── ROADMAP.md # 项目路线图 └── requirements.txt # Python 依赖
# 创建虚拟环境
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# 安装依赖
pip install -r requirements.txt
# 设置环境变量
export DEEPSEEK_API_KEY="your_api_key_here"
export DEEPSEEK_BASE_URL="https://api.deepseek.com/v1"
# 启动服务器
python3 main.py
# 访问 Web 界面
在浏览器中打开 http://localhost:8000
POST /api/v1/chat - OpenAI 兼容的 HTTP APIWS /api/ws - 用于实时通信的 WebSocket 端点GET /api/v1/tools - 列出可用工具GET /api/v1/sessions - 列出活动会话GET / - Web 界面编辑 config.yaml 进行配置:
llm:
provider: "openai" # openai | anthropic | ollama
openai:
api_key: "${DEEPSEEK_API_KEY}"
base_url: "${DEEPSEEK_BASE_URL}"
model: "deepseek-chat"
agents:
- id: "coordinator"
role: "coordinator"
model: "deepseek-chat"
enabled: true
channels:
telegram:
enabled: false
bot_token: "${TELEGRAM_BOT_TOKEN}"
slack:
enabled: false
bot_token: "${SLACK_BOT_TOKEN}"
bash: 执行 Shell 命令(需批准)file_read: 读取文件内容file_write: 写入文件内容file_list: 列出目录内容calculator: 计算数学表达式memory_add: 添加到长期记忆memory_search: 搜索记忆# 列出所有 CLI 命令
python3 -m core.cli --help
# 使用特定配置启动智能体
python3 -m core.cli start --config config.yaml
# 列出可用工具
python3 -m core.cli tools list
# 运行测试查询
python3 -m core.cli query "你好,FastClaw!"
MIT 协议