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.