docs(agentic): 补全 tier2 运行时架构图集(图1/2/4/6 svg + 图5/7/8 mermaid) + 官方术语校准
- 新增 svg: 01-系统全景 / 02-调用时序 / 04-ReAct循环流程 / 06-reuse边界全景 - 图说 md 补全 8 图 + 图5/7/8 mermaid + 术语映射 - 校准官方术语: Agent Service(REST+SSE) / Workspace(Local/Docker/E2B) / Event System(agentscope 2.0.3 源码实证) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0ff4d8cc48
commit
e6d87dc4f5
@ -1,6 +1,6 @@
|
||||
# tier2 agentic 运行时架构图说
|
||||
|
||||
> 🚧 评审版 · **金样板阶段**:图 3(运行时内部架构)已出 svg 样板,其余图待风格确认后批量补。
|
||||
> 🚧 评审版 · **全套 8 张已出**(5 张 svg 大图 + 3 张 mermaid)。
|
||||
> **这是什么**:tier2 自治富游戏生成轨——agentic 这条线的「看图入口」。把「编排 → 启动 → 调用 → 运行时 → 返回结果」这条生命周期,以及它在整体里的位置、内部怎么转,用一套架构图讲清。复杂重要的用 svg/png 高保真大图,简单的用 mermaid。颗粒度面向 vibecoding——看图能照着实现。
|
||||
> **给谁看**:要判断「整个 agentic 架构是不是想要的那个」的创始人;要照图实现的工程师 / vibecoding 的人。
|
||||
|
||||
@ -8,55 +8,171 @@
|
||||
|
||||
## 0. 阅读约定与同步纪律
|
||||
|
||||
- **映射的设计档**:本图说不另立设计,只把以下四份的设计「画出来」——《[自治富游戏引擎](自治富游戏引擎.md)》(范式)、《[tier2 四层工程架构](tier2四层工程架构.md)》(四层切分)、《[tier2 实现详设](tier2实现详设.md)》(契约 / spike runbook)、《[agentic 集成架构](agentic集成架构.md)》(控制 / 管理面)。所有运行时机制以 **agentscope 2.0.3 源码实证**为准(`/root/oss/agentscope`,已逐条核过)。
|
||||
- **同步纪律(创始人要求)**:**设计文档一变动,本图说与对应 svg 必须同步更新**,并在图脚注与提交信息里注明对应版本。这条已并入 wave 收口清单——图与设计不允许漂移。
|
||||
- **产物形式**:svg 入仓(GitHub / 编辑器直接渲染、矢量、可编辑),并转一份 png 一并入仓(保证任何渲染器都能看,png 在 mini-desktop 转——6c6g 禁 chrome、无 rsvg/cairosvg)。
|
||||
- **映射的设计档**:本图说不另立设计,只把以下四份「画出来」——《[自治富游戏引擎](自治富游戏引擎.md)》(范式)、《[tier2 四层工程架构](tier2四层工程架构.md)》(四层切分)、《[tier2 实现详设](tier2实现详设.md)》(契约 / spike runbook)、《[agentic 集成架构](agentic集成架构.md)》(控制 / 管理面)。所有运行时机制以 **agentscope 2.0.3 源码实证**为准(`/root/oss/agentscope`,已逐条核过)。
|
||||
- **同步纪律(创始人要求)**:**设计文档一变动,本图说与对应 svg 必须同步更新**,并在图脚注注明对应版本。已并入 wave 收口清单——图与设计不允许漂移。
|
||||
- **产物形式**:svg 入仓(GitHub / 编辑器直接渲染矢量、可编辑),并转一份 png 一并入仓(png 在 mini-desktop 转——6c6g 禁 chrome、无转换器)。
|
||||
|
||||
## 1. 生产维度图例(大厂生产环境关心的领域)
|
||||
## 1. 全图通用图例
|
||||
|
||||
架构图不只画「功能怎么连」,还要让人一眼看到「生产环境怎么保证它可靠、可观测、安全、可扩展、成本可控」。所以每张图都带这套**生产维度标注**,相关组件上挂对应标签:
|
||||
每张图都带两套贯穿标注:
|
||||
|
||||
| 维度 | 在架构里的落点 |
|
||||
**生产维度(大厂生产环境关心的领域)**——架构图不只画「功能怎么连」,还要让人一眼看到生产环境怎么保证它可靠、可观测、安全、可扩展、成本可控:
|
||||
|
||||
| 维度 | 落点 |
|
||||
|---|---|
|
||||
| **安全** | 沙箱隔离、密钥(`NEWAPI_KEY`)只走 env 不入库、forbidden-import 守门、LLM 产物消毒 |
|
||||
| **可观测** | TracingMiddleware → OpenTelemetry → Studio(trace / token / cost) |
|
||||
| **可靠** | 四熔断、checkpoint 中断恢复、HITL 中断/恢复、超时与重试 |
|
||||
| **成本** | 预算闸(token 软刹 + 金额硬杀)、new-api quota 台账 |
|
||||
| **数据** | 会话状态(Redis)、产物落库(MySQL+OSS)、内容哈希校验 |
|
||||
| **伸缩** | `create_app` 多实例、多租户、会话隔离 |
|
||||
| **质量** | 双层验收门(确定性硬门 + M3 视觉软检) |
|
||||
| 安全 | Workspace 沙箱隔离、密钥(`NEWAPI_KEY`)只走 env 不入库、forbidden-import、产物消毒 |
|
||||
| 可观测 | Event System(typed stream)→ TracingMiddleware → OpenTelemetry → Studio |
|
||||
| 可靠 | 四熔断、checkpoint 中断恢复、HITL、durable session、provider fallback |
|
||||
| 成本 | 预算闸(token 软刹 + 金额硬杀)、new-api quota 台账 |
|
||||
| 数据 | 会话状态(Redis)、产物落库(MySQL+OSS)、内容哈希 |
|
||||
| 伸缩 | `create_app` 多实例、多租户、会话隔离 |
|
||||
| 质量 | 双层验收门(确定性硬门 + M3 视觉软检) |
|
||||
|
||||
另有一套**复用边界图例**贯穿全图,让 vibecoding 的人一眼知道哪些是「直接用现成的」、哪些要「自己写」:**实线框 = AgentScope 生态官方现成直接用;虚线框 = tier2 自建(挂在官方 Middleware 或薄层上);双线框 = 两条生成线共享的公共组件**。
|
||||
**复用边界**:**实线 = AgentScope 生态官方现成直接用;虚线 = tier2 自建(挂官方 Middleware 或薄层);双线 = 两条生成线共享的公共组件**。
|
||||
|
||||
## 2. 图 3 · 运行时内部架构(金样板)
|
||||
## 2. 图集
|
||||
|
||||
### 图 1 · 系统全景 / 部署
|
||||
|
||||

|
||||
|
||||
最高层定位:tier2 agentic 是一个**独立 service**,`game-cloud`(Java)通过官方 **Agent Service 的 REST 端点 + SSE 事件流**调它;它向上经 **new-api 网关**(统一出口、协议不锁)调模型,向内用 **Workspace**(Local/Docker/E2B 沙箱)干活,把会话/产物落到 Redis/MySQL/OSS,并把 trace 导出到 Studio。它与现行 **SAA 廉价线运行期零耦合**——两条生成线只在「计费 / 送审 / feed / 验收基线」这些**公共组件**上交汇。
|
||||
|
||||
### 图 2 · 调用时序(cloud ↔ agentic)
|
||||
|
||||

