Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

API Overview

The OpenShell Go SDK exposes 12 interfaces through the sub-client pattern. You access each interface through a typed accessor on the Client.

Interface Summary

Top-Level Interfaces

InterfaceAccessorDescription
SandboxInterfaceclient.Sandboxes()Create, manage, and watch sandbox lifecycle
ExecInterfaceclient.Exec()Run commands, stream output, interactive sessions
ProviderInterfaceclient.Providers()Manage compute providers and their lifecycle
ServiceInterfaceclient.Services()Expose and manage HTTP services inside sandboxes
FileInterfaceclient.Files()Upload and download files to/from sandboxes
HealthInterfaceclient.Health()Check gateway health status
SSHInterfaceclient.SSH()Create SSH sessions and tunnels to sandboxes
TCPInterfaceclient.TCP()Forward TCP connections to sandbox ports
ConfigInterfaceclient.Config()Read and update sandbox and gateway configuration
PolicyInterfaceclient.Policy()Manage draft policy recommendations

Convenience Packages

PackageEntry PointDescription
gatewaygateway.NewClient(name)Read CLI gateway configs and auto-wire clients

Provider Sub-Interfaces

These are accessed through client.Providers():

InterfaceAccessorDescription
ProfileInterfaceclient.Providers().Profiles()Manage provider type profiles
RefreshInterfaceclient.Providers().Refresh()Configure credential refresh strategies

Interfaces

Each interface has a reference page with method signatures and usage examples:

  • Sandboxes: Create sandboxes, wait for readiness, watch state changes, manage providers, retrieve logs.
  • Exec: Execute commands with one-shot, streaming, or interactive modes.
  • Providers: Register and manage compute providers. Includes sub-clients for profiles and credential refresh.
  • Services: Expose and manage HTTP services inside sandboxes.
  • Files: Upload and download files to/from sandboxes.
  • Health: Check gateway health status.
  • SSH: Create SSH sessions and tunnels to sandboxes.
  • TCP: Forward TCP connections to sandbox ports.
  • Config: Read and update sandbox and gateway configuration.
  • Policy: Manage draft policy recommendations.
  • Profiles: Manage provider type profiles (via client.Providers().Profiles()).
  • Refresh: Configure credential refresh strategies (via client.Providers().Refresh()).

Common Patterns

All SDK methods follow these conventions:

  • Every method takes context.Context as its first argument
  • Methods that can fail return (result, error)
  • List methods accept variadic option arguments
  • Errors from the gateway carry a StatusError with a typed code (see Error Handling)