Introducing the Cursor Python SDK

Introducing the Cursor Python SDK

Docs


We’re excited to introduce the Cursor Python SDK, now in public beta!

With the Cursor SDK, you can build your own agents powered by Composer 2.5 — the same agent that runs in the Cursor IDE, CLI, and web app, now scriptable from your own code. The SDK is available in both Python and TypeScript, so you can wire Cursor agents into scripts, CI pipelines, backend services, bots, and any other code outside the IDE.

Here’s a sample of what you can do with the SDK:

  • Run agents locally or in the cloud: One interface, two runtimes. Run against local files for dev scripts and CI, or kick off Cursor-hosted cloud agents with your repo cloned in.
  • Build with Composer 2.5: Go wild with 90% off Composer in the SDK this long weekend only!
  • Sync and async clients: Mirrored surface for both, with typed dataclasses, streaming events, and ordinary iteration for runs and pages.
  • MCP servers, subagents, and hooks: Pass MCP servers inline, define subagents in code, and pick up project/user hooks from .cursor/.

Long weekend promo: 90% off Composer in the SDK :tada:

For the long weekend (Memorial Day in the United States), all Composer usage through the SDK is 90% off. Perfect time to experiment, and ship something fun! We can’t wait to see what you build.

Get started (note, the sdk requires Python 3.10+)

uv pip install cursor-sdk
from cursor_sdk import Agent, LocalAgentOptions

with Agent.create(
    model="composer-2.5",
    local=LocalAgentOptions(cwd="."),
) as agent:
    print(agent.send("Summarize what this repository does").text())

You can also get started super easily by running/sdk inside Cursor for a guided setup. You’ll need a Cursor API Key, which you can generate from the Integrations page in Cursor Dashboard.

We’d love your feedback! Let us know what are you building with the Python SDK this long weekend .

If you’ve found a bug, please post it in Bug Reports instead, so we can track and address it properly, but also feel free to drop a link to it in this thread for visibility!

1 Like