class LittleGhost::Sandbox

A Sandbox decides what an agent may do with files and processes. Applications can place that work on the host, in a container or VM, or behind a remote execution service without changing their tools.

class ContainerSandbox < LittleGhost::Sandbox
  def initialize(workspace:, container:)
    super(workspace:)
    @container = container
  end

  def read(path, context: nil)
    context&.check!
    @container.read(path)
  end

  def execute_program(command, timeout:, context: nil, **)
    result = @container.run(
      command, timeout:, cancellation: context&.cancellation_token
    )
    Execution.new(**result)
  end
end

Implementations confine paths to workspace, honor RunContext cancellation, enforce time and output limits, and return Execution from process operations.