Skip to main content
Every signature below is verified against the built module (go get github.com/boxlite-ai/boxlite/sdks/[email protected] + go run .../cmd/setup, then go build) and, where marked, against a real run’s output.

Prerequisites

  • Go 1.24+ with CGO enabled (the default) — see Go quickstart for the full install flow (go get + cmd/setup).

Core types and methods

*Runtime

*Box

A failed Exec/StartExecution returns (nil, err). Check err before touching the result — a nil-pointer dereference on the result is a real, reproduced panic if you skip this.

*Cmd (from Box.Command)

Differs from os/exec. The standard library’s Cmd.Run/Output return a *exec.ExitError on a non-zero exit. BoxLite’s Cmd returns nil in that case — read ExitCode() yourself, matching Box.Exec’s own non-throwing behavior.

ExecResult (from Exec)

*Execution (from StartExecution) / ExecutionOptions

Functional options (BoxOption)

BoxInfo

RuntimeMetrics / BoxMetrics

Error handling

Errors are *boxlite.Error, with .Code an ErrorCode and .Message a string; Error() string formats both. Typed helpers: IsNotFound(err) / IsAlreadyExists(err) / IsInvalidState(err) / IsStopped(err). Verified: a start failure (missing binary) produced
code=1 is ErrInternal, not ErrExecution; do not assume a spawn failure is always ErrExecution.

Troubleshooting

Nil-pointer dereference after a failed Exec

See the Go quickstart — a start failure returns (nil, err); check err first.

Cmd.Run/Output return nil on a non-zero exit

This is intentional and matches Box.Exec, but it is the opposite of os/exec’s behavior — see the Go quickstart.

ld: warning: ignoring duplicate libraries: '-lresolv'

A harmless link-time warning on macOS, reproduced on every build against this SDK; not an error.

context deadline exceeded from cmd/setup

The one-time native-library download can exceed the tool’s internal timeout on a slow connection. Re-running it resumes from whatever was already extracted — see the Go quickstart.

Next steps

  • Go quickstart for the full install flow and a runnable first program.
  • Box types and Manage sandboxes for the capabilities every SDK shares, expressed here as BoxOption functional options instead of keyword arguments.