## Get agent deployment logs

`deploy.logs(strdeployment_id, DeployLogsParams**kwargs)  -> DeployLogsResponse`

**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.

### Parameters

- `deployment_id: str`

- `cursor: Optional[str]`

  Cursor from previous response's next_cursor field

- `limit: Optional[int]`

  Maximum number of log lines to return

### Returns

- `class DeployLogsResponse: …`

  Response containing structured deployment log lines with cursor-based pagination.

  The CLI can poll this endpoint to stream logs incrementally:

  1. First call: no after_id
  1. Subsequent calls: after_id=next_cursor from previous response
  1. Stop polling when has_more is False and the deployment reaches a terminal status

  - `deployment_id: str`

    The deployment ID

  - `has_more: bool`

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

  - `lines: Optional[List[Line]]`

    Structured log lines

    - `id: str`

      Unique log line identifier (time-ordered)

    - `message: str`

      Log line content after the K8s timestamp

    - `log_level: Optional[str]`

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

    - `timestamp: Optional[datetime]`

      Parsed K8s log timestamp

  - `next_cursor: Optional[str]`

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

### Example

```python
import os
from scale_gp_beta import SGPClient

client = SGPClient(
    api_key=os.environ.get("SGP_API_KEY"),  # This is the default and can be omitted
)
response = client.deploy.logs(
    deployment_id="deployment_id",
)
print(response.deployment_id)
```

#### 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"
}
```
