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.0

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.0
File Size Uploaded Provenance Actions
cursor_sdk-1.5.0.tar.gz 1.3 kB Without provenance Details for cursor_sdk-1.5.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for cursor-sdk 1.5.0
File Actions
cursor_sdk-1.5.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for cursor_sdk-1.5.0-py3-none-win_amd64.whl
cursor_sdk-1.5.0-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.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
cursor_sdk-1.5.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for cursor_sdk-1.5.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
cursor_sdk-1.5.0-py3-none-macosx_11_0_x86_64.whl Python 3 none macOS 11.0+ x86-64 Details for cursor_sdk-1.5.0-py3-none-macosx_11_0_x86_64.whl
cursor_sdk-1.5.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for cursor_sdk-1.5.0-py3-none-macosx_11_0_arm64.whl

Total release size: 273.9 MB

Release files / cursor_sdk-1.5.0.tar.gz

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

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

Download URL cursor_sdk-1.5.0-py3-none-win_amd64.whl
Size 48.3 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
21dcac30d186e77bda5d6f9be0402a9edc9caeb50c17a6e4d3d1782f55fa1b2e
BLAKE2b-256 checksum
How to use checksums
ae04e46d28a1cd7944fbc26337895ee95612d4beec94ff7e7210df97f0f7ad96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via package-proxy/0.1.0

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

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

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

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

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

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

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

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

Security for cursor-sdk 1.5.0

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.0 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