> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.cloudraker.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.cloudraker.com/_mcp/server.

# Stream an agent run live

GET https://api.cloudraker.com/v1/agent-runs/{id}/stream

Server-sent events for a run, live: `text/event-stream` with three event kinds.

* `timeline` — a durable event, same shape as `GET /v1/agent-runs/{id}/timeline`, with the SSE `id` set to the event id. Delivery is at-least-once: dedupe by id, and reconnect with `Last-Event-ID` to resume.
* `live` — provisional activity while the agent works: `{kind: "text_delta", stepId, text}` streams the agent's words as it writes them; `{kind: "tool_started"|"tool_finished", toolCallId, toolName, ok?}` announce tool activity. Never durable — a reconnect replays none of it.
* `status` — `{status}` in the run-status vocabulary, sent on connect and on every change. Terminal status ends the stream.

Streams are capped at five minutes — reconnect to continue; `Last-Event-ID` carries the durable cursor. Reading a `queued` run's stream starts it, exactly like reading the run. curl it: `curl -N -H "authorization: Bearer $KEY" …/v1/agent-runs/agr_…/stream`

**Learn more:** [Agents guide](https://docs.cloudraker.com/capabilities/agents)

Reference: https://docs.cloudraker.com/api/cloud-raker-api/agents/stream-agent-run

## Authentication

- `Authorization` header (bearer token, required)

## Request

### Path parameters

- `id` (string, required)

## Response

### 200

The event stream (`text/event-stream`).

## Examples

**Response**

```json
{}
```

**SDK Code**

```typescript
import { CloudRakerClient } from "@cloudraker/api";

async function main() {
    const client = new CloudRakerClient({
        token: "YOUR_TOKEN_HERE",
    });
    await client.agents.streamAgentRun({
        id: "id",
    });
}
main();

```

```python
from cloudraker import CloudRaker

client = CloudRaker(
    token="YOUR_TOKEN_HERE",
)

client.agents.stream_agent_run(
    id="id",
)

```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.cloudraker.com/v1/agent-runs/id/stream"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.cloudraker.com/v1/agent-runs/id/stream")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.cloudraker.com/v1/agent-runs/id/stream")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.cloudraker.com/v1/agent-runs/id/stream', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.cloudraker.com/v1/agent-runs/id/stream");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.cloudraker.com/v1/agent-runs/id/stream")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```