This guide walks you through installing the Sprites Go SDK, creating a client, and executing your first remote command. The whole flow mirrors the standard library’sDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/superfly/sprites-go/llms.txt
Use this file to discover all available pages before exploring further.
os/exec package — if you have used exec.Command before, you already know most of the API.
Install the SDK
Add the module to your Go project with
go get:The module path is
github.com/superfly/sprites-go but the package name is sprites. Import it with an alias to use the short package name in your code.Import the package and create a client
Import If you need a custom API endpoint, pass the See Authentication for how to obtain a token and for all available client options.
sprites and call sprites.New with your auth token. The default base URL points to https://api.sprites.dev — you do not need to configure it for production use.WithBaseURL option:Get a sprite handle
Call The client attempts to establish a multiplexed control connection in the background. If the sprite is not reachable within the configured timeout (default 2 seconds), subsequent commands fall back to direct WebSocket connections per request.
client.Sprite with the name of your sprite. This returns a *Sprite handle immediately — it does not make a blocking network call to create the sprite.Run a command and read its output
Call Use
sprite.Command exactly as you would call exec.Command. The returned *Cmd supports the same methods:cmd.Run() when you do not need to capture output, or cmd.CombinedOutput() to merge stdout and stderr into a single byte slice.Complete working example
The following program demonstrates a client with a custom base URL, a simple command, a command with piped stdin and a context timeout, and environment variable injection — all drawn from the SDK’s README:Handling exit errors
When a remote process exits with a non-zero status,Run, Output, and CombinedOutput return an *ExitError. Inspect it to get the exact exit code:
Next steps
Authentication
Exchange a Fly.io macaroon for a sprite token and explore all client options.
Introduction
Read about all SDK capabilities: TTY, port forwarding, services, checkpoints, and more.