Class SandboxAcquireResult
java.lang.Object
io.agentscope.harness.agent.sandbox.SandboxAcquireResult
Result of acquiring a
Sandbox from SandboxManager.
Two ownership modes:
- self-managed (
selfManaged=true): the SDK created the sandbox and is responsible for its full lifecycle —stop()+shutdown()are both called after each agent call. - user-managed (
selfManaged=false): the caller injected a pre-existing sandbox; the SDK only callsstop()and never callsshutdown().
When a SandboxExecutionGuard is configured, the result also carries the
SandboxLease that was acquired before sandbox resume/create. The harness closes it
after SandboxManager.release(io.agentscope.harness.agent.sandbox.SandboxAcquireResult) completes to cover the full call window.
-
Method Summary
Modifier and TypeMethodDescriptiongetLease()Returns theSandboxLeaseheld for this call, or a no-op lease if no guard was configured.booleanReturnstrueif the SDK owns the full sandbox lifecycle.static SandboxAcquireResultselfManaged(Sandbox sandbox) Creates a self-managed result with no guard (SDK owns the full lifecycle).static SandboxAcquireResultselfManaged(Sandbox sandbox, SandboxLease lease) Creates a self-managed result with a guard lease (SDK owns the full lifecycle).static SandboxAcquireResultuserManaged(Sandbox sandbox) Creates a user-managed result (caller owns the lifecycle; SDK only calls stop).
-
Method Details
-
selfManaged
Creates a self-managed result with a guard lease (SDK owns the full lifecycle). -
selfManaged
Creates a self-managed result with no guard (SDK owns the full lifecycle). -
userManaged
Creates a user-managed result (caller owns the lifecycle; SDK only calls stop). -
getSandbox
-
isSelfManaged
public boolean isSelfManaged()Returnstrueif the SDK owns the full sandbox lifecycle. -
getLease
Returns theSandboxLeaseheld for this call, or a no-op lease if no guard was configured. The harness closes this lease afterSandboxManager.release(io.agentscope.harness.agent.sandbox.SandboxAcquireResult)completes.
-