Class SandboxIsolationKey
java.lang.Object
io.agentscope.harness.agent.sandbox.SandboxIsolationKey
Immutable key that uniquely identifies a sandbox state slot for a given
IsolationScope.
Use resolve(io.agentscope.harness.agent.IsolationScope, io.agentscope.core.agent.RuntimeContext, java.lang.String) to obtain a key from a RuntimeContext. The result is
Optional.empty() when the required context field is absent (e.g., USER scope
without a userId), meaning state lookup should be skipped.
-
Method Summary
Modifier and TypeMethodDescriptionbooleangetScope()Returns the isolation scope.getValue()Returns the discriminating value within the scope (e.g. session id, user id, agent name).inthashCode()static Optional<SandboxIsolationKey>resolve(IsolationScope scope, io.agentscope.core.agent.RuntimeContext ctx, String agentId) Resolves an isolation key from the given scope, runtime context, and agent ID.toString()
-
Method Details
-
resolve
public static Optional<SandboxIsolationKey> resolve(IsolationScope scope, io.agentscope.core.agent.RuntimeContext ctx, String agentId) Resolves an isolation key from the given scope, runtime context, and agent ID.Resolution rules:
SESSION– requires a non-nullsessionId; value =sessionId. Returns empty if absent.USER– usesuserIdwhen present. When userId is absent, falls back toSESSIONscope using the sessionId. Returns empty only when both userId and sessionId are absent.AGENT– value =agentId(always present).GLOBAL– value = "__global__" (always present).nullscope – treated asUSER.
- Parameters:
scope- the desired isolation scope;nulldefaults toUSERctx- the runtime context for the current call; may benullagentId- the agent name resolved at build time; must not be null- Returns:
- resolved key, or empty if the required context field is absent
-
getScope
Returns the isolation scope.- Returns:
- scope
-
getValue
Returns the discriminating value within the scope (e.g. session id, user id, agent name).- Returns:
- value string
-
equals
-
hashCode
public int hashCode() -
toString
-