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

# Stream a delegate task

GET https://api.runtype.com/v1/delegate-tasks/{id}/events

Server-Sent Events: the journal past `after`, then a live tail until the task settles. Each frame carries its seq as the SSE id; reconnect with `after=<last id>`.

Reference: https://docs.runtype.com/api-reference/runtype-api/delegate-tasks/stream-a-delegate-task

## Authentication

- `Authorization` header (bearer token, required) — API key or Clerk session token

## Servers

- `https://api.runtype.com` (Production, default)
- `https://api.runtype-staging.com` (Staging)

## Request

### Path parameters

- `id` (string, required) — The task id (`dlg_…`).

### Query parameters

- `after` (integer, optional, nullable)

## Response

### 200

Server-Sent Events stream (replay followed by a live tail)

- Streaming response of `Delegate tasks_streamADelegateTask_Response_200`.

## Errors

### 401 Unauthorized Error

Unauthorized

- `error` (string, required)
- `details` (list of ErrorDetailsItems, optional)

### 403 Forbidden Error

Missing API key scope

- `error` (string, required)
- `details` (list of ErrorDetailsItems, optional)

### 404 Not Found Error

Feature disabled, or no such task in this organization

- `error` (string, required)
- `details` (list of ErrorDetailsItems, optional)

### 503 Service Unavailable Error

The operator agent is not available on this deployment

- `error` (string, required)
- `details` (list of ErrorDetailsItems, optional)

## Types

### DelegateTasksStreamADelegateTaskResponse2000

- `at` (string, required)
- `instruction` (string, required)
- `seq` (integer, required)
- `taskId` (string, required)
- `type` (enum, required)
  - Allowed values: `task_started`

### DelegateTasksStreamADelegateTaskResponse2001

- `at` (string, required)
- `round` (integer, required)
- `seq` (integer, required)
- `type` (enum, required)
  - Allowed values: `model_round`
- `text` (string, optional)
- `thinking` (boolean, optional)

### DelegateTasksStreamADelegateTaskResponse2002

- `at` (string, required)
- `callId` (string, required)
- `seq` (integer, required)
- `tool` (string, required)
- `type` (enum, required)
  - Allowed values: `tool_call`
- `args` (any, optional)

### DelegateTasksStreamADelegateTaskResponse2003

- `at` (string, required)
- `callId` (string, required)
- `durationMs` (integer, required)
- `ok` (boolean, required)
- `seq` (integer, required)
- `summary` (string, required)
- `tool` (string, required)
- `type` (enum, required)
  - Allowed values: `tool_result`
- `entity` (V1DelegateTasksIdEventsGetResponsesContentSseSchemaOneOf3Entity, optional)

### DelegateTasksStreamADelegateTaskResponse2004

- `at` (string, required)
- `message` (string, required)
- `seq` (integer, required)
- `type` (enum, required)
  - Allowed values: `milestone`

### DelegateTasksStreamADelegateTaskResponse2005

- `at` (string, required)
- `question` (string, required)
- `seq` (integer, required)
- `type` (enum, required)
  - Allowed values: `question`

### DelegateTasksStreamADelegateTaskResponse2006

- `at` (string, required)
- `message` (string, required)
- `seq` (integer, required)
- `type` (enum, required)
  - Allowed values: `message_received`

### DelegateTasksStreamADelegateTaskResponse2007

- `at` (string, required)
- `result` (V1DelegateTasksIdEventsGetResponsesContentSseSchemaOneOf7Result, required)
- `seq` (integer, required)
- `type` (enum, required)
  - Allowed values: `task_completed`

### DelegateTasksStreamADelegateTaskResponse2008

- `at` (string, required)
- `error` (string, required)
- `seq` (integer, required)
- `type` (enum, required)
  - Allowed values: `task_failed`

### DelegateTasksStreamADelegateTaskResponse2009

- `at` (string, required)
- `seq` (integer, required)
- `type` (enum, required)
  - Allowed values: `task_cancelled`

### ErrorDetailsItems

- `message` (string, required)
- `code` (string, optional) — Stable Runtype validation code (e.g. MISSING_REQUIRED_FIELD, INVALID_ENUM).
- `path` (string, optional) — Dotted JSON path to the offending field.
- `suggestion` (string, optional) — Actionable hint (allowed values, accepted range, …).

### V1DelegateTasksIdEventsGetResponsesContentSseSchemaOneOf3Entity

- `action` (enum, required)
  - Allowed values: `created`, `updated`, `deleted`, `executed`, `read`
- `id` (string, required)
- `kind` (string, required)
- `name` (string, optional)

### V1DelegateTasksIdEventsGetResponsesContentSseSchemaOneOf7Result

- `links` (list of V1DelegateTasksIdEventsGetResponsesContentSseSchemaOneOf7ResultLinksItems, required)
- `modelRoundCount` (integer, required)
- `summary` (string, required)
- `toolCallCount` (integer, required)
- `touchedEntities` (list of V1DelegateTasksIdEventsGetResponsesContentSseSchemaOneOf7ResultTouchedEntitiesItems, required)
- `totalCost` (double, optional)
- `warnings` (list of string, optional)

### V1DelegateTasksIdEventsGetResponsesContentSseSchemaOneOf7ResultLinksItems

- `label` (string, required)
- `url` (string, required)

### V1DelegateTasksIdEventsGetResponsesContentSseSchemaOneOf7ResultTouchedEntitiesItems

- `action` (enum, required)
  - Allowed values: `created`, `updated`, `deleted`, `executed`, `read`
- `id` (string, required)
- `kind` (string, required)
- `name` (string, optional)

## Examples

**SDK Code**

```python
import requests

url = "https://api.runtype.com/v1/delegate-tasks/dlg_01jh0000000000000000000000/events"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.runtype.com/v1/delegate-tasks/dlg_01jh0000000000000000000000/events';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://api.runtype.com/v1/delegate-tasks/dlg_01jh0000000000000000000000/events"

	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.runtype.com/v1/delegate-tasks/dlg_01jh0000000000000000000000/events")

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.runtype.com/v1/delegate-tasks/dlg_01jh0000000000000000000000/events")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.runtype.com/v1/delegate-tasks/dlg_01jh0000000000000000000000/events', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.runtype.com/v1/delegate-tasks/dlg_01jh0000000000000000000000/events");
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.runtype.com/v1/delegate-tasks/dlg_01jh0000000000000000000000/events")! 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()
```