sdk

Build programmatic integrations with the Cursor SDK in TypeScript or Python.

Updated May 28, 2023
One-click install
npx skills add https://github.com/steveulrich/ProjectB --skill sdk-steveulrich
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sdk
Source: https://github.com/steveulrich/ProjectB/tree/main/.cursor/skills/sdk
Command: npx skills add https://github.com/steveulrich/ProjectB --skill sdk-steveulrich

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Running Cursor agents from scripts, CI pipelines, or backend services requires navigating runtime selection, streaming, error handling, and resource disposal, and mistakes in any of these cause silent failures or leaked processes. ## Core Features & Use Cases - Three Invocation Patterns: One-shot Agent.prompt for fire-and-forget scripts, Agent.create with send for streaming multi-turn conversations, and Agent.resume for continuing agents across process boundaries. - Failure-Mode Prevention: Distinguishes thrown CursorAgentError startup failures from mid-run errors, enforces disposal via await using or context managers, and requires explicit local or cloud runtime selection. - Use Case: A GitHub Action that sends a prompt to a cloud agent on every pull request, streams the output, opens a PR with autoCreatePR, and exits with distinct codes for startup versus run failures. ## Quick Start Use the Cursor SDK to write a TypeScript script that runs an agent locally against the current directory with a one-shot prompt.

Frequently Asked Questions about sdk

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run Cursor agents programmatically from a script?▼

Use the Cursor SDK's Agent.prompt for one-shot runs or Agent.create with agent.send for streaming and follow-ups. Both TypeScript (@cursor/sdk) and Python (cursor-sdk) variants follow the same Agent to Run model with local or cloud runtimes.

Should I use the TypeScript or Python Cursor SDK?▼

Choose based on your codebase: package.json and .ts files indicate TypeScript, while pyproject.toml and .py files indicate Python. Both SDKs share identical concepts, differing only in syntax conventions like camelCase versus snake_case.

What is the difference between local and cloud Cursor agents?▼

Local agents run on the caller's machine against a cwd, reusing its environment and credentials. Cloud agents run on a Cursor-hosted VM against a cloned repo, suited for long jobs and automatic PR creation with autoCreatePR.

Why does my Cursor SDK integration leak processes or memory?▼

Leaks happen when disposal is skipped. Use await using in TypeScript or with Agent.create(...) in Python so executors, run stores, and HTTP clients are released; Agent.prompt disposes automatically.

How do I handle errors from the Cursor SDK?▼

A thrown CursorAgentError means the run never started (auth, config, network), while result.status of error means it executed and failed. Use distinct exit codes for each and respect the isRetryable flag before retrying.

Does the Cursor SDK support MCP servers on resumed agents?▼

Inline MCP servers are not persisted across Agent.resume because they often carry secrets in memory. Pass the server configuration again on the resume call in either language to restore MCP tools.