内容
# cow-go
<p align="center">
<strong>CowAgent 的 Go 实现</strong> — 基于 Origin v2 与 eino ADK 的多渠道超级 AI 助理
</p>
<p align="center">
<a href="https://github.com/rhinewg/cow-go"><img src="https://img.shields.io/github/stars/rhinewg/cow-go?style=flat-square" alt="Stars"></a>
<a href="https://github.com/rhinewg/cow-go/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="License: MIT"></a>
<a href="https://github.com/zhayujie/CowAgent"><img src="https://img.shields.io/badge/upstream-CowAgent-blue?style=flat-square" alt="CowAgent"></a>
<a href="https://github.com/cloudwego/eino"><img src="https://img.shields.io/badge/agent-eino%20ADK-00ADD8?style=flat-square" alt="eino"></a>
</p>
<p align="center">
<a href="https://github.com/rhinewg/cow-go">GitHub</a> ·
<a href="doc/README.md">文档</a> ·
<a href="https://docs.cowagent.ai/">CowAgent 文档</a> ·
<a href="doc/gap-analysis.md">功能差距</a>
</p>
---
**cow-go** 是开源 [CowAgent](https://github.com/zhayujie/CowAgent) 的 Go 语言重写(基于 CowAgent 的产品与架构设计,遵循 **MIT** 许可证)。在单进程内运行多个 Origin Service,通过 RPC 连接 Agent 核心、工具、记忆、知识库与 14+ 消息渠道,支持流式对话、MCP 工具、Skills 与自进化(Evolution)。
适合需要 **Go 性能、服务化边界、Origin 跨节点 RPC** 的二次开发与平台化部署;完整产品体验与生态仍以 Python 版 CowAgent 为参考。
---
## 特性
| 能力 | 说明 |
|------|------|
| **多渠道** | Web、飞书、钉钉、企微、微信、Telegram、Slack、Discord、QQ 等 |
| **Agent 核心** | eino ADK:多轮 tool-call、LLM 路由(OpenAI / Claude / Gemini / Qwen / DeepSeek 等) |
| **工具** | 文件、终端、浏览器、调度、网页抓取、MCP 协议 |
| **记忆与知识** | 向量记忆(Redis)、知识库 RAG、会话持久化(Redis + SQLite) |
| **自进化** | 空闲扫描、审查 Agent、工作区备份与回滚 |
| **流式 RPC** | `RPC_RunStream`、Bridge SSE、统一取消与 `request_id` |
| **控制台** | 嵌入式 Web UI(`http://localhost:8081/console/`) |
| **进程管理** | `cow-go start / stop / status / logs / update` |
功能覆盖率约 **82–85%**(相对 Python CowAgent),详见 [doc/gap-analysis.md](doc/gap-analysis.md)。
---
## 架构
```
┌─────────────────────────────────────────────────────────┐
│ Channel Services (Web / 飞书 / 钉钉 / Telegram …) │
└────────────────────────┬────────────────────────────────┘
│ ChannelMessage
┌────────────────────────▼────────────────────────────────┐
│ BridgeService — RPC_Chat / ChatStream (流式 RPC) │
└────────────────────────┬────────────────────────────────┘
│
┌────────────────────────▼────────────────────────────────┐
│ AgentService — eino Runner · MCP · Skills · SSE │
└───┬────────────┬────────────┬────────────┬──────────────┘
│ │ │ │
ToolService MemoryService SessionService EvolutionService …
```
- **框架**:[Origin v2](https://github.com/duanhf2012/origin)(`node` + `service.Service` + RPC)
- **详细设计**:[doc/cowagent-go-design.md](doc/cowagent-go-design.md) · [doc/README.md](doc/README.md)
---
## 快速开始
### 环境要求
- Go **1.26+**
- Redis(会话 / 记忆,按配置可选)
- LLM API Key(在 `config/agentservice.json` 等中配置)
### 构建
```bash
git clone https://github.com/rhinewg/cow-go.git
cd cow-go
go build -o cow-go .
```
### 配置
1. 参考 [config/README.md](config/README.md) 准备 `config/cluster.json` 与各 `*service.json`
2. 填写 `agentservice.json` 中的 `api_key`、`model` 等(**勿提交含密钥的文件**)
3. 可选:在 `config/skills/`、`config/prompts/system.md` 自定义技能与系统提示词
### 运行
```bash
./cow-go # 前台
./cow-go start # 后台(写入 PID 文件)
```
| 入口 | 地址 |
|------|------|
| 管理控制台 | http://localhost:8081/console/ |
| Agent API | http://localhost:8081/api/v1/ |
| Origin RPC | 127.0.0.1:8801(默认) |
### 验证
```bash
go test ./... -count=1
```
---
## 文档
| 文档 | 说明 |
|------|------|
| **[doc/README.md](doc/README.md)** | **文档总索引**(架构、模块、开发指南) |
| [doc/cowagent-go-design.md](doc/cowagent-go-design.md) | Python → Go 设计对照 |
| [doc/gap-analysis.md](doc/gap-analysis.md) | 功能差距与优先级 |
| [doc/rpc-stream/](doc/rpc-stream/) | 流式 RPC 设计与实现 |
| [config/README.md](config/README.md) | 配置文件说明 |
---
## 技术栈
| 类别 | 技术 |
|------|------|
| 服务框架 | Origin v2 |
| Agent | CloudWeGo eino ADK |
| HTTP | Gin(origin ginmodule) |
| MCP | modelcontextprotocol/go-sdk |
| 存储 | Redis、SQLite |
| 前端控制台 | Vue 3 + Vite |
---
## 与 CowAgent (Python) 如何选择
| 选 **CowAgent** | 选 **cow-go** |
|-----------------|---------------|
| 开箱即用、Docker、Skill Hub | Go 单体二进制、Origin RPC |
| 功能最全、文档与社区成熟 | 服务边界清晰、流式 RPC、易扩展节点 |
| 个人助理默认首选 | 同 monorepo 二次开发 / 平台集成 |
---
## 相关项目
- [CowAgent](https://github.com/zhayujie/CowAgent) — Python 主实现
- [Origin](https://github.com/duanhf2012/origin) — 分布式 Go 服务框架
- [eino](https://github.com/cloudwego/eino) — LLM 应用开发框架
- [eino-ext](https://github.com/cloudwego/eino-ext) — eino 扩展组件(模型、MCP、Embedding 等)
---
## 致谢
cow-go 建立在以下开源项目之上,衷心感谢各项目作者与社区贡献者:
| 项目 | 在本仓库中的角色 | 致谢 |
|------|------------------|------|
| [**Origin v2**](https://github.com/duanhf2012/origin) | 服务框架:`node`、`service.Service`、RPC 与流式 RPC | 感谢 [duanhf2012](https://github.com/duanhf2012) 及全体 Origin 贡献者 |
| [**eino**](https://github.com/cloudwego/eino) | Agent 引擎:ADK、`Runner`、工具与中间件 | 感谢 [CloudWeGo](https://github.com/cloudwego) 团队及 eino 社区贡献者 |
| [**eino-ext**](https://github.com/cloudwego/eino-ext) | 扩展能力:OpenAI / Claude / Gemini / Qwen 等模型适配、MCP 工具、DashScope Embedding、Redis 检索与索引 | 感谢 eino-ext 各模块维护者与贡献者 |
没有上述项目的持续维护与开放,cow-go 的服务化架构与 Agent 能力无法实现。若你在使用中发现问题,也欢迎向上游项目反馈或参与贡献。
---
## 许可
本项目基于 [CowAgent](https://github.com/zhayujie/CowAgent) 的 Go 重写实现,采用与 CowAgent 相同的 **[MIT License](LICENSE)**。
- cow-go 版权:Copyright (c) 2026 rhinewg
- 上游 CowAgent:Copyright (c) 2022 zhayujie([MIT](https://github.com/zhayujie/CowAgent/blob/master/LICENSE))
使用、修改与分发时请保留本仓库 `LICENSE` 中的版权与许可声明。
## 贡献
欢迎 Issue 与 Pull Request。开发前请阅读 [doc/README.md](doc/README.md) 中的贡献指引与测试说明。