|
||||
|
||||
你最关心的「cloud 怎么调 agentic API」。关键是 **tier2 不自造 API,直接用官方 Agent Service**:cloud 用 `POST /sessions` 建一个 durable 会话并触发 run,再用 `GET /sessions/{id}/events` 订阅一条 **SSE 事件流**。运行时每一步(thinking / tool / result)作为 **Event** 经 SSE 流式推给 cloud;这条流是**可恢复的**——断线重连会 replay 已缓冲的事件。中途可挂起做 HITL(让人确认/编辑工具参数)再精确恢复,也可随时取消 session。产物落库后,cloud 收到完成 event(verdict + 产物引用),取回进 feed。
|
||||
|
||||
### 图 3 · 运行时内部架构
|
||||
|
||||

|
||||
|
||||
这张图回答你一直没看到的那块——**agentic 运行时内部到底怎么转**。从外到内读:
|
||||
运行时内部怎么转:中心是**单写者 ReAct 循环**(官方 `Agent` + `ReActConfig`,一个 agent 持全局、独自写,不并行拆),每轮推理→调工具→观测→验收,没过走 repair 回环。外圈 **Middleware 洋葱**关熔断(预算软刹是官方现成的,超时/卡死/fail-closed 硬杀自建挂上去)。循环向右连 environment 沙箱工作站(写码/构建/真跑,CDP 探针是公共件)、向下连 M3(Anthropic 原生 thinking)、左下挂记忆(ReMe)。产物经**双层验收门**判定(确定性硬门定 pass/fail、零 LLM 自评;M3 软检只观测)。底部是 checkpoint / 落库 / 可观测三件生产基础设施。
|
||||
|
||||
整台机器是一个**独立进程的 service**(AgentScope 2.0.3,用官方 `create_app` 起成一个多租户、多会话的 FastAPI 服务),运行期与现有 SAA 廉价线零耦合。`game-cloud`(Java)通过一条 HTTP 接口把生成请求(一句话 brief + play_spec)发进来,API/Session 层据此建一个会话、起一个异步长任务,并把 runId 立即返回——因为造一款富游戏是长时任务,这里天然要会话、可中断(HITL)、可取消、会话之间互相隔离。
|
||||
### 图 4 · 单写者 ReAct 循环流程(一轮迭代)
|
||||
|
||||
请求进入后,核心是中间那个**单写者 ReAct 循环**:只有一个 Agent 持全局视图、独自写整个工程(经营游戏多系统共享状态,拆并行几乎必然不一致)。这个循环本身是 AgentScope 官方现成的——`Agent` + `ReActConfig(max_iters)`,不需要我们自建。它每一轮做四件事:**推理**(调 M3 模型)、**调工具**(在沙箱里写码、构建、真跑)、**观测**(收回产物和截图)、**验收裁决**(过 / 修 / 熔断)。模型某一轮产出纯文本、不再调工具,就是它认为「做完了」;到迭代上限或熔断触发,则优雅收尾。没过的轮次走 repair 回环,同一个 agent 继续修——不拆并行。
|
||||

|
||||
|
||||
把这个循环「关进笼子」的是外面那圈 **Middleware 洋葱**。预算软刹是官方现成的 `ReplyBudgetControlMiddleware`(到额就注入提示、逼模型收尾);但生产真正要的「超时、卡死探测、超额即硬性熔断(fail-closed)」官方没有,得我们照官方 middleware 的写法自建,挂在同样的扩展点上。一条贯穿的铁律标在图里:**确定性的归机器、绝不让 LLM 给自己打分;M3 的视觉软检永远只观测、不放行也不拒发**(防 Goodhart)。
|
||||
把图 3 中心那个循环展开成一轮的控制流:组装 context → reason 调 M3 → 判断「调工具还是收尾」。调工具就去 Workspace 写码/构建/真跑、CDP 取证、过双层验收;没过回 repair 重组 context 再来。模型某轮直接产纯文本(不调工具)就是收尾、出产物。右侧四熔断任一触发即优雅收尾,每轮 checkpoint。
|
||||
|
||||
循环向外连三处。向右是 **environment 沙箱工作站**——agent 在这里用 Filesystem 写多文件源码、用 CODE 跑 esbuild 构建、用 Browser 起 headless 真跑加截图。这里有个关键的生产现实:官方 Browser 沙箱不暴露底层 `page.evaluate`,而 tier2 的确定性验收探针(注入输入、读帧、像素回读、活动 hash)全靠它,所以 **CDP 探针是一块公共组件**(双线框),靠同容器的 `run_shell_command` 自驱补上。向下是 **Model**——官方 `AnthropicChatModel`,开 thinking(thinking_enable + budget,thinking 自然分离),baseUrl 指向 new-api 的 `/v1/messages` 端点、用 `NEWAPI_KEY`,统一出口、协议不锁。左下是 **context 运行时载荷**——记忆用官方 ReMe(持久 + 检索 + 压缩),其中「按签名精确命中 debug 案例库」官方没有、是一层自建薄层;prompt 是 context 的子集,走热配置。
|
||||
### 图 5 · 编排与配置结构
|
||||
|
||||
循环跑出来的产物,由右下的**双层验收门**判定:确定性硬门(九门 + 跨表联动 + 经济门,公共 CDP harness,零 LLM 自评,定 pass/fail)是机制地板;M3 视觉软检只产观测和告警,绝不参与「算不算完成」。最底下是**运行时基础设施**——会话状态 checkpoint 到 Redis(可中断恢复)、结构化游戏源项目落库到 MySQL+OSS(带内容哈希)、全程可观测经 TracingMiddleware → OpenTelemetry → Studio。全绿的产物落库后,runId 对应的结果就能被 game-cloud 取回、进 feed。
|
||||
「编排 agentic」= 写一次代码骨架(`create_app` 起服务 + 组装 Agent 的 model/toolkit/middleware/memory/react_config),「配置」= 三类外置(机制硬代码、安全/构建走版本化审计、策略热改不发版)。不是 Dify 那种可视化拖拽,但策略层可配热改、不必每次改代码重部署。
|
||||
|
||||
## 3. 图清单与进度
|
||||
```mermaid
|
||||
flowchart TB
|
||||
APP["create_app(FastAPI)<br/>REST + SSE · 多租户 · durable"]
|
||||
subgraph 编排["编排(代码骨架 · 建一次)"]
|
||||
AG["Agent"]
|
||||
AG --> M["model:AnthropicChatModel(M3)"]
|
||||
AG --> TK["toolkit:Workspace 工具 + CDP 探针"]
|
||||
AG --> MW["middlewares:预算软刹(官方) + 超时/卡死/硬杀(自建)"]
|
||||
AG --> MEM["memory:ReMe"]
|
||||
AG --> RC["react_config:max_iters"]
|
||||
end
|
||||
subgraph 配置["配置外置(三类)"]
|
||||
H["硬代码·机制<br/>门断言 / 熔断 / 权限上限"]
|
||||
V["版本化·审计<br/>依赖锁 / 引擎版本 / 构建 profile / 沙箱类型"]
|
||||
HOT["热配置·策略<br/>prompt / 模型路由 / 阈值 / RAG 源"]
|
||||
end
|
||||
APP --> AG
|
||||
HOT -. 改配置不发版 .-> AG
|
||||
```
|
||||
|
||||
以你的 5 步生命周期为主轴 + 3 张横切补全:
|
||||
### 图 6 · 复用边界全景(官方 / 自建 / 公共)
|
||||
|
||||
| # | 图 | 讲清什么 | 形式 | 状态 |
|
||||

