IsolationScope
public enum IsolationScope
io/agentscope/harness/agent/IsolationScope.java:53–127定义隔离范围相关取值的枚举。位于 io.agentscope.harness.agent 包。核心成员包括 toNamespaceFactory、SESSION、USER、AGENT、GLOBAL。
Controls how agent state is isolated and shared across calls.
This enum is the canonical isolation-scope definition used by both the sandbox filesystem
backend (io.agentscope.harness.agent.sandbox.SandboxContext) and the remote filesystem
backend (RemoteFilesystemSpec).
Sandbox semantics: the scope determines which key is used when persisting and loading
_sandbox.json state. Calls that resolve to the same scope key will
sequentially reuse the same sandbox (each call resumes the persisted state from the previous
one).
Store namespace semantics: the scope determines the namespace prefix used by
RemoteFilesystem when routing files to the shared
key-value store. Different scopes produce different namespace prefixes, controlling which calls
share the same view of stored files.
Scope selection:
-
#USER– shared across all sessions of the same user; the default. WhenuserIdis absent, falls back to#SESSION. -
#SESSION– isolated per session. -
#AGENT– shared across all users and sessions of the same agent. -
#GLOBAL– globally shared within the same workspace/store instance.
Concurrency note: for sandbox mode this is sequential-reuse sharing, not live-instance sharing. Concurrent calls at the same scope each get their own running container; they converge on the last persisted snapshot at the end of the call.
枚举常量摘要Enum Constant Summary
| 常量Constant | 说明Description |
|---|---|
SESSION | 执行会话相关操作。 Isolate by session identifier. |
USER | 执行用户相关操作。 Share across all sessions belonging to the same
userId (`io.agentscope.core.agent.RuntimeContext#getUserId()`). |
AGENT | 执行智能体相关操作。 Share across all users and sessions of the same agent (identified by agent name). |
GLOBAL | 执行 `GLOBAL` 方法。 One shared state / namespace globally within the same workspace store instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public NamespaceFactory toNamespaceFactory() | 返回到命名空间工厂。 Creates a `NamespaceFactory` that derives the filesystem namespace prefix from the
`io.agentscope.core.agent.RuntimeContext` according to this scope. |
枚举常量详情Enum Constant Detail
SESSION
SESSION
执行会话相关操作。
Isolate by session identifier.
io/agentscope/harness/agent/IsolationScope.java:62USER
USER
执行用户相关操作。
Share across all sessions belonging to the same userId (io.agentscope.core.agent.RuntimeContext#getUserId()).
io/agentscope/harness/agent/IsolationScope.java:71AGENT
AGENT
执行智能体相关操作。
Share across all users and sessions of the same agent (identified by agent name).
io/agentscope/harness/agent/IsolationScope.java:79GLOBAL
GLOBAL
执行 GLOBAL 方法。
One shared state / namespace globally within the same workspace store instance.
io/agentscope/harness/agent/IsolationScope.java:87方法详情Method Detail
toNamespaceFactory
public NamespaceFactory toNamespaceFactory()
返回到命名空间工厂。
Creates a NamespaceFactory that derives the filesystem namespace prefix from the io.agentscope.core.agent.RuntimeContext according to this scope.
NamespaceFactoryio/agentscope/harness/agent/IsolationScope.java:102–126