{"id":"f4a99415-d2b7-4882-bf05-1465d0fcedc2","slug":"mirrorkit-go","kind":"mcp","name":"mirrorkit-go","summary":"Drop-in production trace collector for LLM agents (Go). Streams traces to your Mirrors backend.","owner":"ai-singhal","repoUrl":"https://github.com/ai-singhal/mirrorkit-go","license":"MIT","licenseTier":"permissive","trust":"community","stars":0,"match":null,"fewStars":true,"format":"mcp","createdAt":"2026-07-02T23:38:44.000Z","addedAt":"2026-10-13T22:11:21.156Z","logoUrl":"https://avatars.githubusercontent.com/u/78041644?u=791e3b333c8ffaffd4fe5ba522fbd6ebf92233e5&v=4","linkOnly":false,"collection":null,"skillPath":null,"categories":["utilities"],"tags":[],"runtime":"remote","local":false,"cloudCapable":false,"cloudCapability":"unknown","cloudReadyOnPlatform":false,"needsApiKey":false,"reviewed":false,"syncedAt":"2026-10-17T12:24:54.709Z","sample":false,"url":"https://conduits.dev/tools/mirrorkit-go","language":"Go","transports":["http"],"install":{"remoteUrl":"https://api.runmirrors.com/mcp"},"requirements":{"env":[],"upstreamMayCharge":false},"tools":null,"readme":"# mirrorkit (Go)\n\nA lightweight, **drop-in** production trace collector for LLM agents — the Go\nsibling of the Python [`mirrorkit`](https://pypi.org/project/mirrorkit/) and\nTypeScript `mirrorkit` (npm) packages.\n\nIt does exactly one thing: **take traces you hand it and send them to your\nMirrors backend** — batched in the background, non-blocking, and safe (it never\npanics into your app after `Init`). It does **not** instrument SDKs and does\n**not** run agents; you build the trace, it ships it.\n\n## Install\n\n```bash\ngo get github.com/ai-singhal/mirrorkit-go\n```\n\nRequires **Go ≥ 1.21**. Zero dependencies (standard library only).\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"time\"\n\n\tmirrorkit \"github.com/ai-singhal/mirrorkit-go\"\n)\n\nfunc main() {\n\tmirrorkit.Init(mirrorkit.Options{APIKey: \"mk_live_...\", Project: \"my-agent\"})\n\tdefer mirrorkit.Shutdown(5 * time.Second)\n\n\tmirrorkit.LogTrace([]mirrorkit.Message{\n\t\tmirrorkit.SystemMessage(\"You are a helpful assistant.\"),\n\t\tmirrorkit.UserMessage(\"What's the weather in Paris?\"),\n\t\tmirrorkit.AssistantMessage(\"It's 18C and sunny.\"),\n\t}, mirrorkit.WithModel(\"claude-opus-4-8\"))\n}\n```\n\nEach trace is enqueued and flushed to `{endpoint}/api/collect` by a background\ngoroutine (`Authorization: Bearer <apiKey>`, body `{project, traces}`).\n\n### Tool calls\n\nBuild tool-call and tool-result messages with the helpers:\n\n```go\nmirrorkit.LogTrace([]mirrorkit.Message{\n\tmirrorkit.UserMessage(\"Cancel booking BK-4471.\"),\n\tmirrorkit.AssistantToolCalls(\n\t\tmirrorkit.NewToolCall(\"call_1\", \"cancel_booking\", map[string]any{\"id\": \"BK-4471\"}),\n\t),\n\tmirrorkit.ToolResult(\"call_1\", `{\"status\":\"cancelled\"}`),\n\tmirrorkit.AssistantMessage(\"Done — BK-4471 is cancelled.\"),\n})\n```\n\n## Options\n\n```go\nmirrorkit.Init(mirrorkit.Options{\n\tAPIKey:        \"mk_live_...\",           // required\n\tProject:       \"my-agent\",              // default \"default\"\n\tEndpoint:      \"https://api.mirror.dev\", // else MIRRORKIT_ENDPOINT / MIRROR_ENDPOINT / prod\n\tFlushInterval: 2 * time.Second,         // ms between background flushes\n\tMaxBatch:      50,                      // max traces per POST\n\tMaxQueue:      10_000,                  // in-memory cap; oldest dropped past this\n\tDebug:         false,                   // internal debug logs (or MIRRORKIT_DEBUG=1)\n})\n```\n\nEndpoint resolution: `Options.Endpoint` → `MIRRORKIT_ENDPOINT` → `MIRROR_ENDPOINT`\n→ the production default.\n\n## Lifecycle\n\n```go\nmirrorkit.Flush(5 * time.Second)     // block until the queue drains\nmirrorkit.Shutdown(5 * time.Second)  // stop the background goroutine (flushes first)\n```\n\nPrefer one collector per process via the package-level `Init` / `LogTrace` /\n`Flush` / `Shutdown`. For multiple independent collectors, use `NewClient` and\ncall `LogTrace` / `Flush` / `Shutdown` on the returned `*Client`.\n\n## Testing\n\n```bash\ncd mirrorkit-go && go vet ./... && go test ./...\n```\n"}