## Get agent deployment logs

**get** `/v5/agentex/deployments/{deployment_id}/logs`

Get structured deployment log lines, with cursor-based pagination.

Returns the deployment's log lines in time order together with a `next_cursor`
and a `has_more` flag. Poll to stream logs incrementally: make the first call
without a cursor, then pass the previous response's `next_cursor` as `cursor` on
each subsequent call, stopping once the deployment reaches a terminal status.
Unlike `GET /v5/agentex/deployments/{deployment_id}`, which returns the
deployment's status and Kubernetes events, this returns the raw log output from
the deploy process. Returns 404 if no deployment with this ID exists for the
caller's account.

### Path Parameters

- `deployment_id: string`

### Query Parameters

- `cursor: optional string`

  Cursor from previous response's next_cursor field

- `limit: optional number`

  Maximum number of log lines to return

### Returns

- `deployment_id: string`

  The deployment ID

- `has_more: boolean`

  True if there may be more lines beyond this page (len(lines) == limit).

- `lines: optional array of object { id, message, log_level, timestamp }`

  Structured log lines

  - `id: string`

    Unique log line identifier (time-ordered)

  - `message: string`

    Log line content after the K8s timestamp

  - `log_level: optional string`

    Parsed log level (INFO, ERROR, WARN, DEBUG, FATAL)

  - `timestamp: optional string`

    Parsed K8s log timestamp

- `next_cursor: optional string`

  Cursor for the next page. Pass this as the after_id query parameter to get subsequent logs.

### Example

```http
curl https://api.egp.scale.com/v5/agentex/deployments/$DEPLOYMENT_ID/logs \
    -H "x-api-key: $SGP_API_KEY"
```

#### Response

```json
{
  "deployment_id": "deployment_id",
  "has_more": true,
  "lines": [
    {
      "id": "id",
      "message": "message",
      "log_level": "log_level",
      "timestamp": "2019-12-27T18:11:19.117Z"
    }
  ],
  "next_cursor": "next_cursor"
}
```
