Class KubernetesSandbox
java.lang.Object
io.agentscope.harness.agent.sandbox.AbstractBaseSandbox
io.agentscope.extensions.sandbox.kubernetes.KubernetesSandbox
- All Implemented Interfaces:
io.agentscope.harness.agent.sandbox.Sandbox,io.agentscope.harness.agent.sandbox.SandboxFileTransfer,AutoCloseable
public class KubernetesSandbox
extends io.agentscope.harness.agent.sandbox.AbstractBaseSandbox
implements io.agentscope.harness.agent.sandbox.SandboxFileTransfer
Harness
Sandbox backed by an
agent-sandbox CRD via the Java client SDK.
Assumes the runtime image conforms to the AgentScope runtime contract (see the sandbox
documentation): POST /execute interprets the command with a POSIX shell, and the
file API (/upload / /download) is rooted at a known base directory.
Workspace archives (persist / hydrate) are transferred through the runtime file API
(files().read() / files().write()) when fileApiBaseDir is
configured; when it is blank, transfers fall back to base64 payloads over exec.
Single-file transfers requested by the harness filesystem (SandboxFileTransfer)
also go through the file API for paths under fileApiBaseDir.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected io.agentscope.harness.agent.sandbox.ExecResultprotected voiddoHydrateWorkspace(InputStream archive) protected InputStreamprotected voidbyte[]downloadFile(String absolutePath) Returns the underlying SDK sandbox handle.protected Stringvoidshutdown()booleansupportsFileTransfer(String absolutePath) voiduploadFile(String absolutePath, byte[] content) Methods inherited from class io.agentscope.harness.agent.sandbox.AbstractBaseSandbox
close, exec, getDefaultExecTimeoutSeconds, getState, hydrateWorkspace, isRunning, persistWorkspace, probeWorkspaceRootForPreservedResume, start, stop
-
Constructor Details
-
KubernetesSandbox
-
-
Method Details
-
shutdown
- Specified by:
shutdownin interfaceio.agentscope.harness.agent.sandbox.Sandbox- 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
-
getSdkSandbox
Returns the underlying SDK sandbox handle.- Returns:
- SDK sandbox
-
supportsFileTransfer
- Specified by:
supportsFileTransferin interfaceio.agentscope.harness.agent.sandbox.SandboxFileTransfer
-
uploadFile
- Specified by:
uploadFilein interfaceio.agentscope.harness.agent.sandbox.SandboxFileTransfer- Throws:
Exception
-
downloadFile
- Specified by:
downloadFilein interfaceio.agentscope.harness.agent.sandbox.SandboxFileTransfer- Throws:
Exception
-