Class SandboxManager
Sandbox instances for the current call.
Acquire priority: SandboxContext.getExternalSandbox() > SandboxContext.getExternalSandboxState() > persisted SandboxState > SandboxClient.create(io.agentscope.harness.agent.sandbox.WorkspaceSpec, io.agentscope.harness.agent.sandbox.snapshot.SandboxSnapshotSpec, O). When a persisted state exists but the resume fails, the fresh-create
fallback keeps the persisted snapshot id so the workspace restores from the previous archive
instead of silently resetting.
When a SandboxExecutionGuard is configured, the manager acquires an execution
SandboxLease before sandbox resume/create for isolation keys that are present. The
lease is carried by the SandboxAcquireResult and closed by the caller
(SandboxLifecycleMiddleware) after release(io.agentscope.harness.agent.sandbox.SandboxAcquireResult),
ensuring the full call window is covered.
Priority 1 (external sandbox) and Priority 2 (external sandbox state) bypass the guard, since the caller is managing that sandbox externally.
-
Constructor Summary
ConstructorsConstructorDescriptionSandboxManager(SandboxClient<?> client, SessionSandboxStateStore stateStore, String agentId) SandboxManager(SandboxClient<?> client, SessionSandboxStateStore stateStore, String agentId, SandboxExecutionGuard executionGuard) -
Method Summary
Modifier and TypeMethodDescriptionacquire(SandboxContext sandboxContext, io.agentscope.core.agent.RuntimeContext runtimeContext) voidclearState(SandboxContext sandboxContext, io.agentscope.core.agent.RuntimeContext runtimeContext) voidpersistState(SandboxAcquireResult result, SandboxContext sandboxContext, io.agentscope.core.agent.RuntimeContext runtimeContext) voidrelease(SandboxAcquireResult result)
-
Constructor Details
-
SandboxManager
-
SandboxManager
public SandboxManager(SandboxClient<?> client, SessionSandboxStateStore stateStore, String agentId, SandboxExecutionGuard executionGuard)
-
-
Method Details
-
acquire
public SandboxAcquireResult acquire(SandboxContext sandboxContext, io.agentscope.core.agent.RuntimeContext runtimeContext) throws Exception - Throws:
Exception
-
release
-
persistState
public void persistState(SandboxAcquireResult result, SandboxContext sandboxContext, io.agentscope.core.agent.RuntimeContext runtimeContext) -
clearState
public void clearState(SandboxContext sandboxContext, io.agentscope.core.agent.RuntimeContext runtimeContext)
-