AS AgentScopeAPI 手册 / API Reference

PlanModeManager

public final class PlanModeManager
源码Source io/agentscope/harness/agent/workspace/plan/PlanModeManager.java:39–115

计划模式管理器,把复杂任务拆分为可执行步骤并驱动流程。位于 io.agentscope.harness.agent.workspace.plan 包。核心成员包括 isPlanActive、enter、exit、planFilePath、writePlan、PlanModeManager。

Coordinates plan mode for a single agent.

State (whether plan mode is active and which markdown file holds the current plan) lives in PlanModeContextState inside the agent's AgentState, so it is persisted with the session and survives restarts / cross-node hand-offs — this is the mechanism that makes dynamic (runtime) plan-mode switching work in a distributed setting, where an in-process boolean would be lost.

The plan markdown file is written exclusively through WorkspaceManager, never via java.nio.file.Files, so it lands on whatever backend (local, sandbox, remote) the agent's filesystem is configured with. The logical path stays <planDir>/PLAN.md for every isolation scope; per-scope isolation is applied transparently by the filesystem (store namespace for remote, snapshot key for sandbox) rather than by encoding it into the path.

字段摘要Field Summary

字段Field类型Type说明Description
DEFAULT_PLAN_DIR
staticfinal
String
默认计划目录字段。
Default workspace-relative directory for plan files.

构造器摘要Constructor Summary

构造器Constructor说明Description
public PlanModeManager(WorkspaceManager workspaceManager, String planDir)
初始化 `PlanModeManager` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public boolean isPlanActive(AgentState state)
判断是否 `isPlanActive`。
Returns whether the plan active.
public String enter(AgentState state)
设置该参数。
Enters plan mode.
public void exit(AgentState state)
设置该参数。
Exits plan mode (back to BUILD).
public String planFilePath(AgentState state)
设置计划文件路径。
Workspace-relative path of the plan file currently associated with this agent.
public String writePlan(RuntimeContext rc, AgentState state, String content)
执行写入计划相关操作。
Writes (creates or overwrites) the plan markdown file through the workspace filesystem and records its path in state.

字段详情Field Detail

DEFAULT_PLAN_DIR

public static final String DEFAULT_PLAN_DIR
staticfinal

默认计划目录字段。声明为 public static final String DEFAULT_PLAN_DIR。

Default workspace-relative directory for plan files.

源码Source io/agentscope/harness/agent/workspace/plan/PlanModeManager.java:42

构造器详情Constructor Detail

PlanModeManager

public PlanModeManager(WorkspaceManager workspaceManager, String planDir)

初始化 PlanModeManager 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
workspaceManagerWorkspaceManager工作区管理器(类型 `WorkspaceManager`)。The workspace manager.
planDirString计划目录(类型 `String`)。The plan dir.
源码Source io/agentscope/harness/agent/workspace/plan/PlanModeManager.java:47–58

方法详情Method Detail

isPlanActive

public boolean isPlanActive(AgentState state)

判断是否 isPlanActive。

Returns whether the plan active.

参数Parameters
名称Name类型Type说明Description
stateAgentState状态对象(类型 `AgentState`)。The state.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/harness/agent/workspace/plan/PlanModeManager.java:60–62

enter

public String enter(AgentState state)

设置该参数。

Enters plan mode.

参数Parameters
名称Name类型Type说明Description
stateAgentState状态对象(类型 `AgentState`)。The state.
返回Returns String
返回字符串结果。the workspace-relative plan file path
源码Source io/agentscope/harness/agent/workspace/plan/PlanModeManager.java:69–77

exit

public void exit(AgentState state)

设置该参数。

Exits plan mode (back to BUILD).

参数Parameters
名称Name类型Type说明Description
stateAgentState状态对象(类型 `AgentState`)。The state.
源码Source io/agentscope/harness/agent/workspace/plan/PlanModeManager.java:80–83

planFilePath

public String planFilePath(AgentState state)

设置计划文件路径。

Workspace-relative path of the plan file currently associated with this agent.

参数Parameters
名称Name类型Type说明Description
stateAgentState状态对象(类型 `AgentState`)。The state.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/workspace/plan/PlanModeManager.java:86–94

writePlan

public String writePlan(RuntimeContext rc, AgentState state, String content)

执行写入计划相关操作。

Writes (creates or overwrites) the plan markdown file through the workspace filesystem and records its path in state.

参数Parameters
名称Name类型Type说明Description
rcRuntimeContextrc(类型 `RuntimeContext`)。The rc.
stateAgentState状态对象(类型 `AgentState`)。The state.
contentString内容(类型 `String`)。The content.
返回Returns String
返回字符串结果。the workspace-relative path written
源码Source io/agentscope/harness/agent/workspace/plan/PlanModeManager.java:102–110
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.