sdk

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

Updated Aug 6, 2026
One-click install
npx skills add https://github.com/ferrarifankid04/ai-skills-public --skill sdk-ferrarifankid04
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sdk
Source: https://github.com/ferrarifankid04/ai-skills-public/tree/main/cursor/skills-cursor/sdk
Command: npx skills add https://github.com/ferrarifankid04/ai-skills-public --skill sdk-ferrarifankid04

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Running Cursor agents from scripts, CI pipelines, or backend services requires navigating SDK choices, runtime selection, streaming, error handling, and resource cleanup, and small mistakes silently break integrations. ## Core Features & Use Cases - Three Invocation Patterns: One-shot Agent.prompt for fire-and-forget jobs, Agent.create with send for streaming multi-turn work, and Agent.resume for continuing agents across processes. - Trap Prevention: Covers the five most common failures including silent local-vs-cloud runtime mismatch, conflating startup errors with run failures, resource leaks from skipped disposal, and unsupported run operations. - Production Guidance: Exit-code conventions, retry semantics with isRetryable and retry_after, MCP server configuration, model selection, and auth setup for both SDKs. - Use Case: A GitHub Action that sends a prompt to a cloud Cursor agent on every pull request, streams the result, and exits with distinct codes for startup versus run failures. ## Quick Start Ask the assistant to write a TypeScript script using @cursor/sdk that runs a one-shot prompt against the current repository and prints the result.

Frequently Asked Questions about sdk

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

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

Use Agent.prompt for one-shot jobs or Agent.create followed by agent.send for streaming and multi-turn work. Both the TypeScript @cursor/sdk and Python cursor-sdk packages follow the same Agent to Run model and authenticate with CURSOR_API_KEY.

Should I use the TypeScript or Python Cursor SDK?

Match the SDK to your codebase: package.json and .ts files indicate TypeScript, while pyproject.toml and .py files indicate Python. Both SDKs share identical concepts and differ only in syntax, such as camelCase versus snake_case and async defaults.

What is the difference between local and cloud Cursor agents?

Local agents run on the caller's machine against a working directory and reuse its environment. Cloud agents run on a Cursor-hosted VM against a cloned repository and support autoCreatePR for opening pull requests.

Why did my Cursor SDK integration run locally instead of in the cloud?

The SDK silently defaults to the local runtime when neither local nor cloud options are set. Always pass cloud with repos or local with cwd explicitly to avoid getting an unintended local agent without any error.

How do I handle errors from the Cursor SDK?

A thrown CursorAgentError means the run never started, while result.status of error means it executed and failed. Use distinct exit codes for each, check isRetryable before retrying, and honor retry_after in Python.

Do MCP server configurations persist when resuming a Cursor agent?

No, inline MCP servers are not persisted across Agent.resume because they often carry secrets. Pass the server configurations again on the resume call in either language.