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

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

Built distributions (wheels)

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

Total release size: 273.7 MB

Release files / cursor_sdk-1.5.1.tar.gz

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

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

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

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

Download URL cursor_sdk-1.5.1-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
4bd2d1c9786e73a8673217f418fe5624817bf8b51ca0625611eb700046a12498
BLAKE2b-256 checksum
How to use checksums
e7d643754e6f92eda397c1365234347535de3236eddbea5ba34533de3263f034
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via package-proxy/0.1.0

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

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

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

Download URL cursor_sdk-1.5.1-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
1023e725a60bf5b3c95e955cf0427b734c9d2e7b0fdea08b11e1692f80f93cdd
BLAKE2b-256 checksum
How to use checksums
2f97e8f00899543d3eebcf094e53f40a8ff4ec68cfd4b1c732110a5ed39271fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via package-proxy/0.1.0

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

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

Security for cursor-sdk 1.5.1

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