Skip to main content
mirrorkit-go is the Go sibling of the Python and TypeScript collectors. It does exactly one thing: take traces you hand it and send them to Mirrors: batched in the background, non-blocking, and safe (it never panics into your app after Init). It does not instrument SDKs and does not run agents; you build the trace, it ships it.

How do I install the Go collector?

Run go get github.com/ai-singhal/mirrorkit-go. It requires Go ≥ 1.21 and has zero dependencies (standard library only).

How do I send traces from a Go agent?

Call mirrorkit.Init once with your workspace key and project, defer mirrorkit.Shutdown, and call mirrorkit.LogTrace with the messages you want recorded. Unlike the Python and TypeScript collectors, the Go one does not instrument SDKs, so you assemble the messages and it handles delivery.

How do I record tool calls in Go?

Build tool-call and tool-result messages with the helpers. Tool calls and their results are the most useful part of a trace, because they are what Mirrors uses to infer your agent’s world:

Options

Endpoint resolution: Options.EndpointMIRRORKIT_ENDPOINTMIRROR_ENDPOINT → the production default.

Lifecycle

Prefer one collector per process via the package-level Init / LogTrace / Flush / Shutdown. For multiple independent collectors, use NewClient and call LogTrace / Flush / Shutdown on the returned *Client.
Each trace is flushed to {endpoint}/api/collect with Authorization: Bearer <apiKey>. See the collect API reference for the wire format.