Skip to content

sadpig/EntClaw

Repository files navigation

🐾 EntClaw — 企业AI Agent平台

面向中型企业(100-500人)的多AI Agent协作平台。

项目状态

Phase 1-19 全部完成 | 296 个单元测试通过 | 14 个AI模型 | 4 个MCP连接器

快速开始

# 1. 初始化环境
make setup          # 或 bash scripts/dev_setup.sh

# 2. 编辑 .env,填入AI模型API Key
vim .env

# 3. 启动服务
make up             # docker compose up -d

# 4. 初始化数据库和演示数据
make migrate
make seed

# 5. 验证
make test-unit      # 296 个单元测试

访问地址

服务 地址
前端 (React) http://localhost/
API文档 — FastAPI (Swagger) http://localhost/agent/v1/docs
API文档 — Django (DRF Spectacular) http://localhost/api/docs/
Django Admin http://localhost/admin/
RabbitMQ管理 http://localhost:15672

默认管理员: admin / admin123456

架构

┌─────────────────────────────────────────────────────────────┐
│                      Nginx (:80/443)                        │
├──────────────────────┬──────────────────────────────────────┤
│  Control Plane       │  Agent Runtime                       │
│  Django :8000        │  FastAPI :8001                       │
│  ─────────────────   │  ─────────────────                   │
│  用户/Agent管理      │  Chat SSE 流式对话                    │
│  模型管理/路由       │  Tasks 异步任务                      │
│  Skills市场         │  Memory RAG 2.0+                     │
│  工作流引擎         │  Collaborate 多Agent协作              │
│  监控中心           │  Workspace 文件系统                   │
│  RBAC权限           │  Webhooks 渠道回调                    │
├──────────────────────┴──────────────────────────────────────┤
│  Channel Abstraction Layer (渠道抽象层)                      │
│  [钉钉Adapter] [企微Adapter] [飞书Adapter]                   │
│  InboundPipeline → CommandRegistry → TemplateEngine         │
├─────────────────────────────────────────────────────────────┤
│  Integration Layer (MCP Connectors)                         │
│  [Salesforce] [钉钉] [企微] [飞书]                           │
├──────────┬──────────┬──────────┬────────────────────────────┤
│PostgreSQL│  Redis   │ RabbitMQ │  Celery Worker×2 + Beat    │
│  :5432   │  :6379   │  :5672   │                            │
└──────────┴──────────┴──────────┴────────────────────────────┘

核心能力

能力 说明
多Agent协作 Supervisor-Specialist-Worker 三层架构 + 对等式讨论 + 工作流编排
智能模型路由 14个模型(7提供商),按敏感度/复杂度/预算自动选择,故障自动切换
RAG 2.0+ 记忆 三层记忆(Redis/Pinecone/JSONL)+ IngestAgent + ConsolidateAgent
MCP 零侵入集成 Salesforce + 钉钉 + 企微 + 飞书,标准化连接器
多渠道消息 渠道抽象层 + 指令系统(/help /switch /status) + 富文本模板
治理安全 RBAC四角色 + Kill Switch三级 + 审计日志 + 信任等级L1-L4 + 内容过滤
OpenClaw Workspace 标准9文件体系(SOUL/IDENTITY/AGENTS/USER/MEMORY/HEARTBEAT/TOOLS/BOOTSTRAP + MODEL_CONFIG)

AI 模型支持

提供商 模型 层级
DashScope (通义千问) qwen-max / qwen-plus / qwen-turbo primary / primary / fast
智谱AI glm-4 primary
OpenAI gpt-4o / gpt-4o-mini primary / fast
Anthropic claude-sonnet-4 primary
Ollama (本地) qwen-72b-local local
百度文心 ernie-4.0-turbo / ernie-speed primary / fast
月之暗面 moonshot-v1-128k / moonshot-v1-8k primary / fast
DeepSeek deepseek-chat / deepseek-reasoner primary / primary

API 概览

端点 方法 说明
/api/v1/auth/token/ POST JWT 登录
/api/v1/agents/ GET/POST Agent CRUD
/api/v1/agents/{id}/kill/ POST Kill Switch
/api/v1/agents/{id}/channel-bindings/ GET/POST 渠道绑定管理
/api/v1/models/ GET/POST 模型管理
/api/v1/models/routing-rules/ GET/PUT 路由规则
/api/v1/workflows/ GET/POST 工作流管理
/api/v1/skills/ GET/POST Skills 市场
/api/v1/monitoring/dashboard/ GET 监控面板
/agent/v1/chat/ POST Agent 对话 (SSE)
/agent/v1/tasks/ POST 异步任务
/agent/v1/collaborate/ POST 多Agent协作
/agent/v1/memory/query/ POST 记忆检索 (RAG)
/agent/v1/workspace/tree/{id} GET Workspace 目录树
/v1/webhooks/{channel_type}/ POST 渠道 Webhook 回调

测试

# 单元测试(296个,不需要Docker)
make test-unit

# 或手动运行
PYTHONPATH="." python3 -m pytest agent_runtime/core/tests/ agent_runtime/api/tests/ \
  agent_runtime/channels/test_*.py shared/tests/ -v --tb=short

# 离线性能基准
PYTHONPATH="." python3 scripts/benchmark_offline.py

# Locust 压测(需要Docker服务运行)
locust -f scripts/locustfile.py --host=http://localhost

项目文档

详细文档位于 docs/ 目录,按角色和场景组织:

目录 内容 面向
docs/01-solution/ 解决方案 & SA交付物 客户/决策层
docs/02-design/ 平台设计文档 开发团队
docs/03-development/ 开发计划 + 功能Spec汇总 开发团队
docs/04-api/ API 参考文档 开发/对接
docs/05-deployment/ 部署运维指南 运维/开发
docs/06-features/ 功能模块说明 全员

详见 docs/README.md

技术栈

  • 后端: Python 3.12 / Django 4.2 / FastAPI / Celery / Redis / PostgreSQL / RabbitMQ
  • 前端: React / Vite / TypeScript / Ant Design
  • AI: OpenAI / Anthropic / DashScope / 智谱 / 百度文心 / Moonshot / DeepSeek / Ollama
  • 部署: Docker Compose / Nginx / Gunicorn / Uvicorn

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors