A minimal local Cursor SDK example. It creates one agent, sends a hard-coded prompt, streams assistant text to stdout, and waits for the run to finish.
Use Node.js 22 or newer.
Install dependencies:
pnpm installSet a Cursor API key:
export CURSOR_API_KEY="crsr_..."Run the quickstart:
pnpm devBuild and run the compiled example:
pnpm build
pnpm startFor a more complete terminal app with arguments, cloud mode, model selection, and an interactive TUI, see Coding Agent CLI.