|
||||
|
||||
把「优先用官方」这条原则画成三色边界:左列是 AgentScope 生态直接用的(循环/工具/中间件/M3 接入/沙箱/服务化/记忆/可观测/HITL/结构化产出,一大列),中列是 tier2 真正要自建的(超时/卡死/硬杀熔断、金额成本、签名案例库、引擎 manifest、源项目契约、fixtures——都挂在官方扩展点或薄层上),右列是两条生成线共享、不进 tier2 私有的公共组件(验收基线/计费/送审/feed/trace 契约/new-api)。一眼看出自研面其实很小。
|
||||
|
||||
### 图 7 · 产物与契约
|
||||
|
||||
返回的产物不是一个打包 blob,而是一个**结构化源项目**(改源不改包、重新构建),由 tier2 源项目契约钉住其文件树/构建/依赖/落库;过程则由 trace 契约记录(公共核心子集 + 各线自己的扩展段)。
|
||||
|
||||
```mermaid
|
||||
flowchart TB
|
||||
subgraph SP["tier2 源项目契约(落库取回)"]
|
||||
direction LR
|
||||
ID["类型标记"] --- TREE["文件树 manifest<br/>+ 入口文件"] --- BUILD["构建 profile<br/>+ 依赖锁"] --- HASH["内容哈希"] --- DBAPI["落库 / 寻址<br/>MySQL + OSS"]
|
||||
end
|
||||
subgraph TR["trace 契约(可观测)"]
|
||||
direction LR
|
||||
CORE["公共核心子集<br/>traceId / step / cost / verdict / ts"] --- EXT["扩展段 JSON<br/>tier2:推理 / 动作 / 观察"]
|
||||
end
|
||||
SP -.->|改源不改包·重新构建·长生命周期| OUT["可维护的 Phaser 源工程"]
|
||||
```
|
||||
|
||||
### 图 8 · 关键类图
|
||||
|
||||
让 vibecoding 的人知道用哪些类、怎么组合:实线类是 AgentScope 官方的,`<<自建>>` 标注的是 tier2 挂在官方基类上写的。
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
class Agent {
|
||||
+reply()
|
||||
+react_config
|
||||
+middlewares
|
||||
}
|
||||
class ReActConfig {
|
||||
+max_iters
|
||||
}
|
||||
class Toolkit {
|
||||
+register_tool_function()
|
||||
}
|
||||
class MiddlewareBase {
|
||||
+on_reasoning()
|
||||
+on_model_call()
|
||||
}
|
||||
class ReplyBudgetControlMiddleware
|
||||
class TimeoutMiddleware
|
||||
class StuckDetectMiddleware
|
||||
class AnthropicChatModel {
|
||||
+thinking_enable
|
||||
+thinking_budget
|
||||
+credential.base_url
|
||||
}
|
||||
class AgentState {
|
||||
+cur_iter
|
||||
+context
|
||||
}
|
||||
class WorkspaceBase
|
||||
Agent --> ReActConfig
|
||||
Agent --> Toolkit
|
||||
Agent --> MiddlewareBase
|
||||
Agent --> AnthropicChatModel
|
||||
Agent --> AgentState
|
||||
MiddlewareBase <|-- ReplyBudgetControlMiddleware
|
||||
MiddlewareBase <|-- TimeoutMiddleware
|
||||
MiddlewareBase <|-- StuckDetectMiddleware
|
||||
WorkspaceBase <|-- LocalWorkspace
|
||||
WorkspaceBase <|-- DockerWorkspace
|
||||
WorkspaceBase <|-- E2BWorkspace
|
||||
note for TimeoutMiddleware "自建"
|
||||
note for StuckDetectMiddleware "自建"
|
||||
```
|
||||
|
||||
## 3. 图清单与状态
|
||||
|
||||
| # | 图 | 覆盖步骤 | 形式 | 状态 |
|
||||
|---|---|---|---|---|
|
||||
| 1 | 系统全景 / 部署 | agentic 是独立 service,cloud 经 HTTP 调它;连 new-api / 沙箱 / 存储 / Studio | svg | 待出 |
|
||||
| 2 | 调用时序(cloud ↔ agentic) | 发起 → 建 session → 异步长任务 → 进度/取消 → 产出落库 → 回 verdict | svg | 待出 |
|
||||
| **3** | **运行时内部架构(四层 + 组件)** | 运行时怎么转:单写者循环 / 沙箱 / 熔断 / M3 / 记忆 / 验收 / 可观测 | **svg** | **✅ 金样板** |
|
||||
| 4 | 单写者 ReAct 循环流程 | 一轮:组 context → 调 M3 → 决策 → 写码/构建/真跑 → 观测 → 验收 → 过/修/熔断 | svg | 待出 |
|
||||
| 5 | 编排与配置结构 | `create_app` 骨架 + Agent 组装 + 三类配置(硬代码/版本化/热改) | mermaid | 待出 |
|
||||
| 6 | reuse 边界全景 | AgentScope 现货 / 自建 / 公共组件 三色边界 | svg | 待出 |
|
||||
| 7 | 产物与契约 | 源项目契约 + trace 契约 | mermaid | 待出 |
|
||||
| 8 | 关键类图 | AgentScope 类 + tier2 自建类 | mermaid | 待出 |
|
||||
| 1 | 系统全景 / 部署 | 定位 | svg | ✅ |
|
||||
| 2 | 调用时序(cloud ↔ agentic) | 启动 + 调用 + 返回 | svg | ✅ |
|
||||
| 3 | 运行时内部架构 | 运行时 | svg | ✅ |
|
||||
| 4 | 单写者 ReAct 循环流程 | 运行时动态 | svg | ✅ |
|
||||
| 5 | 编排与配置结构 | 编排 + 配置 | mermaid | ✅ |
|
||||
| 6 | reuse 边界全景 | 复用边界 | svg | ✅ |
|
||||
| 7 | 产物与契约 | 返回形态 | mermaid | ✅ |
|
||||
| 8 | 关键类图 | 实现 | mermaid | ✅ |
|
||||
|
||||
> 金样板(图 3)的风格 / 颗粒度 / 生产维度标注经创始人确认后,再按此清单批量补全其余 7 张,并统一转 png 入仓。
|
||||
## 4. 术语映射(图 3 沿用旧词,此处对齐官方)
|
||||
|
||||
图 3(先出的金样板)用了「沙箱 / API-Session / 可观测」等旧词,与 AgentScope 2.0 官方术语对应如下,后续若重绘图 3 一并对齐:
|
||||
|
||||
| 图里旧词 | AgentScope 2.0 官方 |
|
||||
|---|---|
|
||||
| 沙箱工作站 | **Workspace**(LocalWorkspace / DockerWorkspace / E2BWorkspace) |
|
||||
| API / Session 层 | **Agent Service**(REST + SSE,`/sessions` 等) |
|
||||
| 可观测(OTel) | **Event System**(typed stream)→ TracingMiddleware → Studio |
|
||||
| 熔断(Middleware) | **Middleware 洋葱**(`on_reasoning` / `on_model_call` …) |
|
||||
| checkpoint | **AgentState**(pydantic)+ StorageBase(Redis) |
|
||||
|
||||
116
docs/architecture/架构/生成引擎/assets/01-系统全景.svg
Normal file
116
docs/architecture/架构/生成引擎/assets/01-系统全景.svg
Normal file
@ -0,0 +1,116 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1480 700" font-family="-apple-system,'PingFang SC','Microsoft YaHei',Segoe UI,sans-serif">
|
||||
<defs>
|
||||
<marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto" markerUnits="strokeWidth"><path d="M0,0 L8,3 L0,6 Z" fill="#334155"/></marker>
|
||||
<marker id="arrowB" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto" markerUnits="strokeWidth"><path d="M0,0 L8,3 L0,6 Z" fill="#64748b"/></marker>
|
||||
<style>
|
||||
.t{fill:#0f172a}.mut{fill:#475569}.sm{font-size:12px}.xs{font-size:11px}
|
||||
.h1{font-size:24px;font-weight:700}.h2{font-size:15px;font-weight:700}.lbl{font-size:13px;font-weight:600}
|
||||
.flow{stroke:#334155;stroke-width:2;fill:none}.flowb{stroke:#64748b;stroke-width:1.5;fill:none;stroke-dasharray:5 4}
|
||||
.badge{font-size:10.5px;font-weight:700}
|
||||
</style>
|
||||
</defs>
|
||||
<rect x="0" y="0" width="1480" height="700" fill="#f8fafc"/>
|
||||
<text x="40" y="40" class="t h1">图 1 · 系统全景 / 部署</text>
|
||||
<text x="40" y="60" class="mut sm">tier2 agentic 是独立 service,game-cloud 经 HTTP API 调用;运行期与 SAA 廉价线零耦合;模型统一经 new-api。</text>
|
||||
|
||||
<!-- game-cloud -->
|
||||
<rect x="40" y="90" width="370" height="400" rx="12" fill="#e2e8f0" stroke="#0f172a" stroke-width="2"/>
|
||||
<text x="55" y="113" class="t h2">game-cloud(Java · 调用方 + 公共组件宿主)</text>
|
||||
<rect x="55" y="124" width="340" height="44" rx="7" fill="#ffffff" stroke="#0f172a" stroke-width="1.4"/>
|
||||
<text x="65" y="151" class="t sm">生成请求编排(dispatcher)</text>
|
||||
<rect x="55" y="176" width="340" height="42" rx="7" fill="#ffffff" stroke="#2563eb" stroke-width="2.4"/>
|
||||
<text x="65" y="202" class="t sm">计费台账(读 new-api quota)〔公共〕</text>
|
||||
<rect x="55" y="226" width="340" height="42" rx="7" fill="#ffffff" stroke="#2563eb" stroke-width="2.4"/>
|
||||
<text x="65" y="252" class="t sm">送审 / 审核台〔公共〕</text>
|
||||
<rect x="55" y="276" width="340" height="42" rx="7" fill="#ffffff" stroke="#2563eb" stroke-width="2.4"/>
|
||||
<text x="65" y="302" class="t sm">feed / 发布〔公共〕</text>
|
||||
<rect x="55" y="326" width="340" height="56" rx="7" fill="#ffffff" stroke="#2563eb" stroke-width="2.8"/>
|
||||
<text x="65" y="348" class="t sm">CDP 验收基线(公共 harness)〔公共·双线〕</text>
|
||||
<text x="65" y="368" class="mut xs">九门确定性验收,两线共享,泛化 Phaser</text>
|
||||
<text x="55" y="408" class="mut xs">公共组件 = 两条生成线共享,不进 tier2 私有</text>
|
||||
<rect x="55" y="420" width="80" height="18" rx="3" fill="#dc2626"/><text x="60" y="433" class="badge" fill="#fff">安全</text>
|
||||
<rect x="142" y="420" width="80" height="18" rx="3" fill="#15803d"/><text x="147" y="433" class="badge" fill="#fff">质量</text>
|
||||
|
||||
<!-- tier2 agentic service -->
|
||||
<rect x="440" y="90" width="470" height="400" rx="12" fill="#f0fdf4" stroke="#16a34a" stroke-width="2.5"/>
|
||||
<text x="456" y="113" class="t h2">tier2 agentic service 〔主角〕</text>
|
||||
<text x="456" y="132" class="mut xs">独立进程 / 容器 · AgentScope 2.0.3 · create_app(FastAPI)</text>
|
||||
<rect x="458" y="144" width="434" height="46" rx="8" fill="#dcfce7" stroke="#16a34a" stroke-width="1.6"/>
|
||||
<text x="468" y="166" class="t sm">Agent Service(REST + SSE)</text>
|
||||
<text x="468" y="183" class="mut xs">多租户 · 会话 · HITL · 取消 · /sessions /chat /schedule</text>
|
||||
<rect x="458" y="198" width="434" height="66" rx="8" fill="#ffffff" stroke="#16a34a" stroke-width="2"/>
|
||||
<text x="468" y="222" class="t lbl">单写者 ReAct 循环(详见图 3)</text>
|
||||
<text x="468" y="244" class="mut xs">Agent + ReActConfig + Middleware 熔断 + 四层载荷</text>
|
||||
<rect x="458" y="272" width="212" height="44" rx="8" fill="#f5f3ff" stroke="#7c3aed" stroke-width="1.6"/>
|
||||
<text x="468" y="299" class="t sm">Model 适配 → new-api</text>
|
||||
<rect x="680" y="272" width="212" height="44" rx="8" fill="#eff6ff" stroke="#2563eb" stroke-width="1.6"/>
|
||||
<text x="690" y="299" class="t sm">Workspace(Local/Docker/E2B)</text>
|
||||
<rect x="458" y="324" width="212" height="44" rx="8" fill="#fffbeb" stroke="#d97706" stroke-width="1.6"/>
|
||||
<text x="468" y="351" class="t sm">checkpoint / 记忆</text>
|
||||
<rect x="680" y="324" width="212" height="44" rx="8" fill="#f1f5f9" stroke="#475569" stroke-width="1.6"/>
|
||||
<text x="690" y="351" class="t sm">可观测(OTel 导出)</text>
|
||||
<g class="badge"><rect x="458" y="382" width="62" height="18" rx="3" fill="#dc2626"/><text x="463" y="395" fill="#fff">安全</text>
|
||||
<rect x="527" y="382" width="62" height="18" rx="3" fill="#7c3aed"/><text x="532" y="395" fill="#fff">伸缩</text>
|
||||
<rect x="596" y="382" width="62" height="18" rx="3" fill="#16a34a"/><text x="601" y="395" fill="#fff">可靠</text>
|
||||
<rect x="665" y="382" width="62" height="18" rx="3" fill="#0ea5e9"/><text x="670" y="395" fill="#fff">可观测</text></g>
|
||||
<text x="458" y="420" class="mut xs">内部运行时怎么转 → 图 3;调用时序 → 图 2</text>
|
||||
|
||||
<!-- right column -->
|
||||
<rect x="940" y="90" width="500" height="92" rx="12" fill="#f5f3ff" stroke="#7c3aed" stroke-width="2"/>
|
||||
<text x="956" y="113" class="t h2">new-api 网关(统一出口·协议不锁)</text>
|
||||
<text x="956" y="135" class="mut xs">/v1/messages(M3 Anthropic 原生) · /v1/chat/completions(OpenAI)</text>
|
||||
<text x="956" y="154" class="mut xs">NEWAPI_KEY 驱动 · quota 计费</text>
|
||||
<rect x="1380" y="96" width="52" height="18" rx="3" fill="#16a34a"/><text x="1385" y="109" class="badge" fill="#fff">成本</text>
|
||||
|
||||
<rect x="940" y="200" width="500" height="64" rx="12" fill="#ffffff" stroke="#7c3aed" stroke-width="1.6"/>
|
||||
<text x="956" y="226" class="t h2">上游模型</text>
|
||||
<text x="956" y="248" class="mut xs">MiniMax-M3(主) / deepseek-v4-flash·pro / Opus·Fable(基线)</text>
|
||||
|
||||
<rect x="940" y="284" width="500" height="92" rx="12" fill="#eff6ff" stroke="#2563eb" stroke-width="2"/>
|
||||
<text x="956" y="307" class="t h2">Workspace 工作站(Local / Docker / E2B)</text>
|
||||
<text x="956" y="329" class="mut xs">Filesystem(写 src/) · CODE(esbuild) · Browser(headless)</text>
|
||||
<text x="956" y="348" class="mut xs">+ CDP 探针〔公共〕同容器 run_shell_command 自驱</text>
|
||||
<rect x="1380" y="290" width="52" height="18" rx="3" fill="#dc2626"/><text x="1385" y="303" class="badge" fill="#fff">安全</text>
|
||||
|
||||
<rect x="940" y="394" width="500" height="74" rx="12" fill="#f1f5f9" stroke="#475569" stroke-width="2"/>
|
||||
<text x="956" y="417" class="t h2">AgentScope Studio(可观测 dashboard)</text>
|
||||
<text x="956" y="439" class="mut xs">OTel trace 可视化:reasoning / tool-call / token / cost</text>
|
||||
<text x="956" y="458" class="mut xs">as_studio · :3000(UI) / :4317(OTLP)</text>
|
||||
<rect x="1380" y="400" width="52" height="18" rx="3" fill="#0ea5e9"/><text x="1385" y="413" class="badge" fill="#fff">观测</text>
|
||||
|
||||
<!-- 存储带 -->
|
||||
<rect x="40" y="510" width="870" height="80" rx="12" fill="#f1f5f9" stroke="#475569" stroke-width="2"/>
|
||||
<text x="55" y="533" class="t h2">持久化 〔数据〕</text>
|
||||
<rect x="55" y="542" width="270" height="36" rx="7" fill="#fff" stroke="#475569" stroke-width="1.4"/><text x="65" y="565" class="t xs">Redis(会话 / checkpoint)</text>
|
||||
<rect x="335" y="542" width="270" height="36" rx="7" fill="#fff" stroke="#475569" stroke-width="1.4"/><text x="345" y="565" class="t xs">MySQL(产物元 / 业务)</text>
|
||||
<rect x="615" y="542" width="285" height="36" rx="7" fill="#fff" stroke="#475569" stroke-width="1.4"/><text x="625" y="565" class="t xs">OSS(产物文件 · 内容哈希)</text>
|
||||
|
||||
<!-- SAA 零耦合 -->
|
||||
<rect x="940" y="510" width="500" height="80" rx="12" fill="#ffffff" stroke="#94a3b8" stroke-width="2" stroke-dasharray="7 5"/>
|
||||
<text x="956" y="535" class="t h2">SAA 廉价线(Tier0/1 · Java)</text>
|
||||
<text x="956" y="558" class="mut xs">现行生成主线;与本 service <tspan font-weight="700" fill="#b91c1c">运行期零耦合 · 可删</tspan></text>
|
||||
<text x="956" y="578" class="mut xs">两线只经公共组件(计费/送审/feed/验收基线)交汇</text>
|
||||
|
||||
<!-- 连线 -->
|
||||
<line x1="410" y1="190" x2="440" y2="190" class="flow" marker-end="url(#arrow)"/>
|
||||
<text x="300" y="180" class="xs mut">REST POST /sessions</text>
|
||||
<line x1="440" y1="226" x2="410" y2="226" class="flowb" marker-end="url(#arrowB)"/>
|
||||
<text x="300" y="246" class="xs mut">SSE event-stream(可恢复)</text>
|
||||
|
||||
<line x1="910" y1="150" x2="940" y2="135" class="flow" marker-end="url(#arrow)"/>
|
||||
<text x="700" y="130" class="xs mut">模型调用 /v1/messages</text>
|
||||
<line x1="1190" y1="182" x2="1190" y2="200" class="flow" marker-end="url(#arrow)"/>
|
||||
<line x1="910" y1="305" x2="940" y2="320" class="flow" marker-end="url(#arrow)"/>
|
||||
<text x="700" y="335" class="xs mut">写码/构建/真跑</text>
|
||||
<line x1="910" y1="360" x2="940" y2="428" class="flow" marker-end="url(#arrow)"/>
|
||||
<text x="700" y="430" class="xs mut">OTel trace</text>
|
||||
<line x1="600" y1="490" x2="600" y2="508" class="flow" marker-end="url(#arrow)"/>
|
||||
<text x="610" y="504" class="xs mut">会话 / 产物落库</text>
|
||||
|
||||
<!-- 图例 -->
|
||||
<text x="40" y="630" class="t h2">复用边界:</text>
|
||||
<rect x="160" y="616" width="34" height="20" rx="5" fill="#fff" stroke="#16a34a" stroke-width="2"/><text x="202" y="631" class="t xs">实线〔官方现成〕</text>
|
||||
<rect x="360" y="616" width="34" height="20" rx="5" fill="#fff" stroke="#475569" stroke-width="1.8" stroke-dasharray="6 4"/><text x="402" y="631" class="t xs">虚线〔自建/零耦合〕</text>
|
||||
<rect x="580" y="616" width="34" height="20" rx="5" fill="#fff" stroke="#2563eb" stroke-width="2.8"/><text x="622" y="631" class="t xs">双线〔公共组件〕</text>
|
||||
<text x="40" y="668" class="mut xs">映射:agentic集成架构.md · tier2四层工程架构.md | 基于 agentscope 2.0.3 源码实证 | 设计变动须同步本图</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 9.8 KiB |
95
docs/architecture/架构/生成引擎/assets/02-调用时序.svg
Normal file
95
docs/architecture/架构/生成引擎/assets/02-调用时序.svg
Normal file
@ -0,0 +1,95 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1480 1010" font-family="-apple-system,'PingFang SC','Microsoft YaHei',Segoe UI,sans-serif">
|
||||
<defs>
|
||||
<marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto" markerUnits="strokeWidth"><path d="M0,0 L8,3 L0,6 Z" fill="#334155"/></marker>
|
||||
<marker id="arrowB" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto" markerUnits="strokeWidth"><path d="M0,0 L8,3 L0,6 Z" fill="#0ea5e9"/></marker>
|
||||
<style>
|
||||
.t{fill:#0f172a}.mut{fill:#475569}.sm{font-size:12px}.xs{font-size:11px}
|
||||
.h1{font-size:24px;font-weight:700}.h2{font-size:14px;font-weight:700}.lbl{font-size:13px;font-weight:600}
|
||||
.req{stroke:#334155;stroke-width:1.8;fill:none}.sse{stroke:#0ea5e9;stroke-width:1.8;fill:none;stroke-dasharray:6 3}
|
||||
.life{stroke:#94a3b8;stroke-width:1.4;stroke-dasharray:3 4}.badge{font-size:10.5px;font-weight:700}
|
||||
</style>
|
||||
</defs>
|
||||
<rect x="0" y="0" width="1480" height="1010" fill="#f8fafc"/>
|
||||
<text x="40" y="38" class="t h1">图 2 · 调用时序(cloud ↔ agentic)</text>
|
||||
<text x="40" y="58" class="mut sm">cloud 直接用官方 Agent Service:REST 建会话 + SSE 收流式 Event;durable session 可恢复、可取消、支持 HITL。蓝色虚线 = SSE 事件流。</text>
|
||||
|
||||
<!-- 泳道头 -->
|
||||
<rect x="50" y="78" width="280" height="52" rx="10" fill="#e2e8f0" stroke="#0f172a" stroke-width="2"/>
|
||||
<text x="190" y="100" text-anchor="middle" class="t lbl">game-cloud(Java)</text>
|
||||
<text x="190" y="119" text-anchor="middle" class="mut xs">调用方</text>
|
||||
<rect x="410" y="78" width="300" height="52" rx="10" fill="#f0fdf4" stroke="#16a34a" stroke-width="2"/>
|
||||
<text x="560" y="100" text-anchor="middle" class="t lbl">Agent Service〔官方〕</text>
|
||||
<text x="560" y="119" text-anchor="middle" class="mut xs">REST + SSE · 多租户 · durable</text>
|
||||
<rect x="780" y="78" width="280" height="52" rx="10" fill="#dcfce7" stroke="#16a34a" stroke-width="2"/>
|
||||
<text x="920" y="100" text-anchor="middle" class="t lbl">运行时(单写者循环)</text>
|
||||
<text x="920" y="119" text-anchor="middle" class="mut xs">Agent + Middleware</text>
|
||||
<rect x="1130" y="78" width="300" height="52" rx="10" fill="#eff6ff" stroke="#2563eb" stroke-width="2"/>
|
||||
<text x="1280" y="100" text-anchor="middle" class="t lbl">依赖</text>
|
||||
<text x="1280" y="119" text-anchor="middle" class="mut xs">new-api · Workspace · 存储 · Studio</text>
|
||||
|
||||
<!-- 生命线 -->
|
||||
<line x1="190" y1="130" x2="190" y2="900" class="life"/>
|
||||
<line x1="560" y1="130" x2="560" y2="900" class="life"/>
|
||||
<line x1="920" y1="130" x2="920" y2="900" class="life"/>
|
||||
<line x1="1280" y1="130" x2="1280" y2="900" class="life"/>
|
||||
|
||||
<!-- 消息 -->
|
||||
<line x1="190" y1="162" x2="558" y2="162" class="req" marker-end="url(#arrow)"/>
|
||||
<text x="196" y="156" class="xs t">① POST /sessions(brief + play_spec)</text>
|
||||
<line x1="560" y1="198" x2="192" y2="198" class="sse" marker-end="url(#arrowB)"/>
|
||||
<text x="300" y="192" class="xs mut">② 201 · session_id(durable 持久会话)</text>
|
||||
<line x1="190" y1="234" x2="558" y2="234" class="req" marker-end="url(#arrow)"/>
|
||||
<text x="196" y="228" class="xs t">③ GET /sessions/{id}/events(SSE 订阅)</text>
|
||||
<line x1="560" y1="270" x2="918" y2="270" class="req" marker-end="url(#arrow)"/>
|
||||
<text x="566" y="264" class="xs t">④ 启动单写者 run</text>
|
||||
|
||||
<!-- loop 框 -->
|
||||
<rect x="800" y="292" width="610" height="338" rx="10" fill="none" stroke="#ea580c" stroke-width="1.6" stroke-dasharray="6 4"/>
|
||||
<text x="812" y="310" class="lbl" fill="#ea580c">ReAct 循环 ×N(每轮详见图 3 / 图 4)</text>
|
||||
|
||||
<line x1="920" y1="338" x2="1278" y2="338" class="req" marker-end="url(#arrow)"/>
|
||||
<text x="926" y="332" class="xs t">⑤ reason → new-api(M3 /v1/messages,thinking)</text>
|
||||
<line x1="1280" y1="372" x2="922" y2="372" class="sse" marker-end="url(#arrowB)"/>
|
||||
<text x="980" y="366" class="xs mut">⑥ thinking + tool/text(Event)</text>
|
||||
<line x1="920" y1="408" x2="1278" y2="408" class="req" marker-end="url(#arrow)"/>
|
||||
<text x="926" y="402" class="xs t">⑦ act → Workspace(写码 / esbuild / headless 真跑)</text>
|
||||
<line x1="920" y1="442" x2="1278" y2="442" class="req" marker-end="url(#arrow)"/>
|
||||
<text x="926" y="436" class="xs t">⑧ CDP 探针 → verdict〔公共〕</text>
|
||||
<path d="M 920,468 q 46,0 46,14 q 0,14 -44,14" class="req" marker-end="url(#arrow)"/>
|
||||
<text x="972" y="486" class="xs mut">⑨ 未过 → repair 回环</text>
|
||||
<line x1="920" y1="512" x2="1278" y2="512" class="req" marker-end="url(#arrow)"/>
|
||||
<text x="926" y="506" class="xs t">⑩ checkpoint → Redis(durable,可恢复)</text>
|
||||
<line x1="918" y1="548" x2="562" y2="548" class="sse" marker-end="url(#arrowB)"/>
|
||||
<text x="610" y="542" class="xs mut">⑪ Event(thinking / tool / result)</text>
|
||||
<line x1="558" y1="584" x2="192" y2="584" class="sse" marker-end="url(#arrowB)"/>
|
||||
<text x="220" y="578" class="xs mut">⑫ SSE event-stream(resumable:断线 replay buffered)</text>
|
||||
<line x1="920" y1="618" x2="1278" y2="618" class="sse" marker-end="url(#arrowB)"/>
|
||||
<text x="926" y="612" class="xs mut">⑬ OTel trace → Studio</text>
|
||||
|
||||
<!-- HITL -->
|
||||
<rect x="50" y="648" width="1230" height="40" rx="8" fill="#fef9c3" stroke="#ca8a04" stroke-width="1.4"/>
|
||||
<text x="62" y="673" class="xs t">HITL(可选):运行时挂起 → RequireUserConfirm(经 SSE 推 cloud)→ cloud POST /sessions/{id} 确认/编辑参数 → 从暂停处精确恢复</text>
|
||||
|
||||
<line x1="920" y1="718" x2="1278" y2="718" class="req" marker-end="url(#arrow)"/>
|
||||
<text x="926" y="712" class="xs t">⑭ 产物落库 → MySQL + OSS(内容哈希)</text>
|
||||
<line x1="558" y1="754" x2="192" y2="754" class="sse" marker-end="url(#arrowB)"/>
|
||||
<text x="220" y="748" class="xs mut">⑮ 完成 event:verdict + 产物引用</text>
|
||||
<path d="M 190,778 q 46,0 46,14 q 0,14 -44,14" class="req" marker-end="url(#arrow)"/>
|
||||
<text x="242" y="796" class="xs t">⑯ 取产物 → 进 feed</text>
|
||||
|
||||
<!-- 异常 -->
|
||||
<rect x="50" y="828" width="1380" height="48" rx="8" fill="#fef2f2" stroke="#dc2626" stroke-width="1.4"/>
|
||||
<text x="62" y="848" class="xs t" font-weight="700">异常 / 生产路径:</text>
|
||||
<text x="62" y="867" class="xs mut">超时/熔断 → 优雅收尾(ExceedMaxItersEvent) · cloud 取消 session · provider 瞬时失败 graceful fallback · /schedule 定时 run · /credential 托管密钥</text>
|
||||
|
||||
<!-- 图例 -->
|
||||
<line x1="60" y1="918" x2="110" y2="918" class="req" marker-end="url(#arrow)"/><text x="118" y="922" class="t xs">REST 请求 / 同步动作</text>
|
||||
<line x1="300" y1="918" x2="350" y2="918" class="sse" marker-end="url(#arrowB)"/><text x="358" y="922" class="t xs">SSE 事件流(Event System · 异步 / 可恢复)</text>
|
||||
<g class="badge"><rect x="740" y="909" width="56" height="18" rx="3" fill="#16a34a"/><text x="745" y="922" fill="#fff">可靠</text>
|
||||
<rect x="804" y="909" width="56" height="18" rx="3" fill="#0891b2"/><text x="809" y="922" fill="#fff">数据</text>
|
||||
<rect x="868" y="909" width="62" height="18" rx="3" fill="#0ea5e9"/><text x="873" y="922" fill="#fff">可观测</text>
|
||||
<rect x="938" y="909" width="56" height="18" rx="3" fill="#dc2626"/><text x="943" y="922" fill="#fff">安全</text></g>
|
||||
<text x="1010" y="922" class="mut xs">durable/取消/fallback=可靠 · checkpoint/落库=数据 · Event/SSE/OTel=可观测 · HITL/credential=安全</text>
|
||||
|
||||
<text x="40" y="968" class="mut xs">映射:agentic集成架构.md · tier2实现详设.md | 基于 agentscope 2.0.3 官方 Agent Service(/sessions + SSE)源码实证 | 设计变动须同步本图</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.6 KiB |
98
docs/architecture/架构/生成引擎/assets/04-ReAct循环流程.svg
Normal file
98
docs/architecture/架构/生成引擎/assets/04-ReAct循环流程.svg
Normal file
@ -0,0 +1,98 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1180 900" font-family="-apple-system,'PingFang SC','Microsoft YaHei',Segoe UI,sans-serif">
|
||||
<defs>
|
||||
<marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto" markerUnits="strokeWidth"><path d="M0,0 L8,3 L0,6 Z" fill="#334155"/></marker>
|
||||
<marker id="arrowR" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto" markerUnits="strokeWidth"><path d="M0,0 L8,3 L0,6 Z" fill="#dc2626"/></marker>
|
||||
<style>
|
||||
.t{fill:#0f172a}.mut{fill:#475569}.sm{font-size:12px}.xs{font-size:11px}
|
||||
.h1{font-size:24px;font-weight:700}.h2{font-size:14px;font-weight:700}.lbl{font-size:13px;font-weight:600}
|
||||
.flow{stroke:#334155;stroke-width:2;fill:none}.brk{stroke:#dc2626;stroke-width:1.6;fill:none;stroke-dasharray:5 4}
|
||||
.badge{font-size:10.5px;font-weight:700}
|
||||
</style>
|
||||
</defs>
|
||||
<rect x="0" y="0" width="1180" height="900" fill="#f8fafc"/>
|
||||
<text x="40" y="40" class="t h1">图 4 · 单写者 ReAct 循环流程(一轮迭代)</text>
|
||||
<text x="40" y="60" class="mut sm">官方 Agent + ReActConfig 内置循环;收尾 = 模型产纯文本(不调工具);四熔断任一触发即优雅收尾;每轮 checkpoint。</text>
|
||||
|
||||
<!-- 主流程节点 -->
|
||||
<rect x="400" y="86" width="240" height="48" rx="10" fill="#e2e8f0" stroke="#0f172a" stroke-width="2"/>
|
||||
<text x="520" y="115" text-anchor="middle" class="t lbl">START:brief + play_spec</text>
|
||||
|
||||
<rect x="390" y="162" width="260" height="58" rx="10" fill="#fffbeb" stroke="#d97706" stroke-width="2"/>
|
||||
<text x="520" y="186" text-anchor="middle" class="t sm">组装 context</text>
|
||||
<text x="520" y="205" text-anchor="middle" class="mut xs">prompt + 源项目视图 + 记忆 + 预算</text>
|
||||
|
||||
<rect x="390" y="248" width="260" height="54" rx="10" fill="#f5f3ff" stroke="#7c3aed" stroke-width="2"/>
|
||||
<text x="520" y="272" text-anchor="middle" class="t sm">reason:调 M3(thinking 分离)</text>
|
||||
<text x="520" y="291" text-anchor="middle" class="mut xs">AnthropicChatModel → new-api /v1/messages</text>
|
||||
|
||||
<polygon points="520,326 632,360 520,394 408,360" fill="#dcfce7" stroke="#16a34a" stroke-width="2"/>
|
||||
<text x="520" y="358" text-anchor="middle" class="t sm">调工具?</text>
|
||||
<text x="520" y="375" text-anchor="middle" class="mut xs">tool / 纯文本</text>
|
||||
|
||||
<rect x="390" y="424" width="260" height="58" rx="10" fill="#eff6ff" stroke="#2563eb" stroke-width="2"/>
|
||||
<text x="520" y="448" text-anchor="middle" class="t sm">act:调工具(Workspace)</text>
|
||||
<text x="520" y="467" text-anchor="middle" class="mut xs">写多文件 → esbuild → headless 真跑</text>
|
||||
|
||||
<rect x="390" y="510" width="260" height="52" rx="10" fill="#eff6ff" stroke="#2563eb" stroke-width="2"/>
|
||||
<text x="520" y="532" text-anchor="middle" class="t sm">observe:收产物 + 截图</text>
|
||||
<text x="520" y="551" text-anchor="middle" class="mut xs">CDP 探针取证(公共)</text>
|
||||
|
||||
<rect x="390" y="590" width="260" height="66" rx="10" fill="#ffffff" stroke="#15803d" stroke-width="2.4"/>
|
||||
<text x="520" y="613" text-anchor="middle" class="t sm">双层验收门</text>
|
||||
<text x="520" y="632" text-anchor="middle" class="mut xs">确定性硬门 pass/fail(零 LLM 自评)</text>
|
||||
<text x="520" y="649" text-anchor="middle" class="mut xs">+ M3 视觉软检(只观测)</text>
|
||||
|
||||
<rect x="390" y="752" width="260" height="58" rx="10" fill="#bbf7d0" stroke="#15803d" stroke-width="2"/>
|
||||
<text x="520" y="776" text-anchor="middle" class="t lbl">产出:结构化游戏源项目</text>
|
||||
<text x="520" y="795" text-anchor="middle" class="mut xs">→ 落库 MySQL + OSS(内容哈希)</text>
|
||||
|
||||
<!-- 左侧:repair / checkpoint -->
|
||||
<rect x="120" y="590" width="190" height="66" rx="10" fill="#fef9c3" stroke="#ca8a04" stroke-width="1.8" stroke-dasharray="5 4"/>
|
||||
<text x="215" y="618" text-anchor="middle" class="t sm">repair 回环</text>
|
||||
<text x="215" y="637" text-anchor="middle" class="mut xs">同一 agent 续修</text>
|
||||
|
||||
<rect x="120" y="424" width="190" height="58" rx="10" fill="#f1f5f9" stroke="#475569" stroke-width="1.8"/>
|
||||
<text x="215" y="448" text-anchor="middle" class="t sm">checkpoint</text>
|
||||
<text x="215" y="467" text-anchor="middle" class="mut xs">AgentState → Redis(每轮)</text>
|
||||
|
||||
<!-- 右侧:四熔断 -->
|
||||
<rect x="720" y="248" width="400" height="234" rx="12" fill="#fef2f2" stroke="#dc2626" stroke-width="1.8" stroke-dasharray="6 4"/>
|
||||
<text x="736" y="272" class="h2" fill="#b91c1c">四熔断(任一触发 → 优雅收尾)</text>
|
||||
<text x="736" y="300" class="t sm">① 步数硬顶 max_iters 〔官方〕</text>
|
||||
<text x="736" y="326" class="t sm">② 预算闸:软刹〔官方〕+ 硬杀〔自建〕</text>
|
||||
<text x="736" y="352" class="t sm">③ 卡死语义探测 〔自建〕</text>
|
||||
<text x="736" y="378" class="t sm">④ 双层超时(wall-clock) 〔自建〕</text>
|
||||
<text x="736" y="416" class="mut xs">自建项均挂官方 Middleware 扩展点</text>
|
||||
<text x="736" y="436" class="mut xs">(on_reasoning / on_model_call)</text>
|
||||
<text x="736" y="460" class="mut xs">收尾 = ExceedMaxItersEvent → 优雅返回</text>
|
||||
|
||||
<!-- 连线 主流程 -->
|
||||
<line x1="520" y1="134" x2="520" y2="160" class="flow" marker-end="url(#arrow)"/>
|
||||
<line x1="520" y1="220" x2="520" y2="246" class="flow" marker-end="url(#arrow)"/>
|
||||
<line x1="520" y1="302" x2="520" y2="324" class="flow" marker-end="url(#arrow)"/>
|
||||
<line x1="520" y1="394" x2="520" y2="422" class="flow" marker-end="url(#arrow)"/>
|
||||
<text x="530" y="414" class="xs t">是 · 调工具</text>
|
||||
<line x1="520" y1="482" x2="520" y2="508" class="flow" marker-end="url(#arrow)"/>
|
||||
<line x1="520" y1="562" x2="520" y2="588" class="flow" marker-end="url(#arrow)"/>
|
||||
<line x1="520" y1="656" x2="520" y2="750" class="flow" marker-end="url(#arrow)"/>
|
||||
<text x="530" y="700" class="xs t">全绿</text>
|
||||
|
||||
<!-- 否:纯文本收尾 -->
|
||||
<path d="M 632,360 L 690,360 L 690,781 L 652,781" class="flow" marker-end="url(#arrow)"/>
|
||||
<text x="700" y="356" class="xs t">否 · 纯文本 = 收尾</text>
|
||||
|
||||
<!-- 未过 → repair → 回组 context -->
|
||||
<path d="M 390,623 L 310,623" class="flow" marker-end="url(#arrow)"/>
|
||||
<text x="316" y="615" class="xs t">未过</text>
|
||||
<path d="M 120,615 L 70,615 L 70,191 L 388,191" class="flow" marker-end="url(#arrow)"/>
|
||||
<text x="80" y="400" class="xs mut">repair 回环 → 重组 context</text>
|
||||
|
||||
<!-- checkpoint 挂 observe -->
|
||||
<path d="M 390,536 L 310,453" class="flow" marker-end="url(#arrow)"/>
|
||||
|
||||
<!-- 熔断指向循环 -->
|
||||
<path d="M 720,365 L 660,365" class="brk" marker-end="url(#arrowR)"/>
|
||||
|
||||
<!-- 图例 -->
|
||||
<text x="40" y="848" class="mut xs">〔官方〕= AgentScope 现成 〔自建〕= 挂官方 Middleware 自写 | 映射:tier2四层工程架构.md §4 · 自治富游戏引擎.md | 设计变动须同步本图</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.8 KiB |
71
docs/architecture/架构/生成引擎/assets/06-reuse边界全景.svg
Normal file
71
docs/architecture/架构/生成引擎/assets/06-reuse边界全景.svg
Normal file
@ -0,0 +1,71 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1400 800" font-family="-apple-system,'PingFang SC','Microsoft YaHei',Segoe UI,sans-serif">
|
||||
<defs>
|
||||
<style>
|
||||
.t{fill:#0f172a}.mut{fill:#475569}.sm{font-size:12px}.xs{font-size:11px}
|
||||
.h1{font-size:24px;font-weight:700}.h2{font-size:15px;font-weight:700}.it{font-size:12.5px;fill:#0f172a}
|
||||
</style>
|
||||
</defs>
|
||||
<rect x="0" y="0" width="1400" height="800" fill="#f8fafc"/>
|
||||
<text x="40" y="40" class="t h1">图 6 · 复用边界全景(官方 / 自建 / 公共)</text>
|
||||
<text x="40" y="60" class="mut sm">原则:能用 AgentScope 官方现成就不自研;自建一律挂官方扩展点 / 薄层;公共组件两条生成线共享、不进 tier2 私有。</text>
|
||||
|
||||
<!-- 列1 官方现成 -->
|
||||
<rect x="40" y="86" width="430" height="668" rx="12" fill="#f0fdf4" stroke="#16a34a" stroke-width="2.4"/>
|
||||
<text x="60" y="116" class="h2" fill="#15803d">AgentScope 生态官方现成</text>
|
||||
<text x="60" y="136" class="mut xs">〔实线 · 直接用〕</text>
|
||||
<g class="it">
|
||||
<text x="60" y="172">· Agent + ReActConfig(多轮循环 + 步数熔断)</text>
|
||||
<text x="60" y="208">· Toolkit(工具注册 · execute_shell/python)</text>
|
||||
<text x="60" y="244">· Middleware 洋葱(ReplyBudgetControl 预算软刹)</text>
|
||||
<text x="60" y="280">· AnthropicChatModel + Formatter(M3 thinking)</text>
|
||||
<text x="60" y="316">· AgentState(checkpoint 状态对象)</text>
|
||||
<text x="60" y="352">· Workspace(Local / Docker / E2B 沙箱)</text>
|
||||
<text x="60" y="388">· Agent Service(REST + SSE · 多租户 · durable)</text>
|
||||
<text x="60" y="424">· Event System(text/thinking/tool/result 流)</text>
|
||||
<text x="60" y="460">· TracingMiddleware(OpenTelemetry 埋点)</text>
|
||||
<text x="60" y="496">· ReMe(持久记忆 + 检索 + 压缩)</text>
|
||||
<text x="60" y="532">· Studio(可观测 dashboard)</text>
|
||||
<text x="60" y="568">· Permission System + HITL(中断 / 恢复)</text>
|
||||
<text x="60" y="604">· generate_structured_output(结构化产出)</text>
|
||||
<text x="60" y="640">· Schedule / Credential(定时 · 托管密钥)</text>
|
||||
</g>
|
||||
|
||||
<!-- 列2 自建 -->
|
||||
<rect x="490" y="86" width="400" height="668" rx="12" fill="#ffffff" stroke="#475569" stroke-width="2" stroke-dasharray="7 5"/>
|
||||
<text x="510" y="116" class="h2" fill="#334155">tier2 自建</text>
|
||||
<text x="510" y="136" class="mut xs">〔虚线 · 挂官方扩展点 / 薄层〕</text>
|
||||
<g class="it">
|
||||
<text x="510" y="178">· 超时熔断 middleware(wall-clock)</text>
|
||||
<text x="510" y="218">· 卡死语义探测 middleware</text>
|
||||
<text x="510" y="258">· fail-closed 硬杀(超额强制停)</text>
|
||||
<text x="510" y="298">· 金额(¥)成本累计(官方只到 token)</text>
|
||||
<text x="510" y="338">· debug 案例库(签名精确匹配薄层)</text>
|
||||
<text x="510" y="378">· 引擎能力包 manifest(Phaser)</text>
|
||||
<text x="510" y="418">· tier2 源项目契约</text>
|
||||
<text x="528" y="440" class="mut xs">文件树 / 构建 profile / 依赖锁 / 落库寻址</text>
|
||||
<text x="510" y="478">· mini-肥鹅 spike fixtures</text>
|
||||
<text x="510" y="518">· agent 收尾接线 → 产结构化游戏定义</text>
|
||||
<text x="510" y="558">· Phaser 引擎适配(第一版硬编码)</text>
|
||||
</g>
|
||||
|
||||
<!-- 列3 公共 -->
|
||||
<rect x="910" y="86" width="450" height="668" rx="12" fill="#eff6ff" stroke="#2563eb" stroke-width="3"/>
|
||||
<text x="930" y="116" class="h2" fill="#1d4ed8">公共组件</text>
|
||||
<text x="930" y="136" class="mut xs">〔双线 · 两条生成线共享〕</text>
|
||||
<g class="it">
|
||||
<text x="930" y="178">· CDP 验收基线(九门 harness 泛化 Phaser)</text>
|
||||
<text x="930" y="218">· 计费台账(读 new-api quota)</text>
|
||||
<text x="930" y="258">· 送审 / 审核台</text>
|
||||
<text x="930" y="298">· feed / 发布</text>
|
||||
<text x="930" y="338">· trace 契约(公共核心子集 + 扩展段)</text>
|
||||
<text x="930" y="378">· new-api 网关(统一出口 · 协议不锁)</text>
|
||||
</g>
|
||||
<rect x="930" y="410" width="410" height="120" rx="10" fill="#dbeafe" stroke="#2563eb" stroke-width="1.6"/>
|
||||
<text x="944" y="436" class="t sm" font-weight="700">为什么这些是公共:</text>
|
||||
<text x="944" y="460" class="mut xs">两条生成线(SAA 廉价线 + tier2 富游戏)</text>
|
||||
<text x="944" y="480" class="mut xs">产物都要计费、送审、进同一个 feed,</text>
|
||||
<text x="944" y="500" class="mut xs">都靠同一套确定性验收基线判能不能玩。</text>
|
||||
<text x="944" y="520" class="mut xs">→ 抽出共享,不在 tier2 私有里重复造。</text>
|
||||
|
||||
<text x="40" y="784" class="mut xs">映射:tier2四层工程架构.md §8 · agentic集成架构.md | 基于 agentscope 2.0.3 源码实证 | 设计变动须同步本图</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.8 KiB |
Loading…
x
Reference in New Issue
Block a user