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

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

Built distributions (wheels)

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

Total release size: 272.4 MB

Release files / cursor_sdk-1.5.2.tar.gz

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

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

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

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

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

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

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

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

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

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

Download URL cursor_sdk-1.5.2-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
5c238b269068e8abb395756906d83cf43c65d405b90ce0c4172c319e57ac6fd2
BLAKE2b-256 checksum
How to use checksums
3624c5507090d70037b8d2e24a6e401fd55da256e18e044d5d9085a70b1b628e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via package-proxy/0.1.0

Security for cursor-sdk 1.5.2

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