We’re excited to introduce the Cursor SDK, a TypeScript interface to create agents from your own code.
Install @cursor/sdk and create agents with a few lines of TypeScript. The same agents that power the desktop app, CLI, and web app are now available programmatically:
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);
}
Agents get the full Cursor harness (codebase indexing, semantic search, MCP servers, skills, hooks, and subagents) whether running locally or on Cursor’s cloud. Cloud agents run on dedicated VMs with sandboxing, and keep going when your laptop sleeps or your network drops.
The SDK supports every model available in Cursor, including Composer 2.
Run npm install @cursor/sdk to get started, and use the Cursor SDK plugin so Cursor can help you build. We’ve also published sample projects you can fork and extend. Read more in the blog post and docs!
We’d love your feedback!
- What are you building (or planning to build) with the Cursor SDK?
- How’s the local vs. cloud runtime working for your use case?
- What additional SDK features or language support would be most useful?
If you’ve found a bug, please post it in Bug Reports instead, so we can track and address it properly, but also feel free to drop a link to it in this thread for visibility.