Skip to content

Get agent deployment logs

client.deploy.logs(stringdeploymentID, DeployLogsParams { cursor, limit } query?, RequestOptionsoptions?): DeployLogsResponse { deployment_id, has_more, lines, next_cursor }
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.

ParametersExpand Collapse
deploymentID: string
query: DeployLogsParams { cursor, limit }
cursor?: string

Cursor from previous response’s next_cursor field

limit?: number

Maximum number of log lines to return

maximum500
minimum1
ReturnsExpand Collapse
DeployLogsResponse { deployment_id, has_more, lines, next_cursor }

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
  2. Subsequent calls: after_id=next_cursor from previous response
  3. Stop polling when has_more is False and the deployment reaches a terminal status
deployment_id: string

The deployment ID

has_more: boolean

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

lines?: Array<Line>

Structured log lines

id: string

Unique log line identifier (time-ordered)

message: string

Log line content after the K8s timestamp

log_level?: string

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

timestamp?: string

Parsed K8s log timestamp

formatdate-time
next_cursor?: string

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

Get agent deployment logs

import SGPClient from 'scale-gp';

const client = new SGPClient({
  accountID: 'My Account ID',
  apiKey: process.env['SGP_API_KEY'], // This is the default and can be omitted
});

const response = await client.deploy.logs('deployment_id');

console.log(response.deployment_id);
{
  "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"
}
Returns Examples
{
  "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"
}