docs: 添加 Eino 框架参考文档

This commit is contained in:
hhs
2026-06-19 14:35:06 +08:00
parent 5d8cacf16d
commit 16302af7d2
99 changed files with 30486 additions and 0 deletions

View File

@@ -0,0 +1,98 @@
---
date: "2026-03-16"
tags: []
title: 快速开始
---
本篇文档用于作为 ChatWithEino Quickstart 的统一入口:用一条清晰的路径带你跑起来,并解释这个系列最终要交付什么(一个可扩展的端到端 Agent 应用骨架)。
## 这是什么
ChatWithEino 是一个基于 Eino 构建的学习型 Agent它能读取源码/文档/示例,并通过对话帮助开发者理解 Eino 以及用 Eino 写代码。
这个 Quickstart 系列采用"渐进式搭建"的方式:
- 前期以 Console 为载体,逐步引入 ChatModel、Agent/Runner、Memory、Tool、Middleware、Callback、Interrupt/Resume、Graph Tool、Skill
- 最终把同一个 Agent 以 Web 形态交付出来,并用 A2UI 协议把事件流渲染成可增量更新的 UI
## 最短路径:先跑起来
在仓库根目录执行:
```bash
git clone https://github.com/cloudwego/eino-examples.git
cd eino-examples/quickstart/chatwitheino
```
### 1) 最小 Console第一章
准备模型配置(以 OpenAI 为例):
```bash
export OPENAI_API_KEY="..."
export OPENAI_MODEL="gpt-4.1-mini"
```
运行:
```bash
go run ./cmd/ch01 -- "用一句话解释 Eino 的 Component 设计解决了什么问题?"
```
### 2) 最终 WebA2UI
```bash
go run .
```
启动后访问输出里的地址(默认 `http://localhost:8080`)。
### 3) (可选)开启 skills第九章能力复用
skills 用于把一组稳定的"知识/指令包"`SKILL.md` + `reference/*.md`)注入到 Agent让模型在需要时按需加载并调用。
```bash
go run ./scripts/sync_eino_ext_skills.go -src /path/to/eino-ext -dest ./skills/eino-ext -clean
EINO_EXT_SKILLS_DIR="$(pwd)/skills/eino-ext" go run .
```
说明:
- `./skills/` 目录默认被 `.gitignore` 忽略,避免把同步出来的 skills 误提交
- 如需验证 Skill 是否生效,可运行第九章示例入口代码:
- [https://github.com/cloudwego/eino-examples/blob/main/quickstart/chatwitheino/cmd/ch09/main.go](https://github.com/cloudwego/eino-examples/blob/main/quickstart/chatwitheino/cmd/ch09/main.go)
## 学习路线(章节导航)
<table>
<tr><td>章节</td><td>主题</td><td>入口</td></tr>
<tr><td>第一章</td><td>ChatModel 与 MessageConsole</td><td>https://github.com/cloudwego/eino-examples/blob/main/quickstart/chatwitheino/docs/ch01_chatmodel_agent_console.md</td></tr>
<tr><td>第二章</td><td>Agent 与 RunnerConsole 多轮)</td><td>https://github.com/cloudwego/eino-examples/blob/main/quickstart/chatwitheino/docs/ch02_chatmodel_agent_runner_console.md</td></tr>
<tr><td>第三章</td><td>Memory 与 Session持久化对话</td><td>https://github.com/cloudwego/eino-examples/blob/main/quickstart/chatwitheino/docs/ch03_memory_session_jsonl.md</td></tr>
<tr><td>第四章</td><td>Tool 与文件系统访问</td><td>https://github.com/cloudwego/eino-examples/blob/main/quickstart/chatwitheino/docs/ch04_tool_backend_filesystem.md</td></tr>
<tr><td>第五章</td><td>Middleware中间件模式</td><td>https://github.com/cloudwego/eino-examples/blob/main/quickstart/chatwitheino/docs/ch05_middleware.md</td></tr>
<tr><td>第六章</td><td>Callback 与 Trace可观测性</td><td>https://github.com/cloudwego/eino-examples/blob/main/quickstart/chatwitheino/docs/ch06_callback.md</td></tr>
<tr><td>第七章</td><td>Interrupt/Resume中断与恢复</td><td>https://github.com/cloudwego/eino-examples/blob/main/quickstart/chatwitheino/docs/ch07_interrupt_resume.md</td></tr>
<tr><td>第八章</td><td>Graph Tool复杂工作流</td><td>https://github.com/cloudwego/eino-examples/blob/main/quickstart/chatwitheino/docs/ch08_graph_tool.md</td></tr>
<tr><td>第九章</td><td>SkillConsole</td><td>https://github.com/cloudwego/eino-examples/blob/main/quickstart/chatwitheino/docs/ch09_skill.md</td></tr>
<tr><td>最终章</td><td>A2UIWeb</td><td>https://github.com/cloudwego/eino-examples/blob/main/quickstart/chatwitheino/docs/ch10_a2ui.md</td></tr>
</table>
## 最终交付:一个可扩展的端到端 Agent 应用骨架
你可以把这个 Quickstart 的最终产物理解为一套"可插拔的应用骨架",它把 Eino 的关键能力连成闭环:
- 运行时Runner 驱动执行,支持流式输出与事件模型
- 工具层:通过 Tool 接入文件系统/检索/工作流等能力
- 中间件:用 handler/middleware 承载重试、审批、错误处理等横切能力
- 人机协作interrupt/resume + checkpoint 支持审批、补参、分支选择等交互式流程
- 确定性编排composegraph/chain/workflow把复杂业务流程组织为可维护、可复用的执行图
- UI 交付:用 A2UI 把 Agent 的事件流映射为可增量渲染的 UI 组件树SSE 推送)
其中 A2UI 的边界需要明确:它不是 Eino 框架本身的一部分,而是业务层的 UI 协议/渲染方案。本 Quickstart 用它来展示"Agent 能力如何以产品形态呈现给用户",具体实现与协议细节以最终章为准。
## 下一步探索(从 Quickstart 到真实业务)
- 想系统理解 Eino 的组件抽象与用法:从第一章的 Component 入门开始,再按章节逐步补齐 Tool/Graph/Callback/Interrupt 等能力
- 想复用更大规模的知识与指令:对接 `eino-ext` 的 skills并通过 Skill 中间件按需加载
- 想把 Agent 做成业务产品参考最终章A2UI/Web把事件流、状态与交互打通再替换为你自己的 UI 形态与协议