Integration
Go SDK
github.com/EvAlssment/boxkite/sdk-go talks to a hosted control-plane over HTTP. Mirrors sdk-python/sdk-js's BoxkiteClient method-for-method, adapted to Go idiom — (result, err) returns, request-struct params instead of keyword arguments, context.Context on every call.
Install
go get github.com/EvAlssment/boxkite/sdk-goQuickstart
package main
import (
"context"
"fmt"
"log"
"github.com/EvAlssment/boxkite/sdk-go"
)
func main() {
client, err := boxkite.NewClient("https://your-control-plane.example.com", "bxk_live_...")
if err != nil {
log.Fatal(err)
}
ctx := context.Background()
err = client.WithSandbox(ctx, boxkite.CreateSandboxRequest{Label: boxkite.Ptr("demo")}, func(sb *boxkite.Session) error {
result, err := sb.Exec(ctx, "python3 -c 'print(1 + 1)'", nil)
if err != nil {
return err
}
fmt.Println(result.Stdout) // "2\n"
return nil
})
// sandbox is destroyed automatically here, even if the callback returned an error
if err != nil {
log.Fatal(err)
}
}client.WithSandbox(ctx, req, fn) creates a sandbox, runs fn, and always destroys it on the way out — the Go equivalent of the Python/JS SDKs' context-manager pattern. Without it, own create/destroy yourself via client.CreateSandbox(ctx, req)/client.DestroySandbox(ctx, sessionID) — see Sandboxes for every field CreateSandboxRequest accepts.
Every capability, from this client
- Sandboxes —
CreateSandbox/CreateSandboxes/GetSandbox/ListSandboxes/DestroySandbox - Process & exec —
Exec,StartProcess/GetProcessOutput/SendProcessInput/StopProcess/ListProcesses - File system —
FileCreate/View/StrReplace/Ls/Glob/Grep - Command allowlist —
GetAllowedCommands/SetAllowedCommands/ClearAllowedCommands - Custom sandbox images —
CreateImage/GetImage/ListImages/DeleteImage - Independent storage volumes —
CreateVolume/GetVolume/ListVolumes/DeleteVolume - Secrets management —
CreateSecret/ListSecrets/DeleteSecret - Webhooks —
CreateWebhook/ListWebhooks/DeleteWebhook/ListWebhookDeliveries - Network ingress & previews —
CreatePreviewURL/RevokePreviewURL - Audit log & takeover —
GetLog/Watch/Takeover(the latter two return a*websocket.Conn)
Error handling
Every non-2xx response returns *boxkite.APIError (with .StatusCode, .Code, .Messagefrom the control-plane's error envelope). A network-level failure returns *boxkite.ConnectionError, which unwraps to the underlying error.