Cursor SDK
Cursor has now has SDK which you can wire it up with your apps to build agentic flows easily.
Under the hood it uses same agentic harness that powers the Cursor IDE
How to get started?
Just install the package
npm install @cursor/sdk
And then use it like this
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(JSON.stringify(event, null, 4));
}
Make sure to set the CURSOR_API_KEY env variable as well.
They’ve published cookbooks as well which you can use as reference as well.