# streamRunEvents

```graphql
subscription StreamRunEvents($command: RunsStreamRunEventsCommand!) {
  streamRunEvents(command: $command) {
    eventId
    eventType
    payload
    isError
    createdAt
    runId
    eventClass
    spanId
    parentSpanId
    turnId
    originEventType
    originCustomName
    unrecoverableFields
  }
}
```

Stream run events.

## Arguments

| Name                          | Type                        | Required | Description                                                                                                                                                                                                                     |
| ----------------------------- | --------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `command`                     | RunsStreamRunEventsCommand! | Yes      |                                                                                                                                                                                                                                 |
| `command.runId`               | ID!                         | Yes      | Run UUID, or the public run id (run\_…) that run lists and getRun carry as run\_id. Normal callers need access to the run owner and project.runs.read. A bound eval runtime may instead read its authorized direct agent child. |
| `command.eventRepresentation` | String                      |          | Use `run-events-v1` to receive Agent Events Protocol CloudEvents, or `ag-ui` for receipt-backed AG-UI events from Agent runs. Omit it to keep the released run-event row stream contract.                                       |
| `lastEventId`                 | String                      |          |                                                                                                                                                                                                                                 |

## Variables

```json
{
  "command": {
    "runId": "string"
  }
}
```

## Responses

| Status | Description                                                               |
| ------ | ------------------------------------------------------------------------- |
| 200    | A stream of events, each with a RunsStreamFrame! in data.streamRunEvents. |

## Call it

```bash
curl -X POST -N "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Accept: text/event-stream" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "subscription StreamRunEvents($command: RunsStreamRunEventsCommand!) {\n  streamRunEvents(command: $command) {\n    eventId\n    eventType\n    payload\n    isError\n    createdAt\n    runId\n    eventClass\n    spanId\n    parentSpanId\n    turnId\n    originEventType\n    originCustomName\n    unrecoverableFields\n  }\n}",
  "variables": {
    "command": {
      "runId": "string"
    }
  }
}'
```

## Example response

```text
event: next
data: {"data":{"streamRunEvents":{"eventId":0,"eventType":"string","payload":{},"isError":false,"createdAt":"string","runId":"string","eventClass":"string","spanId":"string","parentSpanId":"string","turnId":"string","originEventType":"string","originCustomName":"string","unrecoverableFields":["string"]}}}

event: complete
```
