Skip to content

docs: fix verified doc-vs-code mismatches (MCP examples, HITL, defaults, tool names) (en+zh) - #3293

Merged
jujn merged 3 commits into
agentscope-ai:mainfrom
chang6666:docs/fix-verified-mismatches
Sep 26, 2026
Merged

jujn merged 3 commits into
agentscope-ai:mainfrom
chang6666:docs/fix-verified-mismatches

Conversation

@chang6666

Copy link
Copy Markdown
Contributor

Summary

Fixes a batch of verified doc-vs-code mismatches found by cross-checking the v2 guides against the current source. All snippets were validated against real APIs (several were copy-paste-and-fail). En and zh guides are kept in sync; no code changes. Partially addresses #1883 and #1190.

Corrections (each verified with grep against source)

Building blocks

  • MCP examples (agent.md + tool.md, en+zh, 8 spots) — McpClientBuilder.stdio().name(...).command(...).build() etc. do not exist. Rewritten to the real API: McpClientBuilder.create("name").stdioTransport(cmd, args...).buildAsync().block() (and sseTransport / streamableHttpTransport), matching McpStdioExample / McpSseExample / McpStreamableHttpExample.
  • HITL (agent.md, en+zh) — ToolUseBlock has no getSuggestedRules() (that accessor is on PermissionDecision). Resume snippet now matches PermissionHITLExample: new ConfirmResult(confirmed, toolCall), with a pointer to passing explicit rules.
  • permission-system.md (en+zh) — suggested rules are carried on the ASK PermissionDecision, not on ToolUseBlock.
  • agent.md (en+zh) — removed references to the removed legacy stream API and to the non-existent modelConfig() / reactConfig() builder methods.
  • tool.md (en+zh) — @Tool.concurrencySafe default is true (Tool.java:117), not false; ToolGroup examples now use ToolGroup.builder() — the 4-arg public constructor in the docs does not exist (real one is protected with a different parameter order).
  • model.md / agent.md (en+zh) — structured-output metadata key is _structured_output (MessageMetadataKeys.java:120), not structured_output.

Harness

  • memory.md (en+zh) — memory-enabled agents register four tools (memory_search, memory_get, memory_save, session_search — HarnessAgent.java:2691-2694), not two; dropped the undocumented "up to 30 hits" cap (MemorySearchTool has none).
  • plan-mode.md (en+zh) — whitelist is 9 tools per PlanModeMiddleware.ALWAYS_ALLOWED (adds agent_spawn / agent_send / agent_list / task_output / task_list); removed the stale "subagents do not inherit plan mode" known-gap — inheritance is implemented (AgentSpawnTool.propagatePlanMode) and subagent.md already documented it, so the two guides contradicted each other.
  • skill.md / workspace.md (en+zh) — the shell tool is named execute (ShellExecuteTool.NAME), not execute_shell_command.
  • filesystem.md (en+zh) — DockerFilesystemSpec.isolationScope defaults to USER (SandboxIsolationKey: null scope treated as USER), not SESSION.
  • compaction.md (en+zh) — list_files is not in ToolResultEvictionConfig.DEFAULT_EXCLUDED_TOOLS.

Examples / README

  • agentscope-examples/README.md: agentscope-core-java → agentscope-core, cd examples → cd agentscope-examples, exec:java commands gain -pl documentation (all main classes live in that module), dead ../CLAUDE.md link → CONTEXT.md, documentation link now points to java.agentscope.io (was the Python repo), duplicate section numbers fixed.
  • README.md / README_zh.md: dependency snippets 2.0.1 → 2.0.3 (latest release).

Notes

All corrections verified against the current source; en and zh guides
kept in sync. Partially addresses agentscope-ai#1883 and agentscope-ai#1190.

building-blocks:
- agent.md / tool.md: McpClientBuilder examples rewritten to the real
  API (create(name) + stdioTransport/sseTransport/streamableHttpTransport
  + buildAsync()); the documented stdio()/sse()/streamableHttp() chain
  does not exist (8 spots across en+zh)
- agent.md: HITL guide no longer claims ToolUseBlock.getSuggestedRules()
  — suggested rules live on PermissionDecision; resume snippet matches
  PermissionHITLExample (new ConfirmResult(confirmed, toolCall))
- agent.md: drop references to the removed legacy stream API and to the
  non-existent modelConfig()/reactConfig() builder methods
- tool.md: @tool concurrencySafe default is true, not false;
  ToolGroup examples use ToolGroup.builder() (the 4-arg public
  constructor does not exist)
- model.md / agent.md: structured-output metadata key is
  _structured_output (leading underscore)
- permission-system.md: suggested rules carried on PermissionDecision,
  not on ToolUseBlock

harness:
- memory.md: memory-enabled agents register four tools (memory_search,
  memory_get, memory_save, session_search), not two; drop the
  undocumented "up to 30 hits" cap on memory_search
- plan-mode.md: whitelist is 9 tools (agent_spawn/agent_send/agent_list/
  task_output/task_list included per PlanModeMiddleware); remove the
  stale "subagents do not inherit plan mode" known gap — inheritance is
  implemented (contradicted subagent.md)
- skill.md / workspace.md: shell tool is named execute, not
  execute_shell_command
- filesystem.md: DockerFilesystemSpec isolationScope defaults to USER,
  not SESSION
- compaction.md: list_files is not in the default tool-result eviction
  exclusion set

examples / readme:
- agentscope-examples/README.md: agentscope-core-java -> agentscope-core,
  cd examples -> cd agentscope-examples, exec:java commands gain
  -pl documentation, dead ../CLAUDE.md link -> CONTEXT.md, documentation
  link points to java.agentscope.io (was the Python repo), section
  numbering fixed
- README.md / README_zh.md: dependency snippets 2.0.1 -> 2.0.3 (latest
  release)
@codecov

codecov Bot commented Sep 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@oss-maintainer oss-maintainer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Doc-vs-code alignment pass over README/README_zh, the examples README and the v2 en+zh building-block/harness pages. Spot-checked every behavioural claim this PR changes against main@ea78c317: @Tool.concurrencySafe() really defaults to true (Tool.java:117), the structured-output metadata key is _structured_output (MessageMetadataKeys.STRUCTURED_OUTPUT), ConfirmResult does have the 2-arg convenience constructor and getSuggestedRules() lives on PermissionDecision (not ToolUseBlock), McpClientBuilder.create(..).<transport>(..).buildAsync().block() and ToolGroup.builder() match the current APIs, the filesystem isolation default is USER (HarnessAgent build: IsolationScope fsIsolationScope = IsolationScope.USER), execute is the registered shell tool name, the 4 memory tools are memory_search/memory_get/memory_save/session_search, ToolResultEvictionConfig.DEFAULT_EXCLUDED_TOOLS matches the reworded eviction list, maxIters default is 10, CONTEXT.md exists and CLAUDE.md does not, and 2.0.3 is the latest published release. All of it holds — this is a solid, low-risk docs fix and the en/zh pairs stay in sync.

Findings

  • [Warning] docs/v2/en/docs/harness/plan-mode.md:73 — the quoted plan-mode denial output still does not match PlanModeMiddleware.DENY_MESSAGE.
  • [Info] docs/v2/en/docs/building-blocks/agent.md:353 — deprecated stream(.., RuntimeContext) overloads still exist; the reworded sentence slightly over-states their removal.
  • [Info] plan-mode whitelist (9 tools) and the sub-agent inheritance claim verified correct.

Nothing here blocks the change; the Warning is one more instance of the exact drift this PR sets out to remove.


Automated review by github-manager-bot

Comment thread docs/v2/en/docs/harness/plan-mode.md Outdated
```text
[Tool denied — plan mode is active]
Only read-only tools and plan_enter / plan_write / plan_exit / todo_write are allowed.
Only read-only tools and plan_enter / plan_write / plan_exit / todo_write /

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Warning] This block is still presented as the literal tool-result the model sees, but it does not match the implementation. PlanModeMiddleware.DENY_MESSAGE is:

Blocked: you are in PLAN mode (read-only). You may investigate and run read-only tools, record your plan with plan_write, and call plan_exit when ready to execute. Do not modify files or run mutating commands until the plan is approved.

So the real message neither carries the [Tool denied — plan mode is active] header nor enumerates the whitelist. Since this PR is specifically about doc-vs-code drift, worth either quoting DENY_MESSAGE verbatim or dropping the fenced block and keeping the prose (the call is rejected with a plan-mode denial note).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 16df4cd — both guides now quote PlanModeMiddleware.DENY_MESSAGE verbatim (the zh page quotes the English literal too, since that is the string the model actually receives), replacing the invented header + whitelist enumeration.

@@ -353,7 +353,7 @@ RuntimeContext ctx =
Msg result = agent.call(List.of(new UserMessage("Hi.")), ctx).block();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Info] The stream overloads still exist — ReActAgent keeps deprecated stream(List<Msg>, StreamOptions, RuntimeContext) (and the schema/structured variants, @Deprecated(since = "2.0.0", forRemoval = true)), and they do accept a RuntimeContext. Dropping the sentence is fine if the intent is to stop advertising deprecated APIs, but "provides RuntimeContext overloads for call and streamEvents" reads as a statement about the current surface, so a short "(plus deprecated stream overloads kept for compatibility)" would be more accurate. Same for the zh mirror.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 16df4cd — both en and zh now read "(plus deprecated stream overloads kept for compatibility)".

Plan Mode lets the agent "figure out and write down intent" before executing. While active, the agent is in a **read-only phase**:

- Only **read-only tools** plus 4 whitelisted tools work: `plan_enter` / `plan_write` / `plan_exit` / `todo_write` (the shell can be opted in — see [below](#allowing-the-shell-during-the-plan-phase-opt-in)).
- Only **read-only tools** plus 9 whitelisted tools work: `plan_enter` / `plan_write` / `plan_exit` / `todo_write` / `agent_spawn` / `agent_send` / `agent_list` / `task_output` / `task_list` (the shell can be opted in — see [below](#allowing-the-shell-during-the-plan-phase-opt-in)).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Info] Verified against PlanModeMiddleware.ALWAYS_ALLOWED: exactly these 9 names (plan_enter, plan_write, plan_exit, todo_write, agent_spawn, agent_send, agent_list, task_output, task_list) — good. The child-inheritance claim also checks out: AgentSpawnTool.propagatePlanMode(...) activates plan mode on the spawned child when the parent state has isPlanActive(), so removing the "known gap" note is correct.

…s (en+zh)

- plan-mode.md quoted a denial output that never existed: the real tool
  result is the PlanModeMiddleware.DENY_MESSAGE constant, so both guides
  now quote it verbatim instead of an invented header + whitelist
  enumeration.
- agent.md said ReActAgent provides RuntimeContext overloads for call
  and streamEvents; the deprecated stream(.., RuntimeContext) overloads
  still exist, so note them as kept for compatibility.
@jujn
jujn merged commit 00eb686 into agentscope-ai:main Sep 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants