Skip to main content
The Go SDK builds agent workers in Go: register a worker, receive work, and stream runs, spans, and results to the control plane with no Python in the container. This page covers the worker loop, configuration, what the agent advertises about itself, and the telemetry surface available inside a handler.

Install

Requires Go 1.26 or newer.

A minimal worker

Run blocks and manages the whole lifecycle — register, heartbeat, hold the reverse channel, claim work, dispatch it — until the context is cancelled. Returning the output map completes the run; returning an error fails it, and a panic is recovered into a run failure.
Output convention, same as every other surface: a text key in the returned map is the run’s descriptive output — what a person sees as the answer — and every other key is structured detail.

Configuration

Config fields fall back to environment variables when unset: Two more are worth knowing:
  • MaxConcurrent (AGENTOPS_MAX_CONCURRENT, default 1) — how many runs the worker handles at once. One at a time is the default; raise it for I/O-bound agents whose runs can overlap, and each run still gets its own Run and its own goroutine.
  • DrainTimeout (default 30s) — how long an in-flight run may continue after shutdown begins before its context is cancelled.
Cluster placement is reported automatically from AGENTOPS_CLUSTER_NAME, AGENTOPS_NAMESPACE, and AGENTOPS_POD_NAME when they are set.

What the agent advertises

Config.Agent is the worker’s self-description, sent once at registration and surfaced in the fleet:
Skills and UseCases are easy to confuse and are not the same thing. A skill is know-how the agent reads; a use case is an entry point something else can call, and a handler branches on run.UseCase() to tell which one it was invoked for.

Inside a handler

The session snapshot is sent as-is and is not secret-masked — masking it would corrupt the state it exists to preserve. Keep credentials out of it.

Next steps

Python SDK

The same contract in Python, with framework adapters.

Agent identity

Where the worker token comes from.

Triggers & schedules

What a declared trigger becomes on the platform side.

Runs & evidence

Where the spans and messages you stream end up.