What problem does it solve? Running Cursor agents from scripts, CI pipelines, or backend services requires navigating two SDK variants, runtime selection, streaming, disposal, and error semantics that are easy to get wrong. This Skill provides the decision rules, invocation patterns, and failure-mode prevention needed to ship a working integration without trial and error. ## Core Features & Use Cases - Three Invocation Patterns: One-shot Agent.prompt for fire-and-forget jobs, Agent.create plus send for streaming multi-turn sessions, and Agent.resume for continuing agents across process boundaries. - Trap Prevention: Covers the five most common failures including silent local-runtime fallback, conflating startup errors with run failures, resource leaks from skipped disposal, missing wait() calls, and unsupported run operations. - Production Guidance: Exit-code conventions, retry handling with isRetryable and retry_after, explicit API key passing, MCP server configuration, and local versus cloud runtime selection. - Use Case: A GitHub Action that sends a prompt to a cloud Cursor agent on every pull request, streams the result, auto-creates a PR, and exits with distinct codes for startup versus run failures. ## Quick Start Ask the assistant to write a TypeScript script using the Cursor SDK that runs an agent locally against the current repo and prints the streamed result.