Interface SandboxLease

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
SandboxLease.NoopSandboxLease

public interface SandboxLease extends AutoCloseable
A handle that represents a held execution right on a sandbox isolation slot.

Returned by SandboxExecutionGuard.tryEnter(io.agentscope.harness.agent.sandbox.SandboxIsolationKey). The harness closes the lease automatically after SandboxManager.release(io.agentscope.harness.agent.sandbox.SandboxAcquireResult) completes (whether the call succeeded or failed), so implementations do not need to worry about cleanup ordering.

Implementations must be idempotent: calling close() more than once must be safe.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
    Singleton no-op implementation.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Releases the execution right held by this lease.
    Returns a no-op lease whose close() is a no-op.
  • Method Details

    • close

      void close()
      Releases the execution right held by this lease.

      Must not throw. Any release-side error should be logged internally by the implementation.

      Specified by:
      close in interface AutoCloseable
    • noop

      static SandboxLease noop()
      Returns a no-op lease whose close() is a no-op. Used by the default SandboxExecutionGuard.noop() implementation.