If you’re a developer who’s been playing with AI, you’ve probably had this thought: “This AI assistant is cool for one-off questions, but what if I could just… automate it? What if I could make it part of my actual workflow?”
You want an AI agent that doesn’t just sit in a chat window waiting for you. You want one you can call from a CI/CD pipeline to fix failing tests, or one that lives in your backend and automatically refactors old code. You want to build with it, not just talk to it.
Well, it looks like the team at Cursor has been thinking the same thing. They just released a public beta for their new TypeScript SDK, and honestly, it’s a bigger deal than it sounds. They’re basically taking the powerful AI engine that runs their own code editor and handing the keys over to us, the developers.
This isn't just another feature. It’s a fundamental shift in thinking. We're moving from AI as a "copilot" you chat with to AI as programmable infrastructure you can wire directly into your systems.
So, How Does It Work?
Let's get straight to the good part. Getting started is ridiculously simple. It’s a single line in your terminal:
npm install @cursor/sdk
From there, you can spin up a powerful coding agent with just a few lines of TypeScript. Seriously, this is the "hello world" example from their announcement, and it gets the point across perfectly:
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);
}
You create an agent, give it a task, and stream the results. That’s it. You can point it at a local directory, tell it which AI model to use, and you're off. Instead of you sitting at the keyboard inside the Cursor app, your code is now the one pulling the strings.
Why This Is a Bigger Deal Than You Think
Now, you might be thinking, "Okay, I could probably rig something like this up myself with an API." And you could try. But you’d quickly run into a whole world of pain.
Building a truly capable AI coding agent is so much more than just making an LLM call. You have to worry about:
- Secure Sandboxing: How do you let an AI execute code against your repository without, you know, accidentally deleting everything?
- Environment Setup: Getting all the right dependencies and tools installed so the agent can actually run the code it's working on.
- State Management: What happens if the connection drops? Does the agent lose all its work and have to start over?
- Context Management: How does the agent find the right files and functions to look at? An LLM with bad context is useless.
This is the hard, boring, and frankly, unglamorous work of building AI tools. And this is exactly what the Cursor SDK handles for you. They’ve already built the robust infrastructure—the "harness," as they call it—so you can skip the plumbing and get straight to building cool stuff.
The "Secret Sauce": It’s More Than Just a Model
When Cursor says their SDK gives you access to the "same runtime" as their own products, they mean you get the whole package. This "harness" is what makes their agents so effective.
Here’s a quick look at what’s under the hood:
- Smart Context: The agent doesn't just guess. It uses codebase indexing, semantic search, and even good old-fashioned grep to pull the most relevant code snippets into its context before it even starts thinking. This is crucial for getting accurate results.
- Hooks & Skills: You can define reusable behaviors in a
skillsdirectory and use ahooks.jsonfile to observe or even interrupt the agent's process. Think of it like adding middleware to a web server—perfect for logging, applying safety rails, or orchestrating custom steps. - Subagents: This is where it gets really interesting. Your main agent can delegate smaller, specific tasks to other agents. For example, one agent could be in charge of writing the code, while another specializes in writing documentation for it. This lets you build complex, multi-agent workflows without a ton of custom code.
You’re not just getting a brain; you’re getting the entire nervous system that makes the brain useful.
Run It on Your Machine, Their Cloud, or Your Own Servers
One of the most practical features here is the flexibility in where you run these agents.
For quick iteration and testing, you can run an agent locally on your own machine. But the real magic happens with their cloud execution.
When you run an agent in Cursor's cloud, it spins up a dedicated, sandboxed virtual machine just for your task. It clones your repo and sets up the entire environment. And here’s the killer feature: it keeps running even if you close your laptop.
Imagine this: you kick off a complex refactoring task from a script, head out for lunch, and when you get back, there’s a pull request waiting for you with the completed work. That’s the kind of asynchronous, unattended workflow this enables.
Here’s what that looks like in code:
const agent = await Agent.create({
apiKey: process.env.CURSOR_API_KEY!,
model: { id: "gpt-5.5" },
cloud: {
repos: [{ url: "https://github.com/cursor/cookbook", startingRef: "main" }],
autoCreatePR: true,
},
});
const run = await agent.send("Fix the auth token expiry bug");
console.log(`Started run: ${run.id}`);
// ...go do something else...
// Check in on it later from anywhere
const result = await (await Agent.getRun(run.id, { ... })).wait();
console.log(result.git?.branches[0]?.prUrl);
You can start a job programmatically and then check on its progress later, or even pop into the Cursor web app to see what it's doing in real time. And for companies with strict security needs, they also offer a self-hosted option, so all your code and execution stays within your own network.
You're Not Locked into One Brain
The SDK lets you use any model that Cursor supports. Switching from GPT-4 to Claude 3 Opus is as simple as changing a single line in your configuration. This is great because it lets you pick the right tool for the job—maybe a cheaper, faster model for simple tasks and a more powerful one for complex reasoning.
They also position their own model, Composer 2, as the default recommendation. They claim it hits top-tier performance on coding tasks but at a much lower cost than the big general-purpose models. Having that option built-in is a nice touch.
Okay, I’m In. How Do I Start?
The best way to get your hands dirty is to check out the public cookbook repository on GitHub. The Cursor team has put together a few starter projects that do a great job of showing what’s possible, including:
- A simple Node.js quickstart.
- A web-based tool for scaffolding new projects in the cloud.
- An agent-powered Kanban board that automatically opens PRs when you drag a task card.
- A lightweight CLI for running Cursor agents from your terminal.
They've also released a Cursor SDK plugin on their marketplace to help you get started building right from the editor.
This feels like a genuine step forward. By opening up their core technology, Cursor is giving the developer community a powerful set of building blocks. I’m really excited to see what people build with this—from weekend passion projects to serious, business-critical automations.
If you want to dive deeper, you can check out their blog post with all the technical details. And if you end up building something cool, you should definitely share it with the community.




