control

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package control defines the SandboxControl interface for orchestrator-level sandbox lifecycle management. This is distinct from the agent-loop-level ExecutionEnvironment — SandboxControl provisions/destroys sandboxes and launches processes, while ExecutionEnvironment executes tools within them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressToURL

func AddressToURL(addr string) string

AddressToURL converts a "host:port" address string to an HTTP URL.

Types

type CreateSandboxRequest

type CreateSandboxRequest struct {
	Labels    map[string]string
	Template  string       // Provider-specific template/base image.
	Resources ResourceSpec // CPU, memory limits.
}

CreateSandboxRequest configures a new sandbox.

type CreateSandboxResponse

type CreateSandboxResponse struct {
	SandboxID    string
	Address      string // How to reach this sandbox ("host:port").
	Capabilities SandboxCapabilities
}

CreateSandboxResponse is returned after sandbox creation.

type GetProcessStatusRequest

type GetProcessStatusRequest struct {
	SandboxID string
	ProcessID string
}

GetProcessStatusRequest queries a process's current state.

type GetProcessStatusResponse

type GetProcessStatusResponse struct {
	Status   ProcessStatus
	ExitCode *int // Only set if Status == ProcessExited.
}

GetProcessStatusResponse returns process status and exit code.

type KillProcessRequest

type KillProcessRequest struct {
	SandboxID string
	ProcessID string
	Signal    int // Unix signal (default SIGTERM if 0).
}

KillProcessRequest terminates a running process.

type LaunchProcessRequest

type LaunchProcessRequest struct {
	SandboxID  string
	Binary     string            // Path to binary or command name.
	Args       []string          // Command arguments.
	Env        map[string]string // Environment variables (including API keys).
	ExposePort int               // Port the process will listen on inside sandbox.
}

LaunchProcessRequest starts a long-running process in an existing sandbox.

type LaunchProcessResponse

type LaunchProcessResponse struct {
	ProcessID string
	Address   string        // How to reach the launched process ("host:port").
	Status    ProcessStatus // Initial status.
}

LaunchProcessResponse is returned after launching a process.

type ProcessStatus

type ProcessStatus string

ProcessStatus indicates the lifecycle state of a launched process.

const (
	ProcessStarting ProcessStatus = "starting"
	ProcessRunning  ProcessStatus = "running"
	ProcessExited   ProcessStatus = "exited"
)

type ResourceSpec

type ResourceSpec struct {
	CPUs  float64
	MemMB int
}

ResourceSpec specifies CPU and memory limits for a sandbox.

type SandboxCapabilities

type SandboxCapabilities struct {
	Snapshots           bool
	Rollback            bool
	Pause               bool
	LaunchProcess       bool
	DeepPause           bool          // ZFS-to-S3 style cold storage (future).
	ConcurrentSandboxes int           // Max concurrent sandbox instances (0 = unlimited).
	MaxSandboxDuration  time.Duration // Max sandbox lifetime (0 = unlimited).
}

SandboxCapabilities reports what a sandbox provider supports.

type SandboxControl

type SandboxControl interface {
	// CreateSandbox provisions a new sandbox environment.
	CreateSandbox(ctx context.Context, req CreateSandboxRequest) (*CreateSandboxResponse, error)

	// DestroySandbox tears down a sandbox and releases all resources.
	DestroySandbox(ctx context.Context, sandboxID string) error

	// LaunchProcess starts a long-running process inside an existing sandbox.
	// Returns connectivity info (address, port) for the launched process.
	LaunchProcess(ctx context.Context, req LaunchProcessRequest) (*LaunchProcessResponse, error)

	// KillProcess terminates a previously launched process.
	KillProcess(ctx context.Context, req KillProcessRequest) error

	// GetProcessStatus returns the current status of a launched process.
	GetProcessStatus(ctx context.Context, req GetProcessStatusRequest) (*GetProcessStatusResponse, error)

	// PauseSandbox pauses a sandbox (provider-specific semantics).
	PauseSandbox(ctx context.Context, sandboxID string) error

	// ResumeSandbox resumes a paused sandbox.
	ResumeSandbox(ctx context.Context, sandboxID string) error

	// Capabilities returns what this provider supports.
	Capabilities() SandboxCapabilities
}

SandboxControl manages sandbox lifecycle. The orchestrator uses this to create/destroy sandboxes and launch processes inside them.

Directories

Path Synopsis
Package cloud provides placeholder stubs for cloud-based SandboxControl providers (E2B, Daytona, Fly).
Package cloud provides placeholder stubs for cloud-based SandboxControl providers (E2B, Daytona, Fly).
Package direct implements DirectSandboxControl, which manages raw EC2 instances as agent execution environments.
Package direct implements DirectSandboxControl, which manages raw EC2 instances as agent execution environments.
Package fleet implements FleetSandboxControl, a SandboxControl adapter that manages a fleet of sandbox-host instances with auto-scaling, health monitoring, warm pool maintenance, and capacity-aware routing.
Package fleet implements FleetSandboxControl, a SandboxControl adapter that manages a fleet of sandbox-host instances with auto-scaling, health monitoring, warm pool maintenance, and capacity-aware routing.
ec2
Package ec2 implements the instance.InstanceProvisioner interface using the AWS EC2 API (SDK v2).
Package ec2 implements the instance.InstanceProvisioner interface using the AWS EC2 API (SDK v2).
Package instance defines the InstanceProvisioner interface and associated types for cloud instance lifecycle management.
Package instance defines the InstanceProvisioner interface and associated types for cloud instance lifecycle management.
Package node implements NodeSandboxControl, which wraps our sandbox-host RPC service to satisfy the SandboxControl interface.
Package node implements NodeSandboxControl, which wraps our sandbox-host RPC service to satisfy the SandboxControl interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL