Skip to content

List agent deployments

client.Deploy.List(ctx, query) (*CursorPage[AgentexCloudDeploy], error)
GET/v5/agentex/deployments

List the account’s agent deployments, with pagination and optional filters.

Returns the deployments the caller is authorized to read. Optionally filter by build_id, by agent_name (matched through each deployment’s associated build), or by preview_label. A preview_label is non-unique — many deployments can share one (for example every deploy for a branch) — so combine it with limit=1 to fetch the latest deployment for that label. This lists deployments (the running or attempted agent instances); to list the image builds they run, use the agentex builds API.

ParametersExpand Collapse
query DeployListParams
AgentName param.Field[string]Optional

Filter deployments by agent name (via associated build)

BuildID param.Field[string]Optional

Filter deployments by build ID

EndingBefore param.Field[string]Optional
Limit param.Field[int64]Optional
maximum10000
minimum1
PreviewLabel param.Field[string]Optional

Filter deployments by preview label (e.g. branch name). The label is non-unique — many deployments can share it. Combine with limit=1 to get the latest deploy for that label.

SortBy param.Field[string]Optional
SortOrder param.Field[SortOrder]Optional
StartingAfter param.Field[string]Optional
ReturnsExpand Collapse
type AgentexCloudDeploy struct{…}
ID string

The unique identifier of the deployment.

AccountID string

The ID of the account that owns the given entity.

CreatedAt Time

The date and time when the entity was created in ISO format.

formatdate-time
CreatedBy Identity

The identity that created the entity.

ID string
Type IdentityType
One of the following:
const IdentityTypeUser IdentityType = "user"
const IdentityTypeServiceAccount IdentityType = "service_account"
Object IdentityObjectOptional
EnvironmentConfig string

YAML content of environment configuration from the environment config file.

ManifestFile string

YAML content of manifest configuration.

Namespace string

Kubernetes namespace where the deployment is deployed.

Status string

Deployment status: pending, running, completed, failed, or cancelled.

BuildID stringOptional

The build_id of the cloud build that produced the deployed image.

DeployEvents []AgentexCloudDeployEventOptional

Kubernetes events for this deployment.

Message stringOptional

Full event message.

Reason stringOptional

Short reason, e.g. ‘Pulling’, ‘Scheduled’.

Timestamp TimeOptional

When the event was observed.

formatdate-time
Type stringOptional

Event type, e.g. ‘Normal’ or ‘Warning’.

ExpiresAt TimeOptional

When this deployment will be cleaned up. Always set on preview deployments (defaults to 8 hours from creation if the request omits it). Null on non-preview deployments — they have no TTL.

formatdate-time
HelmReleaseName stringOptional

Helm release name after successful deployment.

Object AgentexCloudDeployObjectOptional
PreviewLabel stringOptional

Non-unique grouping label for preview deployments. Filter ?preview_label=X&limit=1 returns the latest deploy for the label. Sanitized (lowercase alphanumeric + hyphens) and capped at 30 characters.

List agent deployments

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"),
  )
  page, err := client.Deploy.List(context.TODO(), sgpdev.DeployListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "has_more": true,
  "items": [
    {
      "id": "id",
      "account_id": "account_id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "created_by": {
        "id": "id",
        "type": "user",
        "object": "identity"
      },
      "environment_config": "environment_config",
      "manifest_file": "manifest_file",
      "namespace": "namespace",
      "status": "status",
      "build_id": "build_id",
      "deploy_events": [
        {
          "message": "message",
          "reason": "reason",
          "timestamp": "2019-12-27T18:11:19.117Z",
          "type": "type"
        }
      ],
      "expires_at": "2019-12-27T18:11:19.117Z",
      "helm_release_name": "helm_release_name",
      "object": "agentex_cloud_deploy",
      "preview_label": "preview_label"
    }
  ],
  "total": 0,
  "limit": 0,
  "object": "list"
}
Returns Examples
{
  "has_more": true,
  "items": [
    {
      "id": "id",
      "account_id": "account_id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "created_by": {
        "id": "id",
        "type": "user",
        "object": "identity"
      },
      "environment_config": "environment_config",
      "manifest_file": "manifest_file",
      "namespace": "namespace",
      "status": "status",
      "build_id": "build_id",
      "deploy_events": [
        {
          "message": "message",
          "reason": "reason",
          "timestamp": "2019-12-27T18:11:19.117Z",
          "type": "type"
        }
      ],
      "expires_at": "2019-12-27T18:11:19.117Z",
      "helm_release_name": "helm_release_name",
      "object": "agentex_cloud_deploy",
      "preview_label": "preview_label"
    }
  ],
  "total": 0,
  "limit": 0,
  "object": "list"
}