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.