# Cloud Agents API/SDK stream delivers intermediate messages (steps) ~20–40s later than cursor.com/agents UI on the same run

**URL:** <https://forum.cursor.com/t/cloud-agents-api-sdk-stream-delivers-intermediate-messages-steps-20-40s-later-than-cursor-com-agents-ui-on-the-same-run/170833>\
**Category:** Bug Reports\
**Tags:** cursor-sdk, performance, cloud-agents\
**Created:** [September 7, 2026, 12:10am UTC](https://forum.cursor.com/t/cloud-agents-api-sdk-stream-delivers-intermediate-messages-steps-20-40s-later-than-cursor-com-agents-ui-on-the-same-run/170833 "2026-09-07T00:10:01Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kannan\_Mavila](https://avatars.discourse-cdn.com/v4/letter/k/67e7ee/32.png) [@Kannan\_Mavila](https://forum.cursor.com/u/Kannan_Mavila)\
**Post date:** [September 7, 2026, 12:10am UTC](https://forum.cursor.com/t/cloud-agents-api-sdk-stream-delivers-intermediate-messages-steps-20-40s-later-than-cursor-com-agents-ui-on-the-same-run/170833/1 "2026-09-07T00:10:01Z")

</div>

### Where does the bug appear (feature/product)?

Cursor SDK

### Describe the Bug

We’re building a product (Nolby) on Cloud Agents (bc-…) via CURSOR\_API\_KEY + @cursor/sdk. The web UI at /agents/{bcId} shows assistant bubbles almost immediately (~2–4s). The public run stream / SDK onStep/onDelta delivers the same text much later (often after Get A Run is already FINISHED), so we cannot match UI latency for intermediate user-facing updates.

### Steps to Reproduce

1. Open [https://cursor.com/agents/{bcId}](https://cursor.com/agents/%7BbcId%7D) and watch the chat.
2. POST /v1/agents/{bcId}/runs with API key; prompt something like: first message exactly “starting work”, then 10s wait, then a final message.
3. Parallel: poll Get A Run; open SSE with curl --no-buffer (or SDK onDelta/onStep).
4. Compare timing of “starting work” intermediate message in UI vs first SSE/onStep text vs Get A Run FINISHED.

### Expected Behavior

1. Parity with the Cloud Agents web UI  
For the same agent/run, assistant intermediate text delivered via the public Cloud Agents API (GET /v1/agents/{id}/runs/{runId}/stream) and @cursor/sdk (onDelta / onStep) should appear at roughly the same wall time as the corresponding bubbles on /agents/{bcId} (within a small, documented tolerance — e.g. a few seconds), not tens of seconds later.

2. Live (or near-live) intermediates during RUNNING  
While a run is RUNNING, stream consumers should receive incremental assistant updates as they are produced (including early progress lines such as starting work), not only in a late batch near or after stream FINISHED.

3. Consistent ordering of completion signals  
Terminal run state from GET /v1/agents/{id}/runs/{runId} (FINISHED + result) and the run stream / SDK wait path should not reverse in a way that leaves clients without intermediates until long after the run has already finished. If stream delivery can lag Get A Run, that should be documented; ideally stream content for a finished run is available promptly once the run is terminal.

4. Documented, supported channel for API-key clients  
If the web UI uses a different realtime path than the public run stream, either:

- that path (or an equivalent) is available and documented for CURSOR\_API\_KEY clients, or
- the docs clearly state that UI-speed live intermediates are not available via the public API/SDK, and recommend Get A Run (or similar) for completion-only UX.

1. Stream availability during the run lifecycle  
Connecting to the run stream after the run is available (RUNNING / as soon as streaming is supported) should yield a stable SSE session without immediate stream\_unavailable / “Run stream is no longer available,” unless the run is truly gone; any required connect/reconnect timing should be documented.

### Operating System

MacOS

### Version Information

@cursor/sdk 1.0.26  
Cloud Agents API: v

### For AI issues: which model did you use?

Composer 2.5 Fast

### For AI issues: add Request ID with privacy disabled

NA - this ticket pertains to Cloud Agent.

### Additional Information

On [cursor.com/agents/{bcId}](http://cursor.com/agents/%7BbcId%7D) (session cookie auth, not API key), the page uses internal endpoints such as:

- POST /api/auth/attachBackgroundComposerLogs → application/x-ndjson (observed mostly setup/pod logs, not plaintext chat bubbles in our tees)
- POST /api/background-composer/get-detailed-composer (includes prompt.conversationHistory, but did not appear to be the live bubble source for our probes)
- Frequent POST /api/background-composer/list  
We did not see the page call \</v1/agents/…/stream. So the UI’s live channel appears to be a separate, session-authenticated web path, not the public Cloud Agents stream.

### Does this stop you from using Cursor

Yes - Cursor is unusable

---

<div class="post-metadata">

**Author:** ![joinwell52](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/joinwell52/32/106009_2.png) [@joinwell52](https://forum.cursor.com/u/joinwell52)\
**Post date:** [September 7, 2026, 2:44am UTC](https://forum.cursor.com/t/cloud-agents-api-sdk-stream-delivers-intermediate-messages-steps-20-40s-later-than-cursor-com-agents-ui-on-the-same-run/170833/5 "2026-09-07T02:44:59Z")

</div>

Did the raw curl stream lag by the same amount as onStep/onDelta? The shared run ID makes this a useful comparison. I’d be interested in the gap between the first SSE byte and the first complete event—those could point to different buffering problems.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/colin/32/90452_2.png) [@Colin](https://forum.cursor.com/u/Colin)\
**Post date:** [September 7, 2026, 1:21pm UTC](https://forum.cursor.com/t/cloud-agents-api-sdk-stream-delivers-intermediate-messages-steps-20-40s-later-than-cursor-com-agents-ui-on-the-same-run/170833/13 "2026-09-07T13:21:56Z")

</div>

Hey @Kannan_Mavila, thanks for the detailed report.

I checked your runs on `bc-7bc40663-6255-43d8-a8c3-1f3169526b6c`. The run stream and the web UI read from the same live event stream, so intermediate text isn’t batched for API clients. The problem is getting connected: 41 of your 53 first stream connections on Sep 6 failed with `stream_unavailable` (“Run stream is no longer available”) right after `POST /runs`, while the run was RUNNING and finished normally. That’s a race at run start on our side, and I reproduced it at a similar rate today.

The SDK then handles that failure badly.

- If it arrives as an HTTP 409, `@cursor/sdk` gives up: `run.wait()` resolves `status: "error"` with `error.code: "stream_unavailable"`, nothing streams, and your next `send()` gets a 409 because the run is still going.
- If it arrives inside the SSE stream, the SDK reconnects after a Get A Run call plus backoff and then replays everything at once. That burst is your 20–40 s gap, and if the run finishes before the reattach, the intermediates never arrive at all.

Both are filed with the team. In the meantime:

- Treat `stream_unavailable` in the first few seconds as “retry”, not final: reconnect after ~1 s while Get A Run says RUNNING. The stream replays from the start, so nothing is lost. A fixed delay before opening the stream is not enough; I still got 409s with a 1 s wait.
- On the SDK, if `wait()` resolves with `error.code === "stream_unavailable"`, poll Get A Run for the real status before your next `send()`, or open the raw stream endpoint yourself for the replay.
- Get A Run showing FINISHED a second or two before the stream’s `result` event is expected.

If you still see a gap on a run whose first connection succeeded, send me the runId and the wall time your client got the first assistant frame and I’ll line it up!

---

<div class="post-metadata">

**Author:** ![Kannan\_Mavila](https://avatars.discourse-cdn.com/v4/letter/k/67e7ee/32.png) [@Kannan\_Mavila](https://forum.cursor.com/u/Kannan_Mavila)\
**Post date:** [September 7, 2026, 6:47pm UTC](https://forum.cursor.com/t/cloud-agents-api-sdk-stream-delivers-intermediate-messages-steps-20-40s-later-than-cursor-com-agents-ui-on-the-same-run/170833/14 "2026-09-07T18:47:07Z")

</div>

Hi @joinwell52,

Yes, raw unbuffered curl lagged identically to the SDK. The gap between first SSE byte and first complete SSE event is 0–1 ms (no client-side buffering). Heartbeats and `status: RUNNING` events arrive promptly. What’s delayed is the assistant text itself, which the server doesn’t seem to publish to the stream until much later (often in a single burst near or after FINISHED). From what I can see: the bottleneck is server-side event publication, not SSE framing or client buffering.

Thanks for your time!

---

<div class="post-metadata">

**Author:** ![Kannan\_Mavila](https://avatars.discourse-cdn.com/v4/letter/k/67e7ee/32.png) [@Kannan\_Mavila](https://forum.cursor.com/u/Kannan_Mavila)\
**Post date:** [September 7, 2026, 6:51pm UTC](https://forum.cursor.com/t/cloud-agents-api-sdk-stream-delivers-intermediate-messages-steps-20-40s-later-than-cursor-com-agents-ui-on-the-same-run/170833/15 "2026-09-07T18:51:55Z")

</div>

Thanks Colin 🙂

I reproduced the connect race and tried your retry guidance.

runId: `run-e8421a19-3581-4808-aacf-702ee2ab3eb0`  
agent: `bc-7bc40663-6255-43d8-a8c3-1f3169526b6c`

- Attempt 1 (~+1.6s): SSE opened, got `status: RUNNING`, then `stream_unavailable` (“Run stream is no longer available”) at ~+2.3s (SSE error, HTTP 200).
- Attempt 2 (~+1s later, Get A Run still RUNNING): connection stayed up for the rest of the run.
- Get A Run `FINISHED` at +31.2s (`5107` + tag).
- First assistant SSE text at +68.6s — full thinking + intermediates + final in one burst (~37s after Get A Run finished).

So reconnect fixed the race, but we still saw a large gap even after a stable session from the call at ~+4s.

Thanks for your time!

---

<div class="post-metadata">

**Author:** ![joinwell52](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/joinwell52/32/106009_2.png) [@joinwell52](https://forum.cursor.com/u/joinwell52)\
**Post date:** [September 8, 2026, 1:56am UTC](https://forum.cursor.com/t/cloud-agents-api-sdk-stream-delivers-intermediate-messages-steps-20-40s-later-than-cursor-com-agents-ui-on-the-same-run/170833/19 "2026-09-08T01:56:48Z")

</div>

Thanks, Kannan. I saw your follow-up to Colin too: the reconnect held, but the text still arrived about 37 seconds after FINISHED. That leaves a gap the initial connection race doesn’t explain on its own. I wouldn’t mark this resolved from the reconnect alone.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/colin/32/90452_2.png) [@Colin](https://forum.cursor.com/u/Colin)\
**Post date:** [September 8, 2026, 10:38am UTC](https://forum.cursor.com/t/cloud-agents-api-sdk-stream-delivers-intermediate-messages-steps-20-40s-later-than-cursor-com-agents-ui-on-the-same-run/170833/23 "2026-09-08T10:38:07Z")

</div>

Hey @Kannan_Mavila, thanks for that run, it pinned it down.

It looks like the delay is on our side and is tied to the agent’s history. When a stream connects, the server loads the agent’s full conversation history before it starts forwarding live events, and on the API path that load blocks the stream. On an agent with a handful of turns it takes under a second. An agent with several hundred turns, like `bc-7bc40663-6255-43d8-a8c3-1f3169526b6c`, takes 30 seconds or more, and everything the agent said in the meantime arrives in one burst when the load finishes. The web UI does not hit this because the browser tells the server which history it already has, so it skips the load.

I can see the same pattern across the agents you have been testing with today: the ones with a small number of turns delivered intermediate text within a second or two of connecting, and the two with a few hundred turns paused for 25 to 35 seconds before the first text.

Would you mind doing one quick run to confirm it from your side? Spin up a brand-new agent (please share the `run`/ `bc-` ID), run your usual prompt (the “starting work”, sleep 10, “done” one) on the stream, and just note how long it takes from the run being created to the first assistant text arriving. Then do the same against `bc-7bc40663-6255-43d8-a8c3-1f3169526b6c` and note that timing too.

If the fresh agent delivers “starting work” within a few seconds and the long-running one still takes 30 seconds or more, that confirms it and I can share it with the team!

---

<div class="post-metadata">

**Author:** ![Kannan\_Mavila](https://avatars.discourse-cdn.com/v4/letter/k/67e7ee/32.png) [@Kannan\_Mavila](https://forum.cursor.com/u/Kannan_Mavila)\
**Post date:** [September 8, 2026, 1:14pm UTC](https://forum.cursor.com/t/cloud-agents-api-sdk-stream-delivers-intermediate-messages-steps-20-40s-later-than-cursor-com-agents-ui-on-the-same-run/170833/24 "2026-09-08T13:14:57Z")

</div>

Hi Colin, I ran the same test with same prompt.

### Fresh agent (1 prior turn)

- bc-: `bc-be4cc842-131d-4fb5-944c-044db81b67bd`
- runId: `run-5b3baa47-cff8-49de-823f-62b752a34486`
- Get A Run FINISHED ~24.7s
- “starting work” on stream: ~11.2s (run still RUNNING; Get A Run FINISHED ~24.7s)
- intermediate arrived live mid-run ~11.2s (still very late)

### Agent with long history

- bc-: `bc-7bc40663-6255-43d8-a8c3-1f3169526b6c`
- runId: `run-c3b2613d-4748-41f5-b37a-7f281eeeb506`
- Get A Run FINISHED ~23.4s
- “starting work” on stream: ~83.8s
- intermediate did not arrive while RUNNING; it showed up ~60s after the run was already finished, in the late burst

That matches your history-load theory but the intermediates are still lagging way behind the UI (not ~1s as you described).

Side question: Is there any way we can replicate through the SDK what the UI is doing?

Thanks.

---

<div class="post-metadata">

**Author:** ![Kannan\_Mavila](https://avatars.discourse-cdn.com/v4/letter/k/67e7ee/32.png) [@Kannan\_Mavila](https://forum.cursor.com/u/Kannan_Mavila)\
**Post date:** [September 11, 2026, 9:34am UTC](https://forum.cursor.com/t/cloud-agents-api-sdk-stream-delivers-intermediate-messages-steps-20-40s-later-than-cursor-com-agents-ui-on-the-same-run/170833/28 "2026-09-11T09:34:09Z")

</div>

Hey @Colin , any updates on this? 🙂 thanks

---

<div class="post-metadata">

**Author:** ![Colin](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/colin/32/90452_2.png) [@Colin](https://forum.cursor.com/u/Colin)\
**Post date:** [October 21, 2026, 6:48pm UTC](https://forum.cursor.com/t/cloud-agents-api-sdk-stream-delivers-intermediate-messages-steps-20-40s-later-than-cursor-com-agents-ui-on-the-same-run/170833/31 "2026-10-21T18:48:22Z")

</div>

Hey @Kannan_Mavila,

Sorry for the long wait on an update here. Here’s where the three issues we found in this thread stand:

1. The connect race right after creating a run (`stream_unavailable` / “Run stream is no longer available” on the first stream connection) has been fixed on our side, so the first connection should stay up without needing a retry.
2. The long delay on agents with a big history has also been addressed on our side. The API stream no longer waits on the agent’s full conversation history before forwarding live events, so intermediate text on your long-running agents should now arrive much sooner.
3. The SDK change so `run.wait()` reconnects on `stream_unavailable` instead of resolving with an error has landed and will be included in an upcoming version of `@cursor/sdk`. With the first fix in place you shouldn’t hit that path anymore, so it’s mainly a safety net.

Could you rerun your paired test (the “starting work”, sleep 10, “done” prompt) against your long-history agent and let me know how long the first assistant text takes to arrive now? If it’s still well behind the web UI, the run ID and your client-side timestamps would help us line it up.

---

<div class="post-metadata">

**Author:** ![Kannan\_Mavila](https://avatars.discourse-cdn.com/v4/letter/k/67e7ee/32.png) [@Kannan\_Mavila](https://forum.cursor.com/u/Kannan_Mavila)\
**Post date:** [November 3, 2026, 12:40pm UTC](https://forum.cursor.com/t/cloud-agents-api-sdk-stream-delivers-intermediate-messages-steps-20-40s-later-than-cursor-com-agents-ui-on-the-same-run/170833/32 "2026-11-03T12:40:39Z")

</div>

Hey @Colin — thanks for getting back, and for the detailed update on the three fixes.

Sorry we weren’t watching this thread; apologies for the late reply.

Unfortunately we’ve switched to a different provider and no longer have the Cursor system running, so we can’t re-run that paired test - apologies. Appreciate the work either way — glad the stream race and history delay were addressed.
