Python client for the Cursor SDK bridge.
Actively maintained. Last release 4 days ago. A safe choice.
pip install cursor-sdkcursor-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)