Class E2bSandbox
- All Implemented Interfaces:
io.agentscope.harness.agent.sandbox.Sandbox,AutoCloseable
Sandbox backed by E2B cloud sandboxes.
Execution uses envd process.Process/Start over HTTPS (Connect+protobuf). Workspace
tar is streamed as binary stdout for E2bPersistenceMode.TAR; E2bPersistenceMode.NATIVE_SNAPSHOT uses the platform snapshot API and E2bSnapshotRefs
marker bytes in the Harness snapshot stream.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected io.agentscope.harness.agent.sandbox.ExecResultprotected voiddoHydrateWorkspace(InputStream archive) protected InputStreamprotected voidprotected Stringvoidshutdown()voidstart()voidstop()Methods inherited from class io.agentscope.harness.agent.sandbox.AbstractBaseSandbox
close, exec, getDefaultExecTimeoutSeconds, getState, hydrateWorkspace, isRunning, persistWorkspace, probeWorkspaceRootForPreservedResume
-
Constructor Details
-
E2bSandbox
-
-
Method Details
-
start
- Specified by:
startin interfaceio.agentscope.harness.agent.sandbox.Sandbox- Overrides:
startin classio.agentscope.harness.agent.sandbox.AbstractBaseSandbox- Throws:
Exception
-
stop
A failed workspace persist must not leave its snapshot id in
E2bSandboxState.getSnapshotIds(): the persisted archive still references the previous snapshot, and a record holding the newer id as well would makecleanupSnapshots()delete the snapshot that archive restores from. The id is therefore removed by identity, not by position — the record is shared state, and ids another session appended meanwhile are not this call's to drop. The exception is re-thrown unchanged:SandboxManager.releaseswallows it and the caller persists the state afterwards, so the corrected record still reaches the store.- Specified by:
stopin interfaceio.agentscope.harness.agent.sandbox.Sandbox- Overrides:
stopin classio.agentscope.harness.agent.sandbox.AbstractBaseSandbox- Throws:
Exception
-
shutdown
- Throws:
Exception
-
doExec
protected io.agentscope.harness.agent.sandbox.ExecResult doExec(io.agentscope.core.agent.RuntimeContext runtimeContext, String command, int timeoutSeconds) throws Exception - Specified by:
doExecin classio.agentscope.harness.agent.sandbox.AbstractBaseSandbox- Throws:
Exception
-
doPersistWorkspace
- Specified by:
doPersistWorkspacein classio.agentscope.harness.agent.sandbox.AbstractBaseSandbox- Throws:
Exception
-
doHydrateWorkspace
- Specified by:
doHydrateWorkspacein classio.agentscope.harness.agent.sandbox.AbstractBaseSandbox- Throws:
Exception
-
doSetupWorkspace
- Specified by:
doSetupWorkspacein classio.agentscope.harness.agent.sandbox.AbstractBaseSandbox- Throws:
Exception
-
doDestroyWorkspace
- Specified by:
doDestroyWorkspacein classio.agentscope.harness.agent.sandbox.AbstractBaseSandbox- Throws:
Exception
-
getWorkspaceRoot
- Specified by:
getWorkspaceRootin classio.agentscope.harness.agent.sandbox.AbstractBaseSandbox
-