· Changelog

Build programmatic agents with the Cursor SDK

We're introducing the Cursor SDK so you can build agents with the same runtime, harness, and models that power Cursor.

The agents that run in the Cursor desktop app, CLI, and web app are now accessible with a few lines of TypeScript. Run it on your machine or on Cursor's cloud against a dedicated VM, with any frontier model.

Run npm install @cursor/sdk to get started and use the Cursor SDK plugin so Cursor can help you build.

import { Agent } from "@cursor/sdk";

const agent = await Agent.create({
  apiKey: process.env.CURSOR_API_KEY!,
  model: { id: "composer-2" },
  local: { cwd: process.cwd() },
});

const run = await agent.send("Summarize what this repository does");

for await (const event of run.stream()) {
  console.log(event);
}

We built a few sample projects that you can access from a public repo. Fork and extend them for your own use case.

The Cursor SDK is now available for all users in public beta and is billed based on standard, token-based consumption pricing. Learn more in our announcement and docs.

  • Reworked the API around durable agents and per-prompt runs, so follow-ups, status, streaming, and cancellation are now run-scoped.
  • Added first-class run streaming with SSE events, reconnect support via Last-Event-ID, and clearer terminal states.
  • Added explicit agent lifecycle controls with archive, unarchive, and permanent delete.
  • Standardized v1 response and error shapes, including structured error codes, items list responses, and separate agent / run objects.