Skip to main content

cursor-sdk

Python SDK for Cursor agents — script the same agent that runs in the Cursor IDE, CLI, and web app, with sync and async clients.

Docs and quickstart: https://cursor.com/docs/sdk/python

Shared SDK version

Starting with 1.0.24, the Python package and @cursor/sdk use the same version and are built from the same commit. Python therefore jumps directly from 0.1.9 to 1.0.24; there are no missing Python releases in between. The alignment does not change the Python SDK's public-beta status.

Install

pip install cursor-sdk

Requires Python 3.10+. Wheels are published for macOS (arm64, x64), Linux (arm64, x64), and Windows (x64).

Notices and bridge diagnostics

The SDK runs a local bridge process. Lines the bridge addresses to you start with [cursor-sdk]. They are written to your process's stderr, each distinct line once. Everything else the bridge writes to its stderr goes to the cursor_sdk.bridge logger at DEBUG; set CURSOR_SDK_LOG=debug to see it.

No-repo cloud agents

Cloud agents can run on an empty VM with no repository. Pass cloud and leave repos unset:

agent = client.agents.create(cloud=CloudAgentOptions(repos=[]))

No-repo agents must be enabled for your account or team, and repository-scoped API keys cannot create them. See examples/no_repo_cloud_agent.py.

For cloud agents, agent.get_usage() returns billed token usage and dollar cost per run. Cost is server-derived from Cursor's billing pipeline (discounts included, never estimated client-side) and eventually consistent shortly after a run ends. Local agents are not supported yet.

For local agents, agent.summarize() condenses the conversation now instead of waiting for the context limit, the same action as the CLI's /summarize. It returns a Run like send(): run.wait().result holds the summary text, and the stream yields SDKSummaryMessage updates. It raises ConfigurationError on cloud agents, and BadRequestError before the agent's first send has saved a conversation.

run = agent.summarize()
print(run.wait().result)

Steer a running run

send() raises AgentBusyError while an agent has an active run. run.steer(text) sends the text into that run instead, on local and cloud runs, sync and async:

from cursor_sdk import SteerQueued

outcome = run.steer("Also cover the error path")
if outcome == "complete_delivered":
    pass  # The run has the text.
elif outcome == "revert_to_followup":
    pass  # Nothing took the text. Send it as a follow-up.
elif isinstance(outcome, SteerQueued):
    # The text is already queued. Do not send it again.
    if outcome.run is not None:
        outcome.run.wait()

When a cloud run is no longer active, the server queues the text as the follow-up that starts the next run, and outcome.run is that run. A server that does not name the run returns SteerQueued(run=None); the text is still queued. A resend sends the text twice, or raises AgentBusyError while the queued run is active. A steer is never retried. It raises NetworkError when the request fails or the bridge answers 5xx, APITimeoutError on a timeout, RateLimitError on a rate limit, BadRequestError when the agent cannot take it (for example an archived agent), and FeatureUnavailableError when the account has no steering. After any of these except RateLimitError the outcome is unknown, so the error is not retryable (is_retryable is False): check the run's or agent's state instead of resending. A RateLimitError means the steer was not delivered; it is safe to send again later.

Local agents on networks that block HTTP/2

Local agent streams use HTTP/2. When a proxy or firewall blocks that protocol, a run reaches RUNNING and then ends with Protocol error. Catalog calls such as Cursor.models.list() still succeed, and the Cursor app on the same machine keeps working.

Switch local agent streams to HTTP/1.1 before the SDK launches its bridge, which is before Client.launch_bridge(), AsyncClient.launch_bridge(), or the first call that uses the default client:

from cursor_sdk import Client, Cursor

Cursor.configure(local={"use_http1_for_agent": True})

with Client.launch_bridge() as client:
    ...

AsyncCursor.configure takes the same argument. Set CURSOR_SDK_USE_HTTP1_FOR_AGENT=1 before the process starts when the call site cannot change. A bridge reads the setting once, when it starts, so configure raises ConfigurationError while a bridge the SDK launched is still running. Close that client, or call close_default_client() for the default one, then configure again.

