In short.
Cursor Python SDK is a Python library for developers building coding automations, but choosing local or cloud execution changes the controls and integrations available. Its documented interface supports persistent agent conversations, streamed output, repository work and usage reporting. It requires Python 3.10 or newer and an accepted Cursor API key. Exact prices, package licensing, task accuracy and runtime reliability are not established by this page. No installation or example was executed.
Researched and written by an AI model and checked by a second AI model. How it works
Covers the complete documentation page at [https://cursor.com/docs/sdk/python.md] captured on 15 November 2026, including its runtime restrictions, account-gating notices, billing distinctions and configuration caveats. Linked pages, package source code and installed binaries are excluded. Installation, examples, local and cloud behavior, billing, security properties and output quality were not tested.
The overview
Identity
The cursor-sdk package, imported as cursor_sdk, exposes Cursor's coding agent to Python programs. Cursor describes it as the same agent used in its IDE, CLI and web app. The reference covers installation, configuration, authentication, synchronous and asynchronous interfaces, local execution and cloud execution [https://cursor.com/docs/sdk/python.md].
This is an agent interface: runs can inspect workspaces, call tools, execute commands and edit files. The page explicitly distinguishes it from a standalone model-inference or chat-completions API.
Assessment
The documented design suits applications that need to initiate and observe coding work from Python, such as repository helpers, CI-related checks, bots and agent orchestration. Typed dataclasses, streaming and explicit lifecycle management provide integration points beyond receiving a final text response.
The central tradeoff is execution location. Local agents operate on files already on disk. Default cloud agents run in Cursor-hosted isolated VMs with cloned repositories and can continue after the caller disconnects. The shared interface reduces integration differences, but it does not provide identical features across runtimes. Successful task completion, latency and reliability are not demonstrated.
Users
The clearest audience is Python developers embedding agent work into existing scripts or services. Teams managing multiple workspaces, background coding tasks or concurrent agents may benefit from explicit clients and the asynchronous interface.
Beginners need enough Python knowledge to handle credentials, working directories, context managers and returned run objects. Server developers also need to manage event loops and asynchronous cleanup. The page recommends asynchronous clients for servers, bots and concurrent orchestration.
Capabilities
Programs can create and resume agents, retain conversation context across prompts, send text and images, stream assistant output and tool events, inspect structured conversations, cancel active runs and read terminal status. Account-level APIs discover available models and connected repositories.
Cloud options include repository selection, automatic pull-request creation, session and run-scoped environment variables, metadata, downloadable artifacts and archive or delete operations. Local agents support Python custom tools, built-in tool restrictions and configurable settings sources.
MCP connects agents to external tools and services. Named subagents and file-based hooks support more specialized behavior. Cursor Router can select models using Cost, Balance or Intelligence modes on eligible Teams and Enterprise accounts; actual availability depends on the account and team configuration.
Using it
Requirements
The package requires Python 3.10 or later. Authentication uses CURSOR_API_KEY or an explicit api_key. User keys and service-account keys are accepted for local and cloud runs; Team Admin API keys are not yet supported. The package includes a cursor-sdk-bridge executable for the client connection.
Repository-backed cloud runs need access through a connected source-control integration. Empty-workspace cloud agents require account or team enablement and cannot be created with repository-scoped API keys. Models and parameters are account-specific; local agents require an explicit model, while cloud agents can use a server-resolved default.
Asynchronous operations require an explicit AsyncClient owned by the relevant event loop. The page instructs users to keep synchronous and asynchronous clients out of the same code path. Supported operating systems, hardware requirements and the minimum plan for basic SDK access are not specified.
Mechanism
An Agent is a durable conversation and configuration handle. Each send creates a Run for one prompt submission, with its own stream, status, result and cancellation. CursorClient manages connections and resource namespaces; the asynchronous classes mirror this structure.
Local conversation state and run metadata persist through the bridge in a workspace-scoped store. Cloud state persists server-side. Agent.resume() reconnects by identifier, but local lookup requires the correct workspace context. Inline MCP definitions must be supplied again after resume.
A run's messages(), events() and iter_text() consume the same underlying stream. Consuming it through one interface advances it for the others. wait() drains remaining events and returns a terminal result; terminal state remains available on the run handle.
Setup
The documented installation command is pip install cursor-sdk. Configure an accepted API key, inspect available models with Cursor.models.list(), then create an agent with LocalAgentOptions for a working directory or CloudAgentOptions for cloud execution. An empty cloud workspace still requires an explicit cloud configuration.
Context managers provide automatic agent and client cleanup. Explicit clients can launch a bridge or connect to an existing endpoint, and support custom HTTP clients, timeouts and retries. Local project, user and plugin MCP settings require the relevant setting_sources; without that option, local MCP loading uses only inline definitions.
Example
A documented local starting point creates an Agent for the current working directory, sends the prompt 'Summarize what this repository does', and calls text() on the returned Run. An integration can replace the example model with an available model discovered from its account's catalog.
The cloud example selects a repository and starting branch, requests structured logging changes and enables auto_create_pr. That option requests a pull request when the run finishes. These examples illustrate the API flow; no execution output, verified code change or successful pull request is established.
Assessment & evidence
Limitations
Custom Python tools, built-in tool allowlists and denylists, and background subagents are local-only features. Tool restrictions must be reapplied after resume. Built-in tool restrictions on the parent agent do not apply to subagents, which keep their own curated toolsets; to prevent subagents entirely, disallow the task tool or leave it out of a tools allowlist. Local artifact listing returns an empty list and local downloads are unsupported.
Tool-call names and argument or result payloads can change, so parsers need defensive handling. Custom-tool output schemas are advertised but results are not validated against them. Hooks require configuration files and scripts; programmatic hook callbacks are unavailable.
Cloud agents permit only one active run per agent. AgentBusyError is not immediately retryable; the active run must finish or be cancelled. Cancelling a terminal run raises an error. Per-run cloud environment variables are unavailable for public-repository agents. Cloud settings loading also differs from local settings: cloud always loads project, team and plugin layers.
Reasoning
The SDK's practical value follows from combining agent state, workspace operations and programmatic observation. This makes it a plausible fit when an application needs a coding agent to perform several connected steps and retain context between prompts.
Runtime selection remains an architectural choice because controls and integrations differ. A finished status establishes run termination, while task correctness still needs separate validation. For reproducible model comparisons, the documentation favors fixed model identifiers because Router can change the underlying model between requests. No accuracy or performance advantage is established.
Alternatives
The page points to the Cloud Agents API for REST access [https://cursor.com/docs/cloud-agent/api/endpoints.md] and SDK Bridge documentation for other languages [https://cursor.com/docs/sdk/bridge.md]. Their contents and comparative capabilities are outside this page's evidence.
Cursor's IDE, CLI and web app are described as using the same agent and may suit work initiated interactively. The Python SDK is most relevant when another program needs to control agent work. This source provides no comparative prices, benchmarks or feature evaluation of competing SDKs.
Evidence
Cursor's Python SDK documentation is the sole source [https://cursor.com/docs/sdk/python.md]. It supplies installation instructions, example code, API signatures, configuration tables, error behavior and runtime limitations.
These support an account of documented functionality. Package implementation, installation success, authentication, local and cloud execution, billing accuracy, security properties and generated-code quality were not tested. No measured benchmark or independently verified task result is available.
Access & freshness
Costs
The page says SDK runs follow the same pricing and request pools as IDE and Cloud Agent runs, with spending tagged SDK in the team's usage dashboard. It supplies no unit prices, subscription amounts or representative task costs. Exact cost is unknown. Router requests bill at the list price of the model selected for each request.
Live run.usage and result.usage provide runtime token counts when available, rather than dollar cost. agent.get_usage() returns billed usage and potentially settled charges. Local billed-usage access is account-gated; cost can remain unavailable while billing settles. Cloud totals can include subagent and side-chat usage beyond the listed primary runs.
The page defines total_tokens differently across these views: live TokenUsage totals input and output, with cache tokens already included in input; billed get_usage() totals also add separately reported cache reads and writes. Integrations should preserve that distinction. A zero charged amount can reflect plan-included, BYOK or credit-grant usage.
Rights
The page does not provide a package licence, documentation-redistribution permission or terms assigning ownership of generated code. Commercial-use and redistribution rights remain unknown from this source.
Cursor states that SDK runs follow its existing Privacy Mode rules, but those rules are not explained here. The page describes encryption and lifecycle cleanup for cloud environment variables, plus redaction of sensitive HTTP MCP fields before they enter the VM. Broader data retention, training use and processing terms are not established. Local execution describes where workspace operations happen; offline inference is not established.
Freshness
The documentation was captured on 15 November 2026. No SDK package version, release date or page-update date is supplied.
Several capabilities depend on changing account settings or rollouts, including local billed-usage access, cloud metadata, empty-workspace agents and Router availability. Model discovery reflects the API key's current account and team; example model names do not establish access for another account.
Actions
Before integrating, choose the runtime from the features required, confirm the API-key type and repository access, and discover available models and parameters. Confirm applicable pricing and data-use terms because this page does not establish exact costs or complete privacy arrangements.
For an initial evaluation, use a small repository-summary task and inspect the final status, output and usage. A local agent can use a read-oriented built-in tool allowlist such as read, grep, glob and ls, which leaves out the task tool and so also prevents subagents. If you use disallowed_tools instead, add task to it as well, because subagents otherwise keep their own toolsets. For editing workflows, validate the resulting changes separately. Preserve workspace context when resuming local agents, reapply non-persistent configuration and close agents and clients when finished.
