Skip to content

Get agent deployment logs

client.Deploy.Logs(ctx, deploymentID, query) (*DeployLogsResponse, error)
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 param.Field[string]Optional

Cursor from previous response’s next_cursor field

Limit param.Field[int64]Optional

Maximum number of log lines to return

maximum500
minimum1
ReturnsExpand Collapse
type DeployLogsResponse struct{…}

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
DeploymentID string

The deployment ID

HasMore bool

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

Lines []DeployLogsResponseLineOptional

Structured log lines

ID string

Unique log line identifier (time-ordered)

Message string

Log line content after the K8s timestamp

LogLevel stringOptional

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

Timestamp TimeOptional

Parsed K8s log timestamp

formatdate-time
NextCursor stringOptional

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

Get agent deployment logs

package main

import (
  "context"
  "fmt"

  "github.com/scaleapi/sgp-dev-go"
  "github.com/scaleapi/sgp-dev-go/option"
)

func main() {
  client := sgpdev.NewClient(
    option.WithAPIKey("My API Key"),
    option.WithAccountID("My Account ID"),
  )
  response, err := client.Deploy.Logs(
    context.TODO(),
    "deployment_id",
    sgpdev.DeployLogsParams{

    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.DeploymentID)
}
{
  "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"
}