Skip to main content

On This Page

Cursor Releases TypeScript SDK for Programmatic AI Coding Agents

3 min read
Share

These articles are AI-generated summaries. Please check the original sources for full details.

Cursor Introduces a TypeScript SDK for Building Programmatic Coding Agents With Sandboxed Cloud VMs, Subagents, Hooks, and Token-Based Pricing

Cursor has launched the public beta of its TypeScript SDK, providing programmatic access to the same runtime and models used in its desktop IDE. The SDK allows developers to invoke coding agents via a single command: npm install @cursor/sdk.

Why This Matters

Building reliable coding agents usually requires significant engineering for secure sandboxing and state management, often forcing teams to rework loops when new models emerge. This SDK shifts AI tools from interactive assistants to deployable infrastructure, allowing organizations to embed agentic capabilities directly into CI/CD pipelines and backend services without managing the underlying context retrieval or VM isolation.

Key Insights

  • The SDK provides access to the ‘Composer-2’ model, a specialized coding model optimized for frontier-level performance at a fraction of the cost of general-purpose models.
  • Agents utilize the Model Context Protocol (MCP) to connect to external tools and data sources via stdio or HTTP for extended functionality.
  • Cloud execution provides dedicated, sandboxed VMs that maintain persistent states, allowing developers to reconnect to long-running tasks even if the local machine goes offline.
  • Intelligent context management features like codebase indexing, semantic search, and instant grep are built-in to reduce LLM hallucinations during code generation.

Working Examples

Minimal example of initializing a local agent and streaming a repository summary.

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);
}

Cloud-based agent configuration for automated bug fixing and pull request creation.

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.id}`);
const result = await (
await Agent.getRun(run.id, { runtime: "cloud", agentId: run.agentId })
).wait();
console.log(result.git?.branches[0]?.prUrl);

Practical Applications

  • CI/CD Pipeline Integration: Triggering an agent to automatically fix identified bugs and open a PR when a build fails. Pitfall: Inadequate context indexing leading to hallucinated dependencies or irrelevant code changes.
  • Agentic Kanban Boards: Automated code scaffolding where dragging a task card triggers a cloud agent to generate a branch and initial implementation. Pitfall: Lack of secure sandboxing in self-hosted environments exposing internal networks to unverified agent actions.

References:

Continue reading

Next article

Best of WACV 2026: Advances in Zero-Shot Sampling and OOD Detection

Related Content