Public beta. APIs may change before general availability.

Metadata

Release files for cursor-sdk 1.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cursor-sdk 1.5.3
File Size Uploaded Provenance Actions
cursor_sdk-1.5.3.tar.gz 1.3 kB Without provenance Details for cursor_sdk-1.5.3.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for cursor-sdk 1.5.3
File Actions
cursor_sdk-1.5.3-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for cursor_sdk-1.5.3-py3-none-win_amd64.whl
cursor_sdk-1.5.3-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for cursor_sdk-1.5.3-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
cursor_sdk-1.5.3-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for cursor_sdk-1.5.3-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
cursor_sdk-1.5.3-py3-none-macosx_11_0_x86_64.whl Python 3 none macOS 11.0+ x86-64 Details for cursor_sdk-1.5.3-py3-none-macosx_11_0_x86_64.whl
cursor_sdk-1.5.3-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for cursor_sdk-1.5.3-py3-none-macosx_11_0_arm64.whl

Total release size: 272.6 MB

Release files / cursor_sdk-1.5.3.tar.gz

Download URL cursor_sdk-1.5.3.tar.gz
Size 1.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4f3d5629501e0cf21ab6fda510d3aba0b42d9650bd8eb0bf97ee313109fa8929
BLAKE2b-256 checksum
How to use checksums
065ba5dd37c387252e5b5c65b08dd0092e4a4611f203d7208d9888ba315fe7e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via package-proxy/0.1.0

Release files / cursor_sdk-1.5.3-py3-none-win_amd64.whl

Download URL cursor_sdk-1.5.3-py3-none-win_amd64.whl
Size 48.0 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
1543a6be5036d8586233fc4dc622d16aa5ce37cef00036d6acae10c7ef8ba850
BLAKE2b-256 checksum
How to use checksums
8486b8e528133d23fa4b2e6865f90a499064a4f946b38ffbbc8f6adb1d1bc27b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via package-proxy/0.1.0

Release files / cursor_sdk-1.5.3-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL cursor_sdk-1.5.3-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 59.8 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
66de6243ed4f32daebf46b7afb756d2ce91c29bb17a7f3c7aea72671dbe15898
BLAKE2b-256 checksum
How to use checksums
bedb6571571d4d7a128584482e644ea2f040df236495b68e74c9191db6b90d5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via package-proxy/0.1.0

Release files / cursor_sdk-1.5.3-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL cursor_sdk-1.5.3-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 59.0 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
e2c62e40abb03db8af7ec8dbdac342a87875f804268726b876df8d780295fcf7
BLAKE2b-256 checksum
How to use checksums
c2ea51c8b1d0d64e42dc9122a1560ad04a58d2f5d38fed972ef8ff2fe0278668
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via package-proxy/0.1.0

Release files / cursor_sdk-1.5.3-py3-none-macosx_11_0_x86_64.whl

Download URL cursor_sdk-1.5.3-py3-none-macosx_11_0_x86_64.whl
Size 53.7 MB
Tags Python 3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
8a1afb33dd6596e76550a6f648cd43321bea0988e3968e5f77b48e7b1c9988ed
BLAKE2b-256 checksum
How to use checksums
8b9e1c2fbc6dcfde233806a44c2ea6a2dfc1df29bca299de97584650516ef463
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via package-proxy/0.1.0

Release files / cursor_sdk-1.5.3-py3-none-macosx_11_0_arm64.whl

Download URL cursor_sdk-1.5.3-py3-none-macosx_11_0_arm64.whl
Size 52.1 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ba6b2a9dd1f24a93591d7fcec1d65060e73ed9597c0cbf03bdeed5c41be0b3ac
BLAKE2b-256 checksum
How to use checksums
ea7fb998f515a5a77aacf993f25e1b94b88bbc1844bd37ee96ebffbdce868f1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via package-proxy/0.1.0

Security for cursor-sdk 1.5.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.5.3 This release

6 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page