## List agent deployments

`deploy.list(DeployListParams**kwargs)  -> SyncCursorPage[AgentexCloudDeploy]`

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

### Parameters

- `agent_name: Optional[str]`

  Filter deployments by agent name (via associated build)

- `build_id: Optional[str]`

  Filter deployments by build ID

- `ending_before: Optional[str]`

- `limit: Optional[int]`

- `preview_label: Optional[str]`

  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.

- `sort_by: Optional[str]`

- `sort_order: Optional[SortOrder]`

  - `"asc"`

  - `"desc"`

- `starting_after: Optional[str]`

### Returns

- `class AgentexCloudDeploy: …`

  - `id: str`

    The unique identifier of the deployment.

  - `account_id: str`

    The ID of the account that owns the given entity.

  - `created_at: datetime`

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

  - `created_by: Identity`

    The identity that created the entity.

    - `id: str`

    - `type: Literal["user", "service_account"]`

      - `"user"`

      - `"service_account"`

    - `object: Optional[Literal["identity"]]`

      - `"identity"`

  - `environment_config: str`

    YAML content of environment configuration from the environment config file.

  - `manifest_file: str`

    YAML content of manifest configuration.

  - `namespace: str`

    Kubernetes namespace where the deployment is deployed.

  - `status: str`

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

  - `build_id: Optional[str]`

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

  - `deploy_events: Optional[List[AgentexCloudDeployEvent]]`

    Kubernetes events for this deployment.

    - `message: Optional[str]`

      Full event message.

    - `reason: Optional[str]`

      Short reason, e.g. 'Pulling', 'Scheduled'.

    - `timestamp: Optional[datetime]`

      When the event was observed.

    - `type: Optional[str]`

      Event type, e.g. 'Normal' or 'Warning'.

  - `expires_at: Optional[datetime]`

    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.

  - `helm_release_name: Optional[str]`

    Helm release name after successful deployment.

  - `object: Optional[Literal["agentex_cloud_deploy"]]`

    - `"agentex_cloud_deploy"`

  - `preview_label: Optional[str]`

    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.

### 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
)
page = client.deploy.list()
page = page.items[0]
print(page.id)
```

#### Response

```json
{
  "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"
}
```
