Enum Class WorkspaceMode

java.lang.Object
java.lang.Enum<WorkspaceMode>
io.agentscope.harness.agent.subagent.WorkspaceMode
All Implemented Interfaces:
Serializable, Comparable<WorkspaceMode>, Constable

public enum WorkspaceMode extends Enum<WorkspaceMode>
Controls how a declared subagent's runtime workspace root is determined.

The five-row decision table:

 workspacePath  mode      runtime-workspace-root
 ─────────────────────────────────────────────────────────────────────────────
 set            ISOLATED  workspacePath  (definition dir is also the runtime root)
 set            SHARED    mainWorkspace  (definition skills/knowledge ignored)
 null           ISOLATED  mainWorkspace/agents/<name>/workspace/  (auto-created)
 null           SHARED    mainWorkspace
 (general-purpose, always SHARED)       mainWorkspace  (fully mirrors main agent)
 

Phase B-0 — persisted session bucketing: ISOLATED-mode subagents bucket their persisted state by parent (userId, parentSessionId) when the spawn-time RuntimeContext carries those fields. The composed key has form {declarationName}[@{parentSessionId}][#{userId}] and is applied uniformly across AgentStateStore stores (Workspace, Redis, InMemory, custom), because all of them already partition state by (userId, sessionId). SHARED-mode is unchanged — those subagents intentionally use the parent's bucket and do not multi-tenant.

  • Enum Constant Details

    • ISOLATED

      public static final WorkspaceMode ISOLATED
      The subagent gets its own isolated workspace.
      • If SubagentDeclaration.getWorkspacePath() is set, that path is the runtime root and also the source for the sysPrompt (AGENTS.md).
      • Otherwise the runtime root is auto-created at mainWorkspace/agents/&lt;name&gt;/workspace/ and the inline body is used as sysPrompt.
    • SHARED

      public static final WorkspaceMode SHARED
      The subagent shares the main agent's workspace.
      • The runtime root is always mainWorkspace, regardless of SubagentDeclaration.getWorkspacePath().
      • If workspacePath is set, its AGENTS.md is used as the sysPrompt body; but the definition's skills/, knowledge/, and MEMORY.md are ignored.
      • If workspacePath is absent, the inline body is used as sysPrompt.
  • Method Details

    • values

      public static WorkspaceMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static WorkspaceMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null