Where does the bug appear (feature/product)?
Cursor SDK
Describe the Bug
Using @cursor/sdk (^1.0.28), Agent.create() succeeds and agent.send(prompt) returns a run in running state, but the run transitions to error within a few seconds with no assistant output. run.wait() often returns error with error.code: “stream_unavailable” and error.message: “Run stream is no longer available”. durationMs is sometimes null. Shortly after, the same agentId is not found (agent appears removed).
This reproduces for repo-only cloud config and for named cloud environments; it is not caused by sending env.name and repos together (we only send one mode).
Environment
SDK: @cursor/sdk ^1.0.28 (Node, ESM, tsx)
Model: { id: “composer-2.5” }
Client: Internal workflow orchestrator (Agent.create → agent.send → run.stream() + run.wait())
OS: macOS (orchestrator local); agents run on Cursor cloud
Auth: Team API key (CURSOR_API_KEY)
Steps to Reproduce
Create an isolated cloud agent:
await using agent = await Agent.create({
apiKey,
model: { id: “composer-2.5” },
name: “workflow-AE-50228”,
cloud: {
skipReviewerRequest: true,
envVars: { /* team personal keys, no secrets in ticket / },
repos: [{
url: “https://gitlab.com/agora.re/app/agora-api-monorepo”,
startingRef: “development”,
}],
// OR named env only (no repos):
// env: { type: “cloud”, name: “ilan” },
},
});
Send first-turn prompt (~4.5k chars — ticket bootstrap / skills; not unusually large).
const run = await agent.send(prompt);
// run.status === “running”
Consume stream and wait:
for await (const event of run.stream()) { / assistant text */ }
const result = await run.wait();
// result.status === “error”
Optionally resume/fetch the same agent.agentId — often 404 / not found.
Variant B — named environment only
cloud: {
env: { type: “cloud”, name: “ilan” }, // multi-repo env configured in Cursor dashboard
repos: undefined,
}
Same failure pattern.
Expected Behavior
Run completes (finished) or fails with a actionable API error (auth, repo access, env misconfiguration, prompt rejection, etc.).
Stream stays available until terminal run state, or wait() returns a stable error payload.
Agent remains resumable on Agent.resume(agentId) after a failed run unless explicitly deleted.
Actual behavior
Run goes running → error in ~1–10s.
Zero streamed assistant tokens; result.result empty.
run.wait() error (when present):
{
“message”: “Run stream is no longer available”,
“code”: “stream_unavailable”
}
durationMs sometimes null.
After failure, health check / Agent.resume often indicates agent missing (probe=missing in our logs).
Evidence (recent repro — repo-only)
Field Value
Ticket / metadata
AE-50228
agentId
bc-dbaaba57-e59b-4dcb-bc75-a61ef2aadcea
runId
run-dd4e3bb8-de6a-4e32-94ed-6a621f422cb0
Cloud payload
Repo-only: agora-api-monorepo @ development, no env.name
Prompt size
4504 chars (first turn)
Diagnostics
resultChars: 0, streamedChars: 0, errorCode: “stream_unavailable”
Post-failure
Agent not found
Other run IDs (same symptom):
run-e1a2c4eb-99c4-4261-9814-4ec3ff13478b (named env ilan),
run-0c7aa663-4b6d-40e8-a284-f5418867a7d0,
run-f6f03d79-da07-4afa-bc85-d0610f5718ee.
Not observed: [validation_error] env.name cannot be combined with repos on send (we enforce env XOR repos client-side).
What we ruled out on the client
Local orchestrator crash (stderr clean; send succeeds).
Accidental env + repos in create payload (logged SDK shape is correct).
Missing CURSOR_API_KEY / personal env injection (create succeeds; envVarKeys present).
Questions for SDK / platform
Is stream_unavailable on run.wait().error intended to mean the run failed on the server, or only local stream teardown? Should callers treat it as retryable?
Why is the agent deleted or 404 after a failed first run?
Is there a supported way to fetch server-side run failure reason when the stream closes early (e.g. getRun, webhook, or expanded RunResult)?
Any known limits on first-turn prompt size or bootstrap for repo-cloned cloud VMs that would kill the run without a clear error?
Minimal repro sketch
import { Agent } from “@cursor/sdk”;
const apiKey = process.env.CURSOR_API_KEY!;
await using agent = await Agent.create({
apiKey,
model: { id: “composer-2.5” },
name: “sdk-repro-stream-unavailable”,
cloud: {
repos: [{ url: “”, startingRef: “development” }],
},
});
const run = await agent.send(“<prompt ~4k chars>”);
console.log(“run”, run.id, run.status);
(async () => {
for await (const e of run.stream()) console.log(“event”, e.type);
})().catch(console.error);
const result = await run.wait();
console.log(“wait”, result.status, result.error, result.durationMs);
console.log(“agentId”, agent.agentId);
Severity
High for automation: first-turn bootstrap cannot complete; agents are not durable after failure.
Add your Cursor team/account email, timestamp (~2026-09-12 UTC), and lockfile @cursor/sdk exact version before sending. I can shorten this to a GitHub-issue template or add a test-agent.ts one-liner repro command if you want.
Operating System
MacOS
Version Information
Version: 3.20.10
VS Code Extension API: 1.128.0
Commit: d6f462cdd0a6a6d1cff570daf980e671d0a63de0
Date: 2026-09-10T21:04:54.045Z
Layout: IDE
Build Type: Stable
Release Track: Default
Electron: 42.10.0
Chromium: 148.0.7778.280
Node.js: 24.18.1
V8: 14.8.178.38-electron.0
xterm.js: 6.1.0-beta.291
OS: Darwin arm64 25.6.0
For AI issues: which model did you use?
composer 2.5
For AI issues: add Request ID with privacy disabled
For Cursor support, cite: agent bc-dbaaba57-e59b-4dcb-bc75-a61ef2aadcea, run run-dd4e3bb8-de6a-4e32-94ed-6a621f422cb0, repo agora-api-monorepo / development, ~4.5k bootstrap prompt.
Additional Information
wasn’t happening few weeks ago, same code
Does this stop you from using Cursor
Yes - Cursor is unusable