Merged
docs: 收敛应用接入与对外接口参考 #735
docs: 收敛应用接入与对外接口参考 #735
Merged
jaxAdd on 5 days ago
jax
jaxCollaborators
5 days ago

【MR类型】

docs: 收敛应用接入与对外接口参考

【问题背景】

应用接入指南与接口参考有重复内容。Python SDK 入口混合了基础调用和宿主开发细节,HTTP 对话的请求、事件和状态又分散在 REST 与 AG-UI 两页。

【具体方案】

  • 为 Python SDK、HTTP / AG-UI 和 A2A 分配清晰的接入指南与接口参考。Python SDK 入口聚焦启动、调用、会话续接、异步和流式用法。续聊示例采用与服务端相同的 SQLite checkpointer,并演示跨进程恢复。
  • 将应用所需的 AG-UI 请求、SSE、人工回答与错误码并入 REST 参考。旧入口保留链接指引。REST 对外参考收敛到第三方接入使用的接口。
  • 中英文同步调整。补齐插件、Skill、工具、Hook 和子代理的最小验证步骤,并同步 de-agent 口径复核的新行为。开发者章节和服务实现保持原样。

【主要文件】

文件路径 改动说明
docs/{zh,en}/reference/1.*.md 调用方式选择与 Python、HTTP、A2A 接入指南
docs/{zh,en}/reference/3.*.md SDK 接口、REST 与 A2A 参考及旧入口兼容
docs/{zh,en}/reference/2.*.md 扩展开发示例、验证步骤和相关链接
mkdocs.yml 同步导航和双语页面映射

【验证】

  • MkDocs 严格构建和生成页面本地链接检查。
  • 中英文 SQLite 续聊示例使用本地测试模型验证,第二个独立进程能读取第一轮历史。
likedislike
Pull Request has been successfully merged by iancaoo.
(Thank you for jax's contribution.)
atomgit-bot
atomgit-bot
5 days ago Comments:

变更摘要

本次变更聚焦文档结构收敛:将 Python SDK、HTTP / AG-UI 与 A2A 的接入指南与接口参考重新划分职责,消除应用接入指南与接口参考之间的重复内容,并在中英文文档中同步调整。核心做法是把原先独立成页的 AG-UI 事件契约并入 REST 参考,旧入口通过重定向保留链接指引,同时把 Python SDK 参考拆分为扩展、HITL、A2A 客户端与宿主等多个子页面,mkdocs.yml 的导航、not_in_nav 与 extra 重定向映射随之同步。

主要改动

  • 导航层级重构:mkdocs.yml 的 nav 中将接入指南条目由 Python SDK 改名为 Use the Python SDK,参考章节的 Python API 改名为 Python SDK,并移除独立的 AG-UI protocol(en/reference/3.3-ag-ui-events.md)导航项,使 AG-UI 内容归入 REST 参考。
  • 新增页面与旧链接兼容:not_in_nav 增加了 en/reference/3.3-ag-ui-events.md 及 en/reference/3.1.1-python-extension-api.md、3.1.2-python-hitl-api.md、3.1.3-python-a2a-client.md、3.1.4-python-host-api.md,并在 extra 中为这四个 Python 子页面配置到 reference/python-*.md 的重定向,保证旧路径可访问。
  • 文档内容重新划分:docs/{zh,en}/reference/1.*.md、3.*.md、2.*.md 分别承载调用方式选择与 Python/HTTP/A2A 接入指南、SDK/REST/A2A 接口参考,以及扩展开发示例与验证步骤,HTTP 对话的请求、事件与状态不再分散于 REST 与 AG-UI 两处。
  • 双语标签映射调整:mkdocs.yml 的 i18n 文案表与 docs/assets/mkdocs/language-switcher.js 同步删除了 AG-UI protocol 的对照项,并新增 Python SDK 对应条目、将 Python API 条目移除,保持中英文页面标题切换一致。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
5 days ago Comments:

代码审查

审查结论

  • [建议] docs/en/reference/1.2-python-sdk.md:57 fix: 校验续聊示例中的 runtime.paths.state_dir 属性名
  • [建议] docs/en/reference/3.3-ag-ui-events.md:1 fix: 3.3 页面整段删除 stream-scope 等章节但未迁入 REST 参考
  • [建议] docs/en/reference/3.1-python-api.md:25 fix: 删除 Agent 并发与会话占用契约,但 #agent 锚点仍被未改页面引用
  • [建议] docs/en/reference/3.1.1-python-extension-api.md:31 fix: 拆分后旧锚点失效导致多处英文文档交叉引用断链
  • [建议] docs/zh/reference/3.3-ag-ui-events.md:1 fix: 3.3 页面删除的“流的范围”子代理事件契约未迁移到 3.2
  • [建议] docs/zh/reference/3.1-python-api.md:41 fix: 3.1 页面折叠块内的空锚点无法承载其他页面的既有链接
类型 数量
🔴 阻塞 0
🟡 建议 6

💬 仅评论

likedislike
Incorrect?
atomgit-bot
atomgit-bot
5 days ago Comments:

AtomGit AI 助手使用指南

在 PR 评论中使用命令即可触发。支持在普通评论和代码行评论中使用。

功能 命令 说明
代码审查 /ai review 检查代码质量、潜在问题、安全风险
PR 摘要 /ai summary 生成 PR 变更内容的结构化摘要
代码解释 /ai explain 解释代码变更的逻辑和意图
自由提问 @atomgit-bot <问题> 询问关于本 PR 的任何问题
帮助 /ai help 显示此帮助信息

免责声明

AI 助手可能存在误判,请结合自身判断。可以对评论点 👍 或 👎 帮助我们改进。

likedislike
Incorrect?
DataGalleryBotDataGalleryBotCollaborators
5 days ago Added label: ci-pipeline-running
DataGalleryBot
DataGalleryBotCollaborators
5 days ago Comments:
Project Name Build Result Details
gitcode-gate-dataagent ✅ SUCCESS 1840

NOTE: You can comment /rebuild to retrigger the pipeline again.

likedislike
DataGalleryBotDataGalleryBotCollaborators
5 days ago Approval passed
DataGalleryBotDataGalleryBotCollaborators
5 days ago Removed label: ci-pipeline-running
DataGalleryBotDataGalleryBotCollaborators
5 days ago Added label: ci-pipeline-passed
atomgit-bot
atomgit-bot5 days agoStart code review1
docs/en/reference/1.2-python-sdk.md
@@ -40,0 +56,4 @@
56+ runtime = prepare_runtime()
57+ state_dir = runtime.paths.state_dir
58+ state_dir.mkdir(parents=True, exist_ok=True)
59+ database = state_dir / "checkpoints.sqlite"
atomgit-bot
atomgit-bot5 days agoComments:

🟡 Medium Priority

建议:核对 Paths 上状态目录的真实属性名(或改用 runtime.paths.open_session(thread_id, create=True) 的返回值),确保示例可直接运行,并与 3.1.4-python-host-api.md 的属性清单一致。

likedislike
Incorrect?
atomgit-bot
atomgit-bot5 days agoStart code review1
docs/zh/reference/3.3-ag-ui-events.md
@@ -128,3 +5,1 @@
128-子代理文本、内部工具和状态事件不进入父对话流。最终消息快照仍取自根图。子代理错误消息与根错误一样经过脱敏。产物通过[REST API 参考 · 产物](3.2-rest-api.md#outputs)读取。`after_model` 在每次模型调用返回后于服务内执行,不对应逐 token 的 AG-UI 事件。
129- 
130-子代理进度可能早于外层 `TOOL_CALL_START`。客户端按 `parentToolCallId` 关联,不依赖到达顺序。历史进度不由 Checkpoint 重放。客户端适配见[HTTP 与协议适配 · 客户端进度适配](../development/2.4-http-protocol-adapters.md#client-progress)。
5+应用接入请查阅 [REST API 参考 · 对话与 AG-UI 事件](3.2-rest-api.md#conversation)。
atomgit-bot
atomgit-bot5 days agoComments:

🟡 Medium Priority

变更点:docs/zh/reference/3.3-ag-ui-events.md 被整体重写为跳转存根(第 1–5 行),原“流的范围”(#stream-scope)一节的全部正文被删除:SUBAGENT_STARTED/SUBAGENT_FINISHED/SUBAGENT_ERROR、STEP_STARTED/STEP_FINISHED、subagentRunId/parentToolCallId/parentSubagentRunId 字段语义、服务端丢弃上游 RUN_STARTED/MESSAGES_SNAPSHOT/STATE_SNAPSHOT 的规则、客户端应忽略未知 CUSTOM、子代理进度可能早于 TOOL_CALL_START 等契约。

契约破坏:新的 3.2-rest-api.md 对话章节(第 77–172 行)只迁移了请求字段、SSE、HITL 与错误码,没有任何 SUBAGENT_* 相关内容(全仓库 grep SUBAGENT_STARTED 仅命中存根页第 3 行的空锚点)。

建议:将被删除的“流的范围”一节(子代理事件表、父工具关联、CUSTOM/快照丢弃规则)随其余内容一起迁入 3.2-rest-api.md 对话章节,并更新 1.2/2.6 及 development/2.4 指向新位置;3.3 存根页只保留明确告知内容已迁移的指引。

likedislike
Incorrect?
atomgit-bot
atomgit-bot5 days agoStart code review1
docs/en/reference/3.1.1-python-extension-api.md
@@ -0,0 +32,4 @@
32+ 
33+## SemanticLayer client
34+ 
35+Import `SemanticServiceClient` from `dataagent`. It is a standalone synchronous HTTP client, separate from the host and low-level graph APIs. For connection setup, certificates, and natural-language verification, see [SemanticLayer integration](../data-analysis/1.3-semantic-service.md).
atomgit-bot
atomgit-bot5 days agoComments:

🟡 Medium Priority

新增的 3.1.1–3.1.4 页把原来 3.1-python-api.md 里的锚点整体搬走了:semantic-client(3.1.1 第 31 行)、hitl-api(3.1.2 第 3 行)、host-api(3.1.4 第 5 行)。

证据:对 docs/en/reference 目录检索 <a name="…">,3.1-python-api.md 只剩 <a name="agent">(第 25 行),semantic-client / hitl-api / host-api 在该文件中已不存在。但本 PR 未同步更新的英文页面仍在指向旧锚点:

触发条件与失败表现:读者点击这些链接会落到新 3.1-python-api.md 页首而不是目标小节(锚点不存在,不会跳转);若构建启用了锚点级链接校验(本 PR 声称做了本地链接检查),严格构建会报出这些断链。相比之下 3.4-a2a-reference.md 第 212 行已同步把 3.1-python-api.md#a2a-api 改成 3.1.3-python-a2a-client.md#a2a-api,说明拆分是单向完成、引用方只改了一处,其余仍是旧锚点,属于本次拆分引入的新旧不一致。

修复方向:把上述未改动文件中的链接分别指向 ../reference/3.1.1-python-extension-api.md#semantic-client、../reference/3.1.2-python-hitl-api.md#hitl-api、../reference/3.1.4-python-host-api.md#host-api;或者在新 3.1-python-api.md 保留同名占位锚点以兼容旧链接。

建议:把仍指向 3.1-python-api.md 旧锚点的英文页面链接改到新的 3.1.1/3.1.2/3.1.4 页面对应锚点(或在新 3.1-python-api.md 保留 semantic-client/hitl-api/host-api 兼容锚点),并做一次全仓 3.1-python-api.md# 引用核对。

likedislike
Incorrect?
atomgit-bot
atomgit-bot5 days agoStart code review1
docs/en/reference/3.1-python-api.md
@@ -79,3 +29,1 @@
79-| `invoke`, `ainvoke`, `stream`, `astream`, `astream_events` | LangGraph arguments plus `output_dir`. Select by `config["configurable"]["thread_id"]`, default `sdk` or the explicit session. Create on first use |
80-| `close`, `aclose` | Close agent-owned semantic clients |
81-| Context managers | `with` closes synchronously; `async with` awaits close |
29+Set `config["configurable"]["thread_id"]` to select the session. Use a different ID to start a new session. To continue a conversation, reuse its ID and configure a persistent SQLite checkpointer. See the [Python SDK usage guide](1.2-python-sdk.md#continue-conversation).
atomgit-bot
atomgit-bot5 days agoComments:

🟡 Medium Priority

变更行:docs/en/reference/3.1-python-api.md 第 21–29 行把原 ### Agent 成员表与并发说明替换为两句话,<a name="agent"></a> 现在指向 ## Select a session。

受影响契约:旧内容明确约定「不同线程可并发、同一线程重叠调用会失败、stream() 在准备阶段校验路径、同步/异步迭代持有会话直到完成/失败/关闭、首次调用绑定 output_dir、图缓存约 32 条并按 LRU 逐出空闲图、checkpointer 持有历史」。这些约定在本次 diff 之后全仓不存在:grep Overlapping calls、32 entries(唯一命中是 development/2.7-extension-lifecycle.md 的 Agent 缓存,不是 SDK Agent 语义)、output_dir 绑定说明在 3.1 中均无落点。

失败模式:未改动的页面仍在承诺这些规则——docs/en/reference/1.2-python-sdk.md:147「See Agent API for concurrency rules」、docs/zh/reference/1.2-python-sdk.md:149「并发与会话占用规则见 Python API 参考 · Agent」。读者点击后看到的是「Select a session」段落,其中完全没有并发/会话占用/output_dir 绑定规则,嵌入式宿主会按缺失的契约实现(例如并发调用同一 thread_id 而不预期失败)。同时 LaunchOptions 字段表(user_id/cwd/init_home/session_id 默认值)与 create_agent 参数表(checkpointer/mcp_tools/semantic_client/model/session)也一并失去唯一文档位置,仅 3.1.4 覆盖宿主相关子集。

建议:在 ## Select a session 之后补回一段 Agent 并发/会话占用/output_dir 首次绑定的契约说明,或把 1.2 中两处 3.1-python-api.md#agent 的引用改到实际承载该规则的新位置并补写内容。

likedislike
Incorrect?
atomgit-bot
atomgit-bot5 days agoStart code review1
docs/en/reference/3.3-ag-ui-events.md
@@ -120,3 +5,1 @@
120-Subagent text, internal tools, and state do not enter the parent conversation stream. Errors are redacted. Fetch files through the [output endpoints](3.2-rest-api.md#outputs). `after_model` runs after model calls rather than per token.
121- 
122-Subagent progress can arrive before the outer `TOOL_CALL_START`. Correlate by `parentToolCallId` rather than arrival order. Checkpoint restore does not replay historical progress. See the [implementation notes](../development/2.4-http-protocol-adapters.md#client-progress) for client adapters.
5+For application integration, see [REST API reference · Conversation and AG-UI events](3.2-rest-api.md#conversation).
atomgit-bot
atomgit-bot5 days agoComments:

🟡 Medium Priority

变更行:docs/en/reference/3.3-ag-ui-events.md 第 3–5 行保留了 request/sse-response/terminal-events/completed/hitl/errors/stream-scope 等锚点,但整页内容(含 ## Stream scope 子代理事件表、## Handle termination 的会话状态映射、RUN_ERROR 清洗/未知码归一为 INTERNAL_ERROR 的规则)被删除,只有 request/sse/hitl/errors 迁入了 3.2-rest-api.md。

受影响契约:未改动的页面仍把这些锚点当作内容入口引用——docs/en/reference/2.6-develop-subagents.md:34「The AG-UI subagent events also show when the subagent starts and finishes」、docs/en/development/2.4-http-protocol-adapters.md:35「See AG-UI stream scope for fields and parent-tool correlation」、docs/zh/reference/2.6-develop-subagents.md:36、docs/zh/development/2.4-http-protocol-adapters.md:31,以及 docs/en/operations/2.2-sessions-and-outputs.md:105 / docs/zh/operations/2.2-sessions-and-outputs.md:122 的 #request。

失败模式:读者点击上述链接后落到只有一句「moved」的跳转页,页面上没有任何 stream scope 内容;且全仓 grep SUBAGENT_STARTED、parentToolCallId、STEP_STARTED、SUBAGENT_FINISHED 已无任何命中(仅 en/development/2.7-extension-lifecycle.md 的无关 “32 entries” 命中),即子代理事件字段与父工具关联规则、终端事件→会话状态(error/interrupted)映射、RUN_ERROR 未知码归一规则从文档中彻底消失,客户端适配实现失去依据(3.2 的新表只讲客户端动作,不含会话状态与清洗语义)。

建议:把 3.3 中被删除的 Stream scope(SUBAGENT_STARTED/STEP_STARTED/SUBAGENT_FINISHED、parentToolCallId 关联、根图透传与丢弃规则)、终端事件与会话状态映射、RUN_ERROR 清洗/未知码归一说明迁移到 3.2-rest-api.md 的 Conversation 章节;或保留这些章节在 3.3 页面,仅把「应用接入」引导指向 3.2。

likedislike
Incorrect?
atomgit-bot
atomgit-bot5 days agoStart code review1
docs/zh/reference/3.1-python-api.md
@@ -362,3 +49,1 @@
362-| `run_a2a_server(runtime, *, host, port, auth_token=None)` | 宿主 | 用 uvicorn 运行上面的应用。命令行入口是 `dataagent serve-a2a` |
363- 
364-客户端从 Message 或 Task 响应中保留远端会话。不传 `thread_id` 时沿用调用实例的默认会话,可以用 `context_id` 初始化它。显式传入的 `http_client` 仍由调用方关闭。该接口发送文本并等待响应。结构化人工反馈通过[A2A 参考 · 原生 HITL 暂停与恢复](3.4-a2a-reference.md#a2a-hitl)提交。远端没有 DataAgent 诊断 metadata 时,任务与会话 ID 仍取自协议结果。将远端注册为 Agent 工具的步骤见[用 A2A 连接 Agent 并管理任务 · 让 DataAgent 调用其他 Agent](1.4-a2a-integration.md#outbound)。
49+</details>
atomgit-bot
atomgit-bot5 days agoComments:

🟡 Medium Priority

变更点:docs/zh/reference/3.1-python-api.md 从 364 行参考页裁剪为 49 行入口页,原 AgentContext、SemanticServiceClient 方法表、HITL 接口、宿主接口、A2A 客户端等正文分别迁到 3.1.1/3.1.2/3.1.3/3.1.4;本页仅在第 44–47 行用一个默认折叠的 <details> 块保留 <a id="agent-context">、<a id="semantic-client">、<a id="hitl-api">、<a id="host-api">、<a id="a2a-api"> 等锚点。

契约破坏:其他页面仍按旧契约链接到这些锚点且未被本 PR 修改,例如 docs/zh/data-analysis/1.3-semantic-service.md:5、:36、:115(../reference/3.1-python-api.md#semantic-client,文案为“方法、参数与生命周期见…”)、docs/zh/operations/1.5-extension-schema.md:118(#hitl-api)、docs/zh/operations/2.2-sessions-and-outputs.md:100 与 docs/zh/operations/2.3-session-storage.md:213、docs/zh/development/2.7-extension-lifecycle.md:45(#host-api)、docs/zh/reference/1.2-python-sdk.md:149(#agent)。

建议:把仍指向 3.1-python-api.md 旧锚点的跨文件链接(data-analysis/1.3-semantic-service.md、operations/1.5-extension-schema.md、operations/2.2-sessions-and-outputs.md、operations/2.3-session-storage.md、development/2.7-extension-lifecycle.md、reference/1.2-python-sdk.md)改到 3.1.1/3.1.2/3.1.4 的对应锚点,并确认已发布 URL 的旧锚点有可读的落点。

likedislike
Incorrect?
iancaooiancaooCollaborators
5 days ago Resolved final issue
iancaooiancaooCollaborators
5 days ago Merged pull request, merge node SHA: df4150152dd370c025224a2bb161aa288ffb7c0e