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

Built distributions (wheels)

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

Total release size: 272.7 MB

Release files / cursor_sdk-1.4.2.tar.gz

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

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

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

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

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

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

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

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

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

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

Download URL cursor_sdk-1.4.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
6b76fcdbbb9fbec1871590f3eec56428c13389073e16339c714edec499dc8ab1
BLAKE2b-256 checksum
How to use checksums
17edef482d358b33161f0ea9a1f0a6f6c81abe64107ec182a0920894a47271fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via package-proxy/0.1.0

Security for cursor-sdk 1.4.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.4.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