opc-agent 4.1.16 → 4.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,933 +1,290 @@
1
- <div align="center">
2
-
3
- # ⚡ OPC Agent
4
-
5
- ### The Self-Evolving Agent Runtime自进化 Agent 运行时
6
-
7
- [![npm version](https://img.shields.io/badge/npm-v4.0.0-blue)](https://www.npmjs.com/package/opc-agent)
8
- [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/Deepleaper/opc-agent/blob/main/LICENSE)
9
- [![Tests](https://img.shields.io/badge/tests-1024%2B_passing-brightgreen)]()
10
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.7-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
11
- [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D18-339933?logo=node.js&logoColor=white)](https://nodejs.org/)
12
-
13
- **The Self-Evolving Agent Stack 的运行引擎 — 让每个 Agent 都能学习、记忆、进化。**
14
-
15
- OPC Agent 是自进化 Agent 技术栈中的 **Agent Runtime**:从 `opc init` 创建,到 `opc chat` 对话,到 `opc studio` 可视化管理。<br>内置 learn → recall → evolve 闭环,让 Agent **越用越聪明**——不是每次从零开始,而是持续积累和进化。<br>开发者使用路径:① 选模板 (Agent Templates) → ② 接模型 (Agent Model Layer) → ③ **跑起来 (Agent Runtime)** → ④ 自动进化 (Agent Memory)。
16
-
17
- [快速开始](#-快速开始) · [🧬 自进化](#-自进化-self-evolution) · [核心特性](#-核心特性) · [代码示例](#-代码示例) · [CLI 参考](#-cli-参考) · [English](#-english-version)
18
-
19
- </div>
20
-
21
- ---
22
-
23
- ## 🚀 快速开始
24
-
25
- ### 一键安装 / One-Line Install
26
-
27
- **macOS / Linux:**
28
- ```bash
29
- curl -fsSL https://raw.githubusercontent.com/Deepleaper/opc-agent/main/install.sh | bash
30
- ```
31
-
32
- **Windows (PowerShell):**
33
- ```powershell
34
- irm https://raw.githubusercontent.com/Deepleaper/opc-agent/main/install.ps1 | iex
35
- ```
36
-
37
- > 脚本会自动安装 Node.js、OPC Agent,可选安装 Ollama 本地模型。支持 `--yes` 跳过确认,`--no-ollama` 跳过 Ollama。
38
-
39
- ### 手动安装 / Manual Install
40
-
41
- ```bash
42
- npm install -g opc-agent
43
- opc init my-agent --role customer-service
44
- cd my-agent && npm install
45
- opc chat
46
- ```
47
-
48
- ```
49
- 🤖 客服专员已就绪
50
-
51
- You: 我的订单 #12345 什么时候发货?
52
- Agent: 您好!订单 #12345 已于今天上午发出,预计 3 天内送达。需要我帮您查看物流详情吗?
53
-
54
- You: 上次你帮我查的那个订单呢?
55
- Agent: 您上次查询的订单 #12300 已签收,签收时间是 4 15 日下午 2 点。
56
- 记忆自动召回,无需重复说明
57
- ```
58
-
59
- > Agent 自动记住每次对话、沉淀专业知识、进化应答策略。这不是 demo,这是默认行为。
60
-
61
- ---
62
-
63
- ## ✨ 核心特性
64
-
65
- | | 特性 | 说明 |
66
- |---|---|---|
67
- | 🧬 | **自进化 (Self-Evolution)** | learn recall evolve 闭环,Agent 越用越聪明,知识自动积累和提炼 |
68
- | 🧠 | **记忆进化** | 内置 DeepBrain,知识自动沉淀、聚类、去重、精炼 |
69
- | 🔧 | **20+ CLI 命令** | init / chat / run / start / studio / doctor / eval / traces / publish |
70
- | 📡 | **25 种 Channel** | Telegram / Discord / Slack / WeChat / Feishu / Email / Web / WebSocket / Voice / Webhook / API / WhatsApp / LINE / Teams / SMS / DingTalk / Twitter / Instagram / Facebook / Signal / Matrix / XMPP / IRC / Twilio / Custom |
71
- | 🔌 | **三大协议** | Google A2A + AG-UI + MCP(Server & Client) |
72
- | 🎨 | **OPC Studio** | 可视化管理后台,一条命令 `opc studio` 启动 |
73
- | 📊 | **OpenTelemetry** | 全链路追踪 + p50 / p95 / p99 延迟指标 |
74
- | 🧪 | **内置评估** | `opc eval` 运行 24 个评估用例,量化 Agent 质量 |
75
- | 🔍 | **RAG Pipeline** | 5 种分块策略 + 4 种重排序(通过 DeepBrain) |
76
- | 📦 | **打包分发** | `opc publish` 一键发布到 npm |
77
- | 🏭 | **角色模板** | 100+ 专业角色,`opc init --role` 秒级创建 |
78
- | 🔒 | **安全全家桶** | 命令审批 + API Key 加密 + 文件/网络限制 + 沙箱隔离 |
79
- | 🤖 | **子 Agent** | spawn / parallel / kill 多 Agent 协作 |
80
- | 🌐 | **浏览器自动化** | Playwright 集成,网页交互、截图、数据抓取 |
81
- | 👁️ | **Vision** | 多模态图像理解,截图分析、文档识别 |
82
- | 🎙️ | **语音通话** | 实时语音对话,支持 TTS + STT |
83
- | 🏠 | **Home Assistant** | 智能家居集成,控制 IoT 设备 |
84
- | 💻 | **IDE Bridge** | VS Code / Cursor 深度集成 |
85
- | 🔗 | **Node Network** | 多节点网络,Agent 跨设备协作 |
86
- | 🚪 | **Gateway** | 统一网关,安全路由 + 负载均衡 |
87
- | 🗜️ | **Context 压缩** | 智能上下文压缩,长对话不丢关键信息 |
88
- | 🌐 | **API Server** | REST API 服务,外部系统集成 |
89
- | 📎 | **@引用** | @mention 引用其他 Agent 或资源 |
90
- | 📋 | **Session Manager** | 会话管理,多会话并行、历史回溯 |
91
- | 🎯 | **RL(强化学习)** | 基于反馈的策略优化 |
92
-
93
- ---
94
-
95
- ## 🧬 自进化 (Self-Evolution)
96
-
97
- **OPC 的核心卖点——自进化,这是跟所有其他 Agent 框架的根本区别。**
98
-
99
- 别人的 Agent 是静态的——用完就忘,换个人接手一切归零。我们的 Agent 会学习、会记忆、会进化。
100
-
101
- ### 1. 你搭建的每个 Agent 都会自进化
102
-
103
- 通过 learn → recall → evolve 闭环,Agent 自动积累知识,越用越聪明:
104
-
105
- ```
106
- ┌──────────────────────────────────────────────────────┐
107
- │ │
108
- │ 📥 learn 🔍 recall 🧬 evolve │
109
- │ 每次交互后 需要时自动 定期自动提炼 │
110
- │ 存储经验 检索相关记忆 知识越来越精 │
111
- │ │
112
- │ Day 1: "这个问题我没见过" │
113
- │ Day 7: "类似问题上次这样解决的" │
114
- │ Day 30: "这类问题的最佳方案是..." │
115
- │ │
116
- └──────────────────────────────────────────────────────┘
117
- ```
118
-
119
- **具体例子**:一个客服 Agent——
120
- - **第 1 天**:只能照着 prompt 回答,遇到没见过的问题需要人工介入
121
- - **第 7 天**:自动积累了 200+ 条对话经验,`evolve()` 提炼出 15 条产品知识
122
- - **第 30 天**:知识库精炼为 5 条核心洞察 + 50 条常见问题最佳回答,准确率从 60% 提升到 95%
123
-
124
- ```typescript
125
- import { AgentRuntime } from 'opc-agent';
126
-
127
- const runtime = new AgentRuntime('./agent.yaml');
128
- await runtime.start();
129
-
130
- // 不需要你做任何事——Agent 每次对话自动:
131
- // 1. recall() 检索相关历史记忆
132
- // 2. respond() 基于记忆生成更好的回答
133
- // 3. learn() — 把这次交互存入记忆
134
- // 4. evolve() 定期把零散经验提炼为结构化知识
135
- ```
136
-
137
- ### 2. 这个开源项目本身也在自进化
138
-
139
- OPC 不是一个静态的框架——它是一个**活的生态**:
140
- - 🌱 **社区驱动**:每一个 PR、Issue、讨论都在推动四件套进化
141
- - 🔄 **持续迭代**:每天自动集成最新的 AI 技术和最佳实践
142
- - 📈 **知识飞轮**:越多 Agent 使用 越多经验沉淀 框架越来越强 Agent 起步越高
143
-
144
- ---
145
-
146
- ## 🏗️ 架构
147
-
148
- ```
149
- ┌──────────────────────────────────────────────────┐
150
- │ OPC Studio (:4000) │
151
- │ 可视化管理 · Agent 监控 · 对话调试 │
152
- ├────────────┬────────────┬────────────┬───────────┤
153
- DeepBrain │ AgentKits │Workstation OPC Core │
154
- │ 🧠 记忆进化 │ 📊 统一模型 │ 👤 角色模板 │ ⚡ 运行引擎 │
155
- │ │ │ │ │
156
- │ learn() │ OpenAI │ 100+ 角色 │ 25 渠道 │
157
- recall() │ Anthropic │ YAML 定义 │ 3 大协议 │
158
- │ evolve() │ Ollama │ 技能系统 │ Cron 调度 │
159
- RAG │ DeepSeek │ 一键创建 │ 子 Agent │
160
- ├────────────┴────────────┴────────────┴───────────┤
161
- │ OpenTelemetry 全链路追踪 · Eval 评估 · Traces │
162
- └──────────────────────────────────────────────────┘
163
- ```
164
-
165
- ---
166
-
167
- ## 💻 代码示例
168
-
169
- ### 1. 最简 Agent(10 行)
170
-
171
- ```typescript
172
- import { BaseAgent, InMemoryStore } from 'opc-agent';
173
-
174
- const agent = new BaseAgent({
175
- name: 'my-agent',
176
- systemPrompt: 'You are a helpful assistant.',
177
- provider: 'ollama',
178
- model: 'qwen2.5',
179
- memory: new InMemoryStore(),
180
- });
181
-
182
- await agent.init();
183
- const response = await agent.handleMessage({
184
- id: '1', content: 'Hello!', sender: 'user',
185
- channel: 'web', sessionId: 's1', timestamp: new Date(),
186
- });
187
- console.log(response.content);
188
- ```
189
-
190
- ### 2. 带记忆进化的 Agent
191
-
192
- ```typescript
193
- import { AgentRuntime } from 'opc-agent';
194
-
195
- const runtime = new AgentRuntime('./agent.yaml');
196
- await runtime.start();
197
- // 自动: recall(历史记忆) → respond(生成回答) → learn(沉淀知识) → evolve(进化策略)
198
- ```
199
-
200
- ### 3. 多协议 Agent(agent.yaml)
201
-
202
- ```yaml
203
- id: smart-assistant
204
- name: 智能助手
205
- version: "1.0.0"
206
- model: deepseek-chat
207
-
208
- channels:
209
- - type: web
210
- port: 3000
211
- - type: telegram
212
- token: ${TELEGRAM_BOT_TOKEN}
213
-
214
- protocols:
215
- a2a:
216
- enabled: true
217
- port: 4001
218
- ag-ui:
219
- enabled: true
220
- port: 4002
221
- mcp:
222
- role: both # server + client
223
- port: 4003
224
- servers:
225
- - name: file-tools
226
- command: npx @modelcontextprotocol/server-filesystem
227
-
228
- memory:
229
- shortTerm: true
230
- longTerm:
231
- provider: deepbrain
232
- autoEvolve: true
233
- ```
234
-
235
- ---
236
-
237
- ## 🔄 双闭环知识系统 (Dual-Loop Knowledge)
238
-
239
- OPC Agent 的知识系统由两个闭环组成:
240
-
241
- ```
242
- ┌─────────────────────────────────────────────────────┐
243
- │ 小闭环(本地,免费) │
244
- │ Agent 本地 learn → recall → evolve │
245
- │ 离线也能用,数据完全在你手里 │
246
- │ │
247
- │ 大闭环(Hub,增值) │
248
- │ Agent ↔ Workstation Hub 知识共享 │
249
- │ 集体智慧 > 个体经验,新 Agent 站在前人肩膀上 │
250
- └─────────────────────────────────────────────────────┘
251
- ```
252
-
253
- **本地是主人,Hub 是助手**——没有网络也能用,联网后自动同步和进化。
254
-
255
- ```
256
- agentkits (Model Layer) LLM
257
-
258
- opc-agent (Runtime) — 跑 Agent(本地) ← 你在这里
259
-
260
- deepbrain (Memory Engine) 存知识(引擎)
261
-
262
- agent-workstation (Knowledge Platform) — 知识生命周期(Hub)
263
- ```
264
-
265
- ---
266
-
267
- ## 🌱 Brain Seed 自动加载
268
-
269
- v2.1.0 起,OPC Agent 支持三层知识种子自动加载。当 `brain-seeds/` 目录存在时,Agent 首次启动自动导入行业→岗位→模板知识:
270
-
271
- ```typescript
272
- const agent = new BaseAgent({
273
- name: 'my-agent',
274
- systemPrompt: 'You are a helpful assistant.',
275
- provider: 'deepseek',
276
- model: 'deepseek-chat',
277
- });
278
- agent.setLongTermMemory(brain);
279
- // Auto-seeds on first run if brain-seeds/ directory exists
280
- ```
281
-
282
- 通过 CLI 管理知识种子:
283
-
284
- ```bash
285
- opc brain seed # 查看当前 brain seed 状态
286
- opc brain seed --load # 手动加载/重新加载种子
287
- opc brain evolve # 触发知识进化(template → job → industry)
288
- opc brain status # 查看 brain 统计信息
289
- ```
290
-
291
- ---
292
-
293
- ## 🔍 与其他 Agent 框架的差异
294
-
295
- > **一句话:别人的 Agent 是静态的,OPC 的 Agent 会自进化。**
296
-
297
- OPC Agent 的核心设计哲学是**自进化 + 全渠道 + 角色模板 + 生产工具链**。作为自进化 Agent 技术栈(The Self-Evolving Agent Stack)中的 **Agent Runtime**,OPC 更关注的是:一个 Agent 如何在真实生产环境中**持续自进化、随处触达、开箱即用**。
298
-
299
- **🔄 自进化飞轮**:Templates 自带 Brain Seed → Model Layer 每次调用自动 learn → Runtime 持续运行 → Memory 自动 evolve → Agent 越来越强。
300
-
301
- #### vs Hermes Agent
302
-
303
- **设计思路差异**:Hermes 是 Python 单体框架,围绕 Nous Research 的模型生态构建,强调自学习进化和 RL 训练。OPC 是 TypeScript 模块化四件套(Brain / Agent / Channel / CLI),强调工程化和开箱即用。
304
-
305
- **OPC 的优势**:记忆进化三件套(learn → recall → evolve 自动聚类提炼)、三层 Brain Seed 预置知识体系、25 个内置渠道(vs Hermes 16+)、100+ 角色模板、原生 A2A + AG-UI 协议支持、OpenAI 兼容 API Server。
306
-
307
- **Hermes 的优势**:Python 生态更成熟、GRPO + LoRA 的 RL 训练管线更完善、Nous Research 社区生态更大、Docker 沙箱隔离方案更成熟。
308
-
309
- **适合谁**:如果你需要 Python 生态和 RL 训练能力,选 Hermes;如果你需要 TypeScript 全栈、记忆进化、全渠道触达和生产工具链,选 OPC。
310
-
311
- #### vs OpenClaw
312
-
313
- **设计思路差异**:OpenClaw 是重量级 runtime + 配置驱动,提供完整的 Gateway 运行时环境,适合"安装一次、配置运行"的场景。OPC 是轻量 CLI + 代码优先,四件套可独立使用,适合开发者自由组合。
314
-
315
- **OPC 的优势**:模块化四件套可按需引入、100+ 角色模板、记忆进化系统、25 个内置渠道、`opc init/dev/test/deploy` 全生命周期 CLI、A2A/AG-UI 协议支持。
316
-
317
- **OpenClaw 的优势**:开箱即用的 runtime 体验、Puppeteer 浏览器自动化、成熟的权限和安全沙箱、配置驱动上手门槛低。
318
-
319
- **适合谁**:如果你偏好"配置即运行"的一体化方案,选 OpenClaw;如果你偏好代码优先、模块自由组合、需要记忆进化和模板体系,选 OPC。
320
-
321
- #### vs CrewAI
322
-
323
- **设计思路差异**:CrewAI 采用 Crew 编排模式——定义 Agent 角色、分配 Task、按流程执行。OPC 采用模板(Template)+ 记忆(Memory)模式——每个 Agent 有独立记忆和角色模板,通过 DeepBrain 实现知识积累和进化。
324
-
325
- **OPC 的优势**:记忆进化(不只是短期/长期记忆,而是自动聚类提炼)、Brain Seed 预置知识、25 个内置渠道(CrewAI 需自行接入)、100+ 角色模板、TypeScript 原生。
326
-
327
- **CrewAI 的优势**:Crew + Flow 编排模式直观易懂、Python 生态、100K+ 用户的成熟社区、Enterprise 版本功能丰富。
328
-
329
- **适合谁**:如果你需要多 Agent 任务编排且偏好 Python,选 CrewAI;如果你需要单 Agent 深度进化、全渠道部署、TypeScript 生态,选 OPC。
330
-
331
- #### vs AutoGen
332
-
333
- **设计思路差异**:AutoGen 是微软主导的对话驱动多 Agent 框架,核心是 Agent 之间的对话协作和 UserProxy 人机交互。OPC 是任务驱动的模板模式,强调单 Agent 的记忆进化和生产部署能力。
334
-
335
- **OPC 的优势**:记忆进化系统、Brain Seed、25 个内置渠道、100+ 角色模板、全生命周期 CLI、YAML 声明式配置。
336
-
337
- **AutoGen 的优势**:微软生态支持、分布式 Agent 能力、AutoGen Studio 可视化、UserProxy 人机交互模式成熟、Python/C# 双语言支持、社区活跃。
338
-
339
- **适合谁**:如果你需要多 Agent 对话协作和微软生态集成,选 AutoGen;如果你需要记忆进化、全渠道触达、角色模板和 TypeScript 工具链,选 OPC。
340
-
341
- #### 功能速查表
342
-
343
- | 功能 | OPC Agent | Hermes Agent | OpenClaw | CrewAI | AutoGen |
344
- |---|:-:|:-:|:-:|:-:|:-:|
345
- | **语言** | TypeScript | Python | TypeScript | Python | Python/C# |
346
- | **自进化 (Self-Evolution)** | ✅ learn→recall→evolve | 🔶 | ❌ | ❌ | ❌ |
347
- | **Brain Seed 预置知识** | ✅ 三层 | ❌ | ❌ | ❌ | ❌ |
348
- | **内置渠道** | 25 | 16+ | 2 | ❌ | ❌ |
349
- | **角色模板** | 100+ | ❌ | ❌ | ❌ | ❌ |
350
- | **CLI 全生命周期** | ✅ 20+ 命令 | 🔶 | 🔶 | 🔶 | 🔶 |
351
- | **A2A + AG-UI** | ✅ | 🔶 / ❌ | ❌ | ❌ | ❌ |
352
- | **多 Agent 协作** | ✅ | ✅ | 🔶 | ✅ | ✅ |
353
- | **RL 训练** | ✅ 反馈优化 | ✅ GRPO+LoRA | ❌ | ❌ | ❌ |
354
- | **浏览器自动化** | ✅ | ✅ | ✅ | ❌ | ❌ |
355
- | **可视化** | ✅ OPC Studio | ✅ Dashboard | ❌ | 🔶 | ✅ Studio |
356
- | **社区成熟度** | 🚧 早期 | ✅ 活跃 | 🚧 小众 | ✅ 大规模 | ✅ 大规模 |
357
- | **许可证** | Apache-2.0 | MIT | MIT | Apache-2.0 | MIT |
358
-
359
- > 对比基于各项目公开文档(截至 2026 年 4 月)。各框架都在快速迭代,如有偏差欢迎 [Issue 指正](https://github.com/Deepleaper/opc-agent/issues)。
360
-
361
- ---
362
-
363
- ## 📦 四件套生态
364
-
365
- | 包 | 功能 | 安装 |
366
- |---|---|---|
367
- | **[opc-agent](https://www.npmjs.com/package/opc-agent)** | Agent Runtime — 创建、运行、管理 | `npm i opc-agent` |
368
- | **[deepbrain](https://www.npmjs.com/package/deepbrain)** | Agent Memory — 自进化记忆引擎 | `npm i deepbrain` |
369
- | **[agentkits](https://www.npmjs.com/package/agentkits)** | Agent Model Layer — 一行代码接入 LLM + 自带记忆 | `npm i agentkits` |
370
- | **[agent-workstation](https://www.npmjs.com/package/agent-workstation)** | Agent Templates — 100+ 专业角色模板 | `npm i agent-workstation` |
371
-
372
- ---
373
-
374
- ## 🔧 CLI 参考
375
-
376
- | 命令 | 说明 |
377
- |------|------|
378
- | `opc init <name>` | 创建新 Agent(支持 `--role` 指定角色模板) |
379
- | `opc chat` | 交互式 TUI 对话 |
380
- | `opc dev` | 开发模式(热重载) |
381
- | `opc run` | 生产模式运行 |
382
- | `opc start` | 守护进程后台启动 |
383
- | `opc stop` | 停止守护进程 |
384
- | `opc status` | 查看运行状态 |
385
- | `opc studio` | 启动可视化管理后台 |
386
- | `opc doctor` | 环境检查与诊断 |
387
- | `opc eval` | 运行评估测试 |
388
- | `opc test` | 运行单元测试 |
389
- | `opc build` | 构建 Agent |
390
- | `opc publish` | 发布到 npm |
391
- | `opc deploy` | 部署到云端 |
392
- | `opc logs [-f]` | 查看 Traces 日志 |
393
- | `opc traces` | 查看全链路追踪 |
394
- | `opc score` | 查看性能评分 |
395
- | `opc analytics` | 数据分析面板 |
396
- | `opc brain` | 查看记忆状态 |
397
- | `opc brain seed` | 查看/加载三层知识种子 |
398
- | `opc brain evolve` | 触发知识进化(template → job → industry) |
399
- | `opc brain status` | 查看 brain 详细统计 |
400
- | `opc jobs` | 查看定时任务 |
401
- | `opc skills` | 查看已学技能 |
402
- | `opc search <query>` | 搜索 |
403
- | `opc info` | Agent 信息 |
404
- | `opc install <skill>` | 安装技能 |
405
- | `opc plugin <name>` | 管理插件 |
406
- | `opc tool <name>` | 管理工具 |
407
- | `opc workflow <name>` | 工作流 |
408
- | `opc migrate` | 迁移 |
409
-
410
- ---
411
-
412
- ## 🔌 协议支持
413
-
414
- | 协议 | 角色 | 说明 |
415
- |------|------|------|
416
- | **[Google A2A](https://google.github.io/A2A/)** | Server + Client | Agent-to-Agent 互操作,发现/调用其他 Agent |
417
- | **[AG-UI](https://ag-ui.com/)** | Server | Agent-to-UI 流式协议,前端实时渲染 Agent 状态 |
418
- | **[MCP](https://modelcontextprotocol.io/)** | Server + Client | 连接外部工具服务器,也可作为工具提供方 |
419
-
420
- ---
421
-
422
- ## 📡 25 种 Channel
423
-
424
- | 渠道 | 状态 | 说明 |
425
- |------|:----:|------|
426
- | 🌐 Web | ✅ | 网页聊天组件 |
427
- | 📱 Telegram | ✅ | Bot API |
428
- | 💬 Slack | ✅ | Slack App |
429
- | 🎮 Discord | ✅ | Discord Bot |
430
- | 📧 Email | ✅ | IMAP / SMTP |
431
- | 💚 WeChat | ✅ | 企业微信 / 个人微信 |
432
- | 🔵 Feishu | ✅ | 飞书机器人 |
433
- | 🎤 Voice | ✅ | 语音通话(TTS + STT) |
434
- | 🔌 WebSocket | ✅ | 实时双向通信 |
435
- | 🪝 Webhook | ✅ | HTTP 回调 |
436
- | 📡 REST API | ✅ | HTTP API |
437
- | 💬 WhatsApp | ✅ | WhatsApp Business API |
438
- | 🟢 LINE | ✅ | LINE Messaging API |
439
- | 🟣 Teams | ✅ | Microsoft Teams Bot |
440
- | 📲 SMS | ✅ | Twilio / 云通信 |
441
- | 🔷 DingTalk | ✅ | 钉钉机器人 |
442
- | 🐦 Twitter/X | ✅ | DM + Mentions |
443
- | 📸 Instagram | ✅ | Instagram DM |
444
- | 📘 Facebook | ✅ | Messenger API |
445
- | 🔐 Signal | ✅ | Signal Bot |
446
- | 🟩 Matrix | ✅ | Matrix 协议 |
447
- | 💬 XMPP | ✅ | Jabber/XMPP |
448
- | 💻 IRC | ✅ | IRC 协议 |
449
- | 📞 Twilio | ✅ | 电话 / IVR |
450
- | 🔧 Custom | ✅ | 自定义渠道适配器 |
451
-
452
- ---
453
-
454
- ## 🤝 贡献
455
-
456
- 欢迎贡献!请查看 [Contributing Guide](CONTRIBUTING.md)。
457
-
458
- ```bash
459
- git clone https://github.com/Deepleaper/opc-agent.git
460
- cd opc-agent
461
- npm install
462
- npm run build
463
- npm test
464
- ```
465
-
466
- ---
467
-
468
- ## 📄 License
469
-
470
- [Apache-2.0](LICENSE) © [Deepleaper](https://github.com/Deepleaper)
471
-
472
- ---
473
-
474
- ---
475
-
476
- <a name="english-version"></a>
477
-
478
- <div align="center">
479
-
480
- # ⚡ OPC Agent
481
-
482
- ### The Self-Evolving Agent Runtime — Every Agent You Build Learns, Remembers, and Evolves
483
-
484
- [![npm version](https://img.shields.io/badge/npm-v4.0.0-blue)](https://www.npmjs.com/package/opc-agent)
485
- [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/Deepleaper/opc-agent/blob/main/LICENSE)
486
- [![Tests](https://img.shields.io/badge/tests-1024%2B_passing-brightgreen)]()
487
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.7-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
488
- [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D18-339933?logo=node.js&logoColor=white)](https://nodejs.org/)
489
-
490
- **The runtime engine of The Self-Evolving Agent Stack — every Agent learns, remembers, and evolves.**
491
-
492
- OPC Agent is the **Agent Runtime** in the self-evolving Agent stack: from `opc init` to create, `opc chat` to converse, `opc studio` to manage visually.<br>The built-in learn → recall → evolve loop makes your Agent **smarter over time** — not starting from scratch, but continuously accumulating and evolving knowledge.<br>Developer path: ① Pick a template (Agent Templates) → ② Connect models (Agent Model Layer) → ③ **Run it (Agent Runtime)** → ④ Auto-evolve (Agent Memory).
493
-
494
- [Quick Start](#-quick-start) · [🧬 Self-Evolution](#-self-evolution) · [Features](#-features) · [Code Examples](#-code-examples-1) · [CLI Reference](#-cli-reference-1)
495
-
496
- </div>
497
-
498
- ---
499
-
500
- ## 🚀 Quick Start
501
-
502
- ```bash
503
- npm install -g opc-agent
504
- opc init my-agent --role customer-service
505
- cd my-agent && npm install
506
- opc chat
507
- ```
508
-
509
- ```
510
- 🤖 Customer Service Agent ready
511
-
512
- You: When will my order #12345 ship?
513
- Agent: Hi! Order #12345 shipped this morning and should arrive within 3 days. Want me to check the tracking details?
514
-
515
- You: What about the order you looked up last time?
516
- Agent: Your previous order #12300 was delivered on April 15th at 2 PM.
517
- ↑ Memory auto-recalled — no need to repeat context
518
- ```
519
-
520
- > The Agent automatically remembers every conversation, distills domain knowledge, and evolves its response strategy. This isn't a demo — it's the default behavior.
521
-
522
- ---
523
-
524
- ## ✨ Features
525
-
526
- | | Feature | Description |
527
- |---|---|---|
528
- | 🧬 | **Self-Evolution** | learn → recall → evolve loop — Agents get smarter over time, knowledge auto-accumulates and refines |
529
- | 🧠 | **Memory Evolution** | Built-in DeepBrain — auto distillation, clustering, deduplication, refinement |
530
- | 🔧 | **20+ CLI Commands** | init / chat / run / start / studio / doctor / eval / traces / publish |
531
- | 📡 | **25 Channels** | Telegram / Discord / Slack / WeChat / Feishu / Email / Web / WebSocket / Voice / Webhook / API / WhatsApp / LINE / Teams / SMS / DingTalk / Twitter / Instagram / Facebook / Signal / Matrix / XMPP / IRC / Twilio / Custom |
532
- | 🔌 | **3 Protocols** | Google A2A + AG-UI + MCP (Server & Client) |
533
- | 🎨 | **OPC Studio** | Visual management dashboard — one command `opc studio` |
534
- | 📊 | **OpenTelemetry** | Full distributed tracing + p50 / p95 / p99 latency metrics |
535
- | 🧪 | **Built-in Eval** | `opc eval` with 24 evaluation test cases for quantifying Agent quality |
536
- | 🔍 | **RAG Pipeline** | 5 chunking strategies + 4 rerankers (via DeepBrain) |
537
- | 📦 | **Package & Publish** | `opc publish` — one command to publish to npm |
538
- | 🏭 | **Role Templates** | 100+ professional roles, `opc init --role` for instant creation |
539
- | 🔒 | **Security Suite** | Command approval + API Key encryption + file/network restrictions + sandboxing |
540
- | 🤖 | **Sub-Agents** | spawn / parallel / kill for multi-Agent collaboration |
541
- | 🌐 | **Browser Automation** | Playwright integration — web interaction, screenshots, data scraping |
542
- | 👁️ | **Vision** | Multimodal image understanding — screenshot analysis, document recognition |
543
- | 🎙️ | **Voice Call** | Real-time voice conversation with TTS + STT |
544
- | 🏠 | **Home Assistant** | Smart home integration, IoT device control |
545
- | 💻 | **IDE Bridge** | Deep integration with VS Code / Cursor |
546
- | 🔗 | **Node Network** | Multi-node network, cross-device Agent collaboration |
547
- | 🚪 | **Gateway** | Unified gateway with secure routing + load balancing |
548
- | 🗜️ | **Context Compression** | Smart context compression — keep key info in long conversations |
549
- | 🌐 | **API Server** | REST API server for external system integration |
550
- | 📎 | **@Mention** | @mention other Agents or resources |
551
- | 📋 | **Session Manager** | Multi-session parallel, history rollback |
552
- | 🎯 | **RL (Reinforcement Learning)** | Feedback-based strategy optimization |
553
-
554
- ---
555
-
556
- ## 🧬 Self-Evolution
557
-
558
- **The core differentiator of OPC — self-evolution. This is what fundamentally separates us from every other Agent framework.**
559
-
560
- Other frameworks build static Agents — they forget everything after each session, and when someone else takes over, everything resets. OPC Agents learn, remember, and evolve.
561
-
562
- ### 1. Every Agent You Build Self-Evolves
563
-
564
- Through the learn → recall → evolve loop, Agents automatically accumulate knowledge and get smarter:
565
-
566
- ```
567
- ┌──────────────────────────────────────────────────────┐
568
- │ │
569
- │ 📥 learn 🔍 recall 🧬 evolve │
570
- │ After each Auto-retrieve Periodically │
571
- │ interaction relevant refine knowledge │
572
- │ memories — sharper, not │
573
- │ bigger │
574
- │ │
575
- │ Day 1: "I haven't seen this issue before" │
576
- │ Day 7: "A similar issue was solved this way" │
577
- │ Day 30: "The best practice for this type is..." │
578
- │ │
579
- └──────────────────────────────────────────────────────┘
580
- ```
581
-
582
- **Concrete example**: A customer service Agent —
583
- - **Day 1**: Can only respond based on the initial prompt; needs human escalation for unknown issues
584
- - **Day 7**: Accumulated 200+ conversation experiences; `evolve()` distilled 15 product knowledge entries
585
- - **Day 30**: Refined into 5 core insights + 50 best-practice answers; accuracy from 60% → 95%
586
-
587
- ```typescript
588
- import { AgentRuntime } from 'opc-agent';
589
-
590
- const runtime = new AgentRuntime('./agent.yaml');
591
- await runtime.start();
592
-
593
- // You don't need to do anything — the Agent automatically:
594
- // 1. recall() — retrieves relevant past memories
595
- // 2. respond() — generates better answers based on memory
596
- // 3. learn() — stores this interaction into memory
597
- // 4. evolve() — periodically distills scattered experiences into structured knowledge
598
- ```
599
-
600
- ### 2. The Open-Source Project Itself Self-Evolves
601
-
602
- OPC isn't a static framework — it's a **living ecosystem**:
603
- - 🌱 **Community-driven**: Every PR, Issue, and discussion pushes the suite forward
604
- - 🔄 **Continuous iteration**: Daily integration of the latest AI techniques and best practices
605
- - 📈 **Knowledge flywheel**: More Agents → richer experience → stronger framework → new Agents start smarter
606
-
607
- ---
608
-
609
- ## 🏗️ Architecture
610
-
611
- ```
612
- ┌──────────────────────────────────────────────────┐
613
- │ OPC Studio (:4000) │
614
- │ Visual Management · Monitoring · Debug │
615
- ├────────────┬────────────┬────────────┬───────────┤
616
- │ DeepBrain │ AgentKits │Workstation │ OPC Core │
617
- │ 🧠 Memory │ 📊 Models │ 👤 Roles │ ⚡ Engine │
618
- │ │ │ │ │
619
- │ learn() │ OpenAI │ 100+ roles │ 25 chan. │
620
- │ recall() │ Anthropic │ YAML def. │ 3 proto. │
621
- │ evolve() │ Ollama │ Skill sys. │ Cron sched│
622
- │ RAG │ DeepSeek │ One-click │ Sub-Agent │
623
- ├────────────┴────────────┴────────────┴───────────┤
624
- │ OpenTelemetry Tracing · Eval · Traces │
625
- └──────────────────────────────────────────────────┘
626
- ```
627
-
628
- ---
629
-
630
- ## 💻 Code Examples
631
-
632
- ### 1. Minimal Agent (10 lines)
633
-
634
- ```typescript
635
- import { BaseAgent, InMemoryStore } from 'opc-agent';
636
-
637
- const agent = new BaseAgent({
638
- name: 'my-agent',
639
- systemPrompt: 'You are a helpful assistant.',
640
- provider: 'ollama',
641
- model: 'qwen2.5',
642
- memory: new InMemoryStore(),
643
- });
644
-
645
- await agent.init();
646
- const response = await agent.handleMessage({
647
- id: '1', content: 'Hello!', sender: 'user',
648
- channel: 'web', sessionId: 's1', timestamp: new Date(),
649
- });
650
- console.log(response.content);
651
- ```
652
-
653
- ### 2. Agent with Memory Evolution
654
-
655
- ```typescript
656
- import { AgentRuntime } from 'opc-agent';
657
-
658
- const runtime = new AgentRuntime('./agent.yaml');
659
- await runtime.start();
660
- // Auto: recall(history) → respond(generate) → learn(distill) → evolve(improve)
661
- ```
662
-
663
- ### 3. Multi-Protocol Agent (agent.yaml)
664
-
665
- ```yaml
666
- id: smart-assistant
667
- name: Smart Assistant
668
- version: "1.0.0"
669
- model: deepseek-chat
670
-
671
- channels:
672
- - type: web
673
- port: 3000
674
- - type: telegram
675
- token: ${TELEGRAM_BOT_TOKEN}
676
-
677
- protocols:
678
- a2a:
679
- enabled: true
680
- port: 4001
681
- ag-ui:
682
- enabled: true
683
- port: 4002
684
- mcp:
685
- role: both # server + client
686
- port: 4003
687
- servers:
688
- - name: file-tools
689
- command: npx @modelcontextprotocol/server-filesystem
690
-
691
- memory:
692
- shortTerm: true
693
- longTerm:
694
- provider: deepbrain
695
- autoEvolve: true
696
- ```
697
-
698
- ---
699
-
700
- ## 🔄 Dual-Loop Knowledge System
701
-
702
- OPC Agent's knowledge system consists of two loops:
703
-
704
- ```
705
- ┌─────────────────────────────────────────────────────┐
706
- │ Small Loop (Local, Free) │
707
- │ Agent local learn → recall → evolve │
708
- │ Works offline, data stays on your machine │
709
- │ │
710
- │ Big Loop (Hub, Value-Add) │
711
- │ Agent ↔ Workstation Hub knowledge sharing │
712
- │ Collective wisdom > individual experience │
713
- └─────────────────────────────────────────────────────┘
714
- ```
715
-
716
- **Local is the owner, Hub is the helper** — works without internet, auto-syncs when connected.
717
-
718
- ```
719
- agentkits (Model Layer) — LLM calls
720
-
721
- opc-agent (Runtime) — run Agents (local) ← You are here
722
-
723
- deepbrain (Memory Engine) — store knowledge (engine)
724
-
725
- agent-workstation (Knowledge Platform) — knowledge lifecycle (Hub)
726
- ```
727
-
728
- ---
729
-
730
- ## 🌱 Brain Seed Auto-Loading
731
-
732
- Since v2.1.0, OPC Agent supports automatic 3-tier knowledge seed loading. When a `brain-seeds/` directory exists, the Agent auto-imports industry → job → workstation knowledge on first run:
733
-
734
- ```typescript
735
- const agent = new BaseAgent({
736
- name: 'my-agent',
737
- systemPrompt: 'You are a helpful assistant.',
738
- provider: 'deepseek',
739
- model: 'deepseek-chat',
740
- });
741
- agent.setLongTermMemory(brain);
742
- // Auto-seeds on first run if brain-seeds/ directory exists
743
- ```
744
-
745
- Manage brain seeds via CLI:
746
-
747
- ```bash
748
- opc brain seed # View current brain seed status
749
- opc brain seed --load # Manually load/reload seeds
750
- opc brain evolve # Trigger knowledge evolution (workstation → job → industry)
751
- opc brain status # View brain statistics
752
- ```
753
-
754
- ---
755
-
756
- ## 🔍 How OPC Agent Differs from Other Frameworks
757
-
758
- > **In one sentence: other Agents are static; OPC Agents self-evolve.**
759
-
760
- OPC Agent's core design philosophy centers on **Self-Evolution + Omnichannel + Role Templates + Production Toolchain**. As the **Agent Runtime** in The Self-Evolving Agent Stack, OPC focuses on how a single agent can **continuously self-evolve, reach users everywhere, and ship to production out of the box**.
761
-
762
- **🔄 Self-Evolution Flywheel**: Templates ship with Brain Seeds → Model Layer auto-learns on every call → Runtime runs continuously → Memory auto-evolves → Agent gets stronger over time.
763
-
764
- #### vs Hermes Agent
765
-
766
- **Design difference**: Hermes is a Python monolithic framework built around the Nous Research model ecosystem, emphasizing self-learning evolution and RL training. OPC is a TypeScript modular four-piece suite (Brain / Agent / Channel / CLI) emphasizing engineering productivity and out-of-box experience.
767
-
768
- **Where OPC leads**: Memory evolution trilogy (learn → recall → evolve with automatic clustering), 3-tier Brain Seed knowledge system, 25 built-in channels (vs Hermes's 16+), 100+ role templates, native A2A + AG-UI protocol support, OpenAI-compatible API server.
769
-
770
- **Where Hermes leads**: More mature Python ecosystem, battle-tested GRPO + LoRA RL training pipeline, larger Nous Research community, more mature Docker sandbox isolation.
771
-
772
- **Best for**: Choose Hermes if you need Python ecosystem and RL training capabilities. Choose OPC if you need TypeScript full-stack, memory evolution, omnichannel reach, and production toolchain.
773
-
774
- #### vs OpenClaw
775
-
776
- **Design difference**: OpenClaw is a heavyweight runtime with config-driven approach — install once, configure, and run. OPC is lightweight CLI + code-first, with four independent packages you can mix and match.
777
-
778
- **Where OPC leads**: Modular four-piece suite with independent packages, 100+ role templates, memory evolution system, 25 built-in channels, `opc init/dev/test/deploy` full-lifecycle CLI, A2A/AG-UI protocol support.
779
-
780
- **Where OpenClaw leads**: Polished out-of-box runtime experience, Puppeteer browser automation, mature permission and security sandbox, lower barrier to entry with config-driven approach.
781
-
782
- **Best for**: Choose OpenClaw if you prefer a "configure and run" all-in-one solution. Choose OPC if you prefer code-first, modular composition, and need memory evolution with role templates.
783
-
784
- #### vs CrewAI
785
-
786
- **Design difference**: CrewAI uses a Crew orchestration pattern — define agent roles, assign tasks, execute in sequence or parallel. OPC uses a Template + Memory model — each agent has independent memory and role templates, accumulating and evolving knowledge through DeepBrain.
787
-
788
- **Where OPC leads**: Memory evolution (not just short/long-term memory, but automatic clustering and distillation), Brain Seed pre-loaded knowledge, 25 built-in channels (CrewAI requires DIY), 100+ role templates, native TypeScript.
789
-
790
- **Where CrewAI leads**: Intuitive Crew + Flow orchestration model, Python ecosystem, 100K+ user mature community, feature-rich Enterprise edition.
791
-
792
- **Best for**: Choose CrewAI if you need multi-agent task orchestration and prefer Python. Choose OPC if you need deep single-agent evolution, omnichannel deployment, and TypeScript ecosystem.
793
-
794
- #### vs AutoGen
795
-
796
- **Design difference**: AutoGen is Microsoft's conversation-driven multi-agent framework, centered on agent-to-agent dialogue and UserProxy human-in-the-loop. OPC is task-driven with a template-based model, emphasizing single-agent memory evolution and production deployment.
797
-
798
- **Where OPC leads**: Memory evolution system, Brain Seed, 25 built-in channels, 100+ role templates, full-lifecycle CLI, YAML declarative configuration.
799
-
800
- **Where AutoGen leads**: Microsoft ecosystem support, distributed agent capabilities, AutoGen Studio visualization, mature UserProxy human-in-the-loop pattern, Python/C# dual-language support, active community.
801
-
802
- **Best for**: Choose AutoGen if you need multi-agent conversational collaboration and Microsoft ecosystem integration. Choose OPC if you need memory evolution, omnichannel reach, role templates, and TypeScript toolchain.
803
-
804
- #### Quick Reference Matrix
805
-
806
- | Feature | OPC Agent | Hermes Agent | OpenClaw | CrewAI | AutoGen |
807
- |---|:-:|:-:|:-:|:-:|:-:|
808
- | **Language** | TypeScript | Python | TypeScript | Python | Python/C# |
809
- | **Self-Evolution** | ✅ learn→recall→evolve | 🔶 | ❌ | ❌ | ❌ |
810
- | **Brain Seed** | ✅ 3-tier | ❌ | ❌ | ❌ | ❌ |
811
- | **Built-in Channels** | 25 | 16+ | 2 | ❌ | ❌ |
812
- | **Role Templates** | 100+ | ❌ | ❌ | ❌ | ❌ |
813
- | **Full-lifecycle CLI** | ✅ 20+ cmds | 🔶 | 🔶 | 🔶 | 🔶 |
814
- | **A2A + AG-UI** | ✅ | 🔶 / ❌ | ❌ | ❌ | ❌ |
815
- | **Multi-Agent** | ✅ | ✅ | 🔶 | ✅ | ✅ |
816
- | **RL Training** | ✅ Feedback opt. | ✅ GRPO+LoRA | ❌ | ❌ | ❌ |
817
- | **Browser Automation** | ✅ | ✅ | ✅ | ❌ | ❌ |
818
- | **Visual Dashboard** | ✅ OPC Studio | ✅ Dashboard | ❌ | 🔶 | ✅ Studio |
819
- | **Community Maturity** | 🚧 Early | ✅ Active | 🚧 Niche | ✅ Large | ✅ Large |
820
- | **License** | Apache-2.0 | MIT | MIT | Apache-2.0 | MIT |
821
-
822
- > Comparison based on each project's public documentation as of April 2026. All frameworks are evolving rapidly — corrections welcome via [Issues](https://github.com/Deepleaper/opc-agent/issues).
823
-
824
- ---
825
-
826
- ## 📦 Ecosystem
827
-
828
- | Package | Purpose | Install |
829
- |---|---|---|
830
- | **[opc-agent](https://www.npmjs.com/package/opc-agent)** | Agent Runtime — create, run, manage | `npm i opc-agent` |
831
- | **[deepbrain](https://www.npmjs.com/package/deepbrain)** | Agent Memory — self-evolving memory engine | `npm i deepbrain` |
832
- | **[agentkits](https://www.npmjs.com/package/agentkits)** | Agent Model Layer — one-line LLM access with built-in memory | `npm i agentkits` |
833
- | **[agent-workstation](https://www.npmjs.com/package/agent-workstation)** | Agent Templates — 100+ professional role templates | `npm i agent-workstation` |
834
-
835
- ---
836
-
837
- ## 🔧 CLI Reference
838
-
839
- | Command | Description |
840
- |---------|-------------|
841
- | `opc init <name>` | Create a new Agent (supports `--role` for role templates) |
842
- | `opc chat` | Interactive TUI conversation |
843
- | `opc dev` | Development mode (hot reload) |
844
- | `opc run` | Production run |
845
- | `opc start` | Daemon mode (background) |
846
- | `opc stop` | Stop daemon |
847
- | `opc status` | View running status |
848
- | `opc studio` | Launch visual management dashboard |
849
- | `opc doctor` | Environment check & diagnostics |
850
- | `opc eval` | Run evaluation tests |
851
- | `opc test` | Run unit tests |
852
- | `opc build` | Build Agent |
853
- | `opc publish` | Publish to npm |
854
- | `opc deploy` | Deploy to cloud |
855
- | `opc logs [-f]` | View Traces logs |
856
- | `opc traces` | View distributed traces |
857
- | `opc score` | View performance score |
858
- | `opc analytics` | Analytics dashboard |
859
- | `opc brain` | View memory status |
860
- | `opc brain seed` | View/load 3-tier knowledge seeds |
861
- | `opc brain evolve` | Trigger knowledge evolution (workstation → job → industry) |
862
- | `opc brain status` | View brain detailed statistics |
863
- | `opc jobs` | View scheduled tasks |
864
- | `opc skills` | View learned skills |
865
- | `opc search <query>` | Search |
866
- | `opc info` | Agent info |
867
- | `opc install <skill>` | Install a skill |
868
- | `opc plugin <name>` | Manage plugins |
869
- | `opc tool <name>` | Manage tools |
870
- | `opc workflow <name>` | Workflows |
871
- | `opc migrate` | Migration |
872
-
873
- ---
874
-
875
- ## 🔌 Protocol Support
876
-
877
- | Protocol | Role | Description |
878
- |----------|------|-------------|
879
- | **[Google A2A](https://google.github.io/A2A/)** | Server + Client | Agent-to-Agent interop — discover and invoke other Agents |
880
- | **[AG-UI](https://ag-ui.com/)** | Server | Agent-to-UI streaming protocol — real-time frontend rendering |
881
- | **[MCP](https://modelcontextprotocol.io/)** | Server + Client | Connect to external tool servers or serve as a tool provider |
882
-
883
- ---
884
-
885
- ## 📡 25 Channels
886
-
887
- | Channel | Status | Description |
888
- |---------|:------:|-------------|
889
- | 🌐 Web | ✅ | Web chat widget |
890
- | 📱 Telegram | ✅ | Bot API |
891
- | 💬 Slack | ✅ | Slack App |
892
- | 🎮 Discord | ✅ | Discord Bot |
893
- | 📧 Email | ✅ | IMAP / SMTP |
894
- | 💚 WeChat | ✅ | Enterprise / Personal WeChat |
895
- | 🔵 Feishu | ✅ | Feishu (Lark) Bot |
896
- | 🎤 Voice | ✅ | Voice call (TTS + STT) |
897
- | 🔌 WebSocket | ✅ | Real-time bidirectional |
898
- | 🪝 Webhook | ✅ | HTTP callback |
899
- | 📡 REST API | ✅ | HTTP API |
900
- | 💬 WhatsApp | ✅ | WhatsApp Business API |
901
- | 🟢 LINE | ✅ | LINE Messaging API |
902
- | 🟣 Teams | ✅ | Microsoft Teams Bot |
903
- | 📲 SMS | ✅ | Twilio / Cloud messaging |
904
- | 🔷 DingTalk | ✅ | DingTalk Bot |
905
- | 🐦 Twitter/X | ✅ | DM + Mentions |
906
- | 📸 Instagram | ✅ | Instagram DM |
907
- | 📘 Facebook | ✅ | Messenger API |
908
- | 🔐 Signal | ✅ | Signal Bot |
909
- | 🟩 Matrix | ✅ | Matrix protocol |
910
- | 💬 XMPP | ✅ | Jabber/XMPP |
911
- | 💻 IRC | ✅ | IRC protocol |
912
- | 📞 Twilio | ✅ | Phone / IVR |
913
- | 🔧 Custom | ✅ | Custom channel adapter |
914
-
915
- ---
916
-
917
- ## 🤝 Contributing
918
-
919
- Contributions welcome! See [Contributing Guide](CONTRIBUTING.md).
920
-
921
- ```bash
922
- git clone https://github.com/Deepleaper/opc-agent.git
923
- cd opc-agent
924
- npm install
925
- npm run build
926
- npm test
927
- ```
928
-
929
- ---
930
-
931
- ## 📄 License
932
-
933
- [Apache-2.0](LICENSE) © [Deepleaper](https://github.com/Deepleaper)
1
+ <div align="center">
2
+
3
+ # ⚡ OPC Agent
4
+
5
+ **Open Agent FrameworkBuild, run, and evolve AI agents from your terminal.**
6
+
7
+ [![npm](https://img.shields.io/npm/v/opc-agent)](https://www.npmjs.com/package/opc-agent)
8
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
9
+ [![Node](https://img.shields.io/badge/Node.js-%3E%3D18-339933?logo=node.js&logoColor=white)](https://nodejs.org/)
10
+
11
+ [Quick Start](#-quick-start) · [Features](#-features) · [Architecture](#-architecture) · [Configuration](#-configuration) · [CLI](#-cli-commands) · [中文文档](README.zh-CN.md)
12
+
13
+ </div>
14
+
15
+ ---
16
+
17
+ ## 🚀 Quick Start
18
+
19
+ ```bash
20
+ npm install -g opc-agent
21
+ opc init
22
+ opc run
23
+ ```
24
+
25
+ Or one-line install (includes Node.js + optional Ollama):
26
+
27
+ ```bash
28
+ # macOS / Linux
29
+ curl -fsSL https://raw.githubusercontent.com/Deepleaper/opc-agent/main/install.sh | bash
30
+
31
+ # Windows PowerShell
32
+ irm https://raw.githubusercontent.com/Deepleaper/opc-agent/main/install.ps1 | iex
33
+ ```
34
+
35
+ Then open Studio at **http://localhost:4000** or chat in terminal:
36
+
37
+ ```bash
38
+ opc chat
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Features
44
+
45
+ | | Feature | Description |
46
+ |---|---|---|
47
+ | 🤖 | **53 Built-in Tools** | File, shell, web, browser, vision, GitHub, Jira, Slack, and more |
48
+ | 🎨 | **Studio GUI** | Visual agent management at `http://localhost:4000` |
49
+ | 💬 | **TUI Terminal Chat** | Streaming responses, markdown rendering, slash commands |
50
+ | 🧠 | **Knowledge Evolve Engine** | Local Ollama-powered zero-cost knowledge distillation |
51
+ | 📱 | **15+ Channels** | Telegram, Discord, Slack, WeChat, Email, WhatsApp, LINE, Teams… |
52
+ | 🔧 | **40 Built-in Skills** | Productivity, knowledge, creative, developer skill packs |
53
+ | 📋 | **OAD Config** | Declarative YAML agent definition (`oad.yaml`) |
54
+ | 🏥 | **Doctor** | 13 health checks — model, tools, channels, memory |
55
+ | | **Cron Scheduler** | Scheduled tasks + proactive agent triggers |
56
+ | 🔌 | **MCP Protocol** | Model Context Protocol server & client |
57
+ | 🗣️ | **Voice (STT/TTS)** | Whisper, Azure Speech, Volcano Engine |
58
+ | 📊 | **A2A Protocol** | Google Agent-to-Agent interoperability |
59
+
60
+ ---
61
+
62
+ ## 🏗️ Architecture
63
+
64
+ ```
65
+ ┌─────────────────────────────────────────────────┐
66
+ │ Channels │
67
+ │ Telegram · Discord · Slack · WeChat · Email
68
+ └──────────────────────┬──────────────────────────┘
69
+
70
+ ┌──────────────────────▼──────────────────────────┐
71
+ │ OPC Agent Runtime │
72
+ │ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │
73
+ │ │ Tool Exec│ │ Skills │ │ Memory/Know │ │
74
+ │ │ (53 tools)│ │(40 skills)│ │ Evolve Engine│ │
75
+ │ └──────────┘ └──────────┘ └──────────────┘ │
76
+ │ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │
77
+ │ │ Cron │ │ Voice │ │ MCP / A2A │ │
78
+ │ └──────────┘ └──────────┘ └──────────────┘ │
79
+ └──────────────────────┬──────────────────────────┘
80
+
81
+ ┌──────────────────────▼──────────────────────────┐
82
+ │ LLM Providers │
83
+ │ OpenAI · Anthropic · Ollama · Azure · Gemini │
84
+ └─────────────────────────────────────────────────┘
85
+ ```
86
+
87
+ ---
88
+
89
+ ## ⚙️ Configuration
90
+
91
+ Agents are defined with a single `oad.yaml` file:
92
+
93
+ ```yaml
94
+ name: my-agent
95
+ description: Customer support agent
96
+ model:
97
+ provider: ollama
98
+ model: llama3.1
99
+ channels:
100
+ - type: telegram
101
+ token: ${TELEGRAM_BOT_TOKEN}
102
+ - type: web
103
+ port: 4000
104
+ tools:
105
+ - file
106
+ - shell
107
+ - web-fetch
108
+ - browser
109
+ skills:
110
+ - weather
111
+ - github
112
+ memory:
113
+ provider: sqlite
114
+ cron:
115
+ - schedule: "0 9 * * *"
116
+ task: "Check and summarize overnight emails"
117
+ ```
118
+
119
+ ---
120
+
121
+ ## 🖥️ CLI Commands
122
+
123
+ | Command | Description |
124
+ |---------|-------------|
125
+ | `opc init [name]` | Create a new agent project |
126
+ | `opc run` | Start agent with all configured channels |
127
+ | `opc chat` | Interactive TUI chat in terminal |
128
+ | `opc studio` | Launch Studio GUI (port 4000) |
129
+ | `opc doctor` | Run 13 health checks |
130
+ | `opc setup` | Configure model provider & API keys |
131
+ | `opc eval` | Run evaluation test suite |
132
+ | `opc traces` | View OpenTelemetry traces |
133
+ | `opc publish` | Publish agent to npm |
134
+ | `opc skill list` | List available skills |
135
+ | `opc skill add <name>` | Add a skill to agent |
136
+ | `opc cron list` | List scheduled tasks |
137
+
138
+ ---
139
+
140
+ ## 📱 Channels
141
+
142
+ OPC Agent connects to **15+ messaging platforms** out of the box:
143
+
144
+ | Channel | Status | Channel | Status |
145
+ |---------|--------|---------|--------|
146
+ | Telegram | ✅ | Discord | ✅ |
147
+ | Slack | ✅ | WeChat | ✅ |
148
+ | Email (IMAP/SMTP) | ✅ | WhatsApp | ✅ |
149
+ | LINE | ✅ | Teams | ✅ |
150
+ | Feishu/Lark | ✅ | DingTalk | ✅ |
151
+ | Web UI | | WebSocket | ✅ |
152
+ | Webhook | ✅ | REST API | ✅ |
153
+ | Voice | | SMS (Twilio) | ✅ |
154
+
155
+ ---
156
+
157
+ ## 🔧 Tools (53)
158
+
159
+ ### Core (8)
160
+ `file-read` · `file-write` · `file-list` · `shell-exec` · `web-fetch` · `web-search` · `browser` · `vision`
161
+
162
+ ### Developer (12)
163
+ `git-status` · `git-diff` · `git-commit` · `github-issue` · `github-pr` · `github-search` · `npm-search` · `code-analyze` · `test-run` · `lint` · `deploy` · `docker`
164
+
165
+ ### Productivity (8)
166
+ `calendar` · `email-send` · `email-read` · `reminder` · `note` · `todo` · `timer` · `translate`
167
+
168
+ ### Integration (13)
169
+ `jira-issue` · `jira-search` · `slack-send` · `slack-read` · `notion-page` · `notion-search` · `linear-issue` · `confluence` · `trello` · `asana` · `zendesk` · `hubspot` · `salesforce`
170
+
171
+ ### Knowledge (7)
172
+ `memory-store` · `memory-recall` · `knowledge-learn` · `knowledge-evolve` · `rag-query` · `embedding` · `summarize`
173
+
174
+ ### Media (5)
175
+ `image-generate` · `image-describe` · `audio-transcribe` · `tts-speak` · `screenshot`
176
+
177
+ ---
178
+
179
+ ## 📊 Comparison
180
+
181
+ | Feature | OPC Agent | Hermes Agent | OpenClaw |
182
+ |---------|-----------|-------------|----------|
183
+ | Built-in tools | 53 | ~10 | 30+ |
184
+ | GUI (Studio) | | ❌ | ✅ |
185
+ | TUI Chat | | ❌ | ✅ |
186
+ | Channels | 15+ | 3 | 15+ |
187
+ | Built-in skills | 40 | ❌ | 40 |
188
+ | Knowledge evolution | ✅ | ❌ | ✅ |
189
+ | Voice (STT/TTS) | ✅ | ❌ | ✅ |
190
+ | MCP Protocol | ✅ | ✅ | ✅ |
191
+ | A2A Protocol | ✅ | ❌ | ✅ |
192
+ | Cron scheduler | ✅ | ❌ | ✅ |
193
+ | One-line install | | ❌ | ✅ |
194
+ | Health checks | 13 | ❌ | ✅ |
195
+ | Local-first (Ollama) | ✅ | ❌ | ✅ |
196
+ | Open source | Apache-2.0 | Proprietary | Apache-2.0 |
197
+
198
+ > **OPC Agent** is the open-source core runtime. **OpenClaw** is the full platform built on top of it.
199
+
200
+ ---
201
+
202
+ ## 🧠 Knowledge Evolve Engine
203
+
204
+ OPC Agent includes a built-in knowledge evolution pipeline that runs **entirely local** with Ollama:
205
+
206
+ ```
207
+ Conversations → Learn → Cluster → Deduplicate → Distill → Evolved Knowledge
208
+ ```
209
+
210
+ - **Zero API cost** — uses local Ollama models for distillation
211
+ - **Automatic** — learns from every conversation, evolves on schedule
212
+ - **Tiered memory** — short-term (conversation) → long-term (distilled) → evolved (refined)
213
+ - **Full-text search** — SQLite FTS5 for instant recall across all memory
214
+
215
+ ```bash
216
+ opc knowledge evolve # Trigger manual evolution
217
+ opc knowledge stats # View knowledge base stats
218
+ opc knowledge search "query" # Search across all knowledge
219
+ ```
220
+
221
+ ---
222
+
223
+ ## 🎨 Studio
224
+
225
+ Launch the visual management dashboard:
226
+
227
+ ```bash
228
+ opc studio
229
+ ```
230
+
231
+ Studio provides:
232
+ - **Agent overview** — status, model, channels, tools at a glance
233
+ - **Live chat** — test your agent in the browser
234
+ - **Configuration editor** — edit `oad.yaml` visually
235
+ - **Logs & traces** — real-time log streaming and OpenTelemetry traces
236
+ - **Skill browser** — discover and install skills
237
+ - **Cron manager** create and monitor scheduled tasks
238
+
239
+ ---
240
+
241
+ ## 🏥 Doctor
242
+
243
+ Run comprehensive health checks:
244
+
245
+ ```bash
246
+ opc doctor
247
+ ```
248
+
249
+ ```
250
+ ✅ Model provider connected (ollama/llama3.1)
251
+ ✅ 53/53 tools available
252
+ ✅ Memory store healthy (SQLite, 1,247 entries)
253
+ Telegram channel connected
254
+ ✅ Cron scheduler running (3 jobs)
255
+ ⚠️ No TTS provider configured
256
+ Disk space OK (12.3 GB free)
257
+ ...
258
+ ```
259
+
260
+ 13 checks covering: model connectivity, tool wiring, channel status, memory health, disk space, Node.js version, package updates, and more.
261
+
262
+ ---
263
+
264
+ ## 🤝 Contributing
265
+
266
+ We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
267
+
268
+ ```bash
269
+ git clone https://github.com/Deepleaper/opc-agent.git
270
+ cd opc-agent
271
+ npm install
272
+ npm run build
273
+ npm test
274
+ ```
275
+
276
+ ---
277
+
278
+ ## 📄 License
279
+
280
+ [Apache-2.0](LICENSE) © [Deepleaper](https://github.com/Deepleaper)
281
+
282
+ ---
283
+
284
+ <div align="center">
285
+
286
+ **If OPC Agent helps you build better agents, give us a ⭐**
287
+
288
+ [GitHub](https://github.com/Deepleaper/opc-agent) · [npm](https://www.npmjs.com/package/opc-agent) · [Docs](https://opc-agent.dev)
289
+
290
+ </div>