Cursor SDK: runs fail mid-turn with [resource_exhausted]; which per-key limit is it?

Where does the bug appear (feature/product)?

Cursor SDK

Describe the Bug

Runs that have already done minutes of work fail with resource_exhausted, and the error doesn’t say which limit was hit:

  • Local SDK run, 2026-10-05: claude-opus-5-5 (effort=xhigh) started at 03:59:38 UTC and failed at 04:13:38 UTC with [resource_exhausted] Error. No other run from this machine was active. Request 455f7421-d101-4dff-9d66-91603763e30e.
  • Starting many agents at once, 2026-10-05, 10:51 to 10:52 UTC: several processes were starting agents on the same key, and in one of them Agent.create failed 21 times with RateLimitError: You have exceeded the rate limit of 30 requests per minute for the get_models endpoint. The SDK caches the model list per process, so this only bites with several processes, but they share the key’s limit.

Steps to Reproduce

  1. On one API key, run several long agentic tasks (10+ minutes each) on claude-opus-5-5 at once.
  2. Some fail mid-turn with resource_exhausted.
  3. Start more than 30 agents within a minute across several processes on the same key: Agent.create fails with the get_models limit.

Expected Behavior

  • The per-key or per-team limits (concurrent runs, tokens per minute, the models list) are documented. Cursor APIs Overview | Cursor Docs only gives a general 20 requests a minute.
  • When capacity runs out, a run is refused at the start with a retryable error and Retry-After, not ended after 14 minutes of work.
  • RunError.code says which limit was hit.

Operating System

Linux

Version Information

@cursor/sdk 1.0.31, bundled in T3 Code nightly 0.0.46-nightly.20261004.2648.

For AI issues: which model did you use?

claude-opus-5-5 (effort=xhigh)

For AI issues: add Request ID with privacy disabled

Privacy mode was on for these requests. Mid-run resource_exhausted: 455f7421-d101-4dff-9d66-91603763e30e. get_models limit: a0090e71-2701-4f04-8b32-6c73a03542ec, 1dca439b-ea57-4cf2-b44f-39d1818e300d, 87ec2e15-6cb5-4965-8ded-4f62e9537a56.

Additional Information

How to Scale Cursor API Usage? says limits are per API key and can be raised by contacting Cursor. We’d like to know which limit a mid-run resource_exhausted is before asking for more or capping our own concurrency.

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

Hey @nkoynov,

Mid-run [resource_exhausted] (Oct 5, 04:13 UTC): this wasn’t a limit on your key. Claude Opus 5.5 was temporarily at capacity, so there’s nothing to raise, and running fewer agents wouldn’t have helped. That cleared up by late Oct 6. Treat this error as retryable: wait a bit and resend the turn, or fall back to another model. You’re right that RunError.code should say this itself, and we’ve let the team know.

get_models 429s: this one is a real limit of 30 requests a minute, plus an hourly cap. It’s counted per user account (or per service account), not per API key. Local Agent.create fetches the model list once per process and working directory, and a 429 there fails the create. To stay under it:

  • Start agents from fewer long-lived processes, and reuse working directories where you can
  • Catch RateLimitError from Agent.create and retry after up to a minute

If you’re on a Teams or Enterprise plan and still need more headroom, an admin can email [email protected] about raising it.

Docs: fair point that the SDK limits aren’t listed on cursor.com/docs/api. We’ve passed that along.

Hey @nkoynov,

Quick update on the RunError.code part: a fix has landed so failed local runs keep their code (for example resource_exhausted) on wait(), Agent.getRun and Agent.listRuns, instead of leaving it only inside error.message. Runs already saved with the old [resource_exhausted] Error text will read back with the code too.

It isn’t in 1.0.40, so it’ll be included in an upcoming @cursor/sdk release after that. Once you’re on it, let me know if you still see error.code unset.

The get_models check on local Agent.create and the limits documentation are being tracked separately.