Cursor-go-sdk — Go client for @cursor/sdk (local + cloud agents)

Hi everyone,

I built cursor-go-sdk, a Go client that mirrors the TypeScript @cursor/sdk and Python cursor-sdk APIs.

Why: I wanted to run Cursor agents from Go services, CLIs, and CI without hand-rolling HTTP or maintaining a separate TypeScript sidecar for every project.

What it does:

  • Idiomatic Go API: CreateAgent, Prompt, Send, Stream / Messages, Wait, typed errors, etc.

  • Local agents via a small Node bridge over the official @cursor/sdk npm package (Go launches it automatically)

  • Cloud agents through the same interface

  • Cookbook-style examples: quickstart, coding-agent CLI, and a terminal UI

Not the same as REST-only Go wrappers for the Cloud Agents API — this targets the Agent SDK surface (Agent.create, agent.send, run.stream, …).

Quick start

go run github.com/remdev/cursor-go-sdk/cmd/setup@latest
go get github.com/remdev/cursor-go-sdk/[email protected]
export CURSOR_API_KEY="cursor_..."
agent, err := cursor.CreateAgent(ctx, cursor.AgentOptions{
    Model:  "composer-2.5",
    APIKey: os.Getenv("CURSOR_API_KEY"),
    Local:  &cursor.LocalAgentOptions{CWD: []string{"."}},
})
defer agent.Close(ctx)

run, err := agent.Send(ctx, "Summarize this repository", cursor.SendOptions{})
for msg, err := range run.Messages(ctx) {
    if msg.Type == "assistant" {
        fmt.Print(cursor.AssistantText(msg))
    }
}
result, err := run.Wait(ctx)

Repo: GitHub - remdev/cursor-go-sdk: Unofficial community Go SDK for Cursor agents. Not affiliated with Cursor or Anysphere. · GitHub (release v0.0.3, README has install, API map, and npm bridge setup)

Status

CI, unit tests, opt-in e2e against the real API, cookbook examples, and a fix for custom tool registration when CreateAgent returns agentId. Feedback, bug reports, and PRs welcome.

If you’re building in Go and want the same agent harness as the official SDK — would love to hear what works and what’s missing for your use case.

Community-maintained, not a Cursor product.

1 Like