Skip to lesson
Exit
SDK quickstart in typescript and python1 / 2

2 min lesson

Watch one local TypeScript run

Create one local TypeScript agent, stream its run, inspect the result and dispose the agent.

Step 1 of 2

Use a throwaway checkout because Cursor's default local quickstart approves tool calls automatically and shows no human approval prompt. Export CURSOR_API_KEY, install @cursor/sdk and create the agent with the checkout's absolute cwd. Send one repository-summary prompt and stream the SDK messages. Require a finished result, log the request ID and inspect git diff. Use await using for automatic disposal, or Agent.prompt when the program needs one prompt and no follow-up conversation.

First local @cursor/sdk run

0:28 · narrated
Read this demo as text
  1. npm install at-cursor slash sdk, then one local Agent.create. The key stays in the environment — length only in the log. Agent.send streams status, a tool call, and a finished answer. Local is your process and files; the model is still hosted, and usage bills to whoever owns that key.
Install @cursor/sdk, read CURSOR_API_KEY, create a local agent with an explicit cwd, send one prompt, stream the run and dispose the agent.

Practice next: Repeat the run in a throwaway checkout. Confirm the request ID, final status, empty diff and agent cleanup.

Simulated Cursor 3.12 (macOS, light) — beta educational reconstruction, not the real product.