SandboxInterface - Tinker Documentation

tinker_cookbook.sandbox.SandboxInterface

class tinker_cookbook.sandbox.SandboxInterface (Protocol)

Interface for a sandbox.

Implementations must provide: run_command, read_file, write_file, send_heartbeat, and cleanup.

property sandbox_id

Identifier for the sandbox instance (e.g. Modal object_id).

Returns: str

send_heartbeat (timeout)

Send a heartbeat to keep the sandbox alive.

If the sandbox server does not support heartbeat, this method can be a no-op.

Parameters:

Returns: None

run_command (command, workdir, timeout, max_output_bytes)

Run a command in the sandbox.

Setting workdir=None will run the command in the default WORKDIR set in the container image (Dockerfile).

Parameters:

Returns: SandboxResult

read_file (path, max_bytes, timeout)

Read the content of a file from the sandbox.

Parameters:

Returns: SandboxResult

write_file (path, content, executable, timeout)

Write content to a file in the sandbox.

Parameters:

Returns: SandboxResult

cleanup()

Clean up the sandbox.

Returns: None