## List container image builds

`client.Build.List(ctx, query) (*CursorPage[AgentexCloudBuild], error)`

**get** `/v5/builds`

List container image build records for the caller's account as a paginated collection.

Each entry is one individual build with its current lifecycle status; pass `agent_name`,
`source_commit`, or `working_tree_hash` to return only matching builds. Archived builds are
excluded, and results are limited to builds the caller is permitted to read. Use this to
enumerate individual builds; to instead list agents that have been built but not yet
deployed, use `GET /v5/builds/undeployed`.

### Parameters

- `query BuildListParams`

  - `AgentName param.Field[string]`

    Filter builds by agent name

  - `EndingBefore param.Field[string]`

  - `Limit param.Field[int64]`

  - `SortBy param.Field[string]`

  - `SortOrder param.Field[SortOrder]`

  - `SourceCommit param.Field[string]`

    Filter builds by source git commit

  - `StartingAfter param.Field[string]`

  - `WorkingTreeHash param.Field[string]`

    Filter builds by build-context content hash

### Returns

- `type AgentexCloudBuild struct{…}`

  - `ID string`

    The unique identifier of the entity.

  - `AccountID string`

    The ID of the account that owns the given entity.

  - `AgentName string`

    The name of the agent that this build belongs to

  - `BuildStatus AgentexCloudBuildBuildStatus`

    The current build lifecycle status

    - `const AgentexCloudBuildBuildStatusQueued AgentexCloudBuildBuildStatus = "queued"`

    - `const AgentexCloudBuildBuildStatusRunning AgentexCloudBuildBuildStatus = "running"`

    - `const AgentexCloudBuildBuildStatusSuccess AgentexCloudBuildBuildStatus = "success"`

    - `const AgentexCloudBuildBuildStatusFailed AgentexCloudBuildBuildStatus = "failed"`

    - `const AgentexCloudBuildBuildStatusCancelling AgentexCloudBuildBuildStatus = "cancelling"`

    - `const AgentexCloudBuildBuildStatusCancelled AgentexCloudBuildBuildStatus = "cancelled"`

    - `const AgentexCloudBuildBuildStatusDeleting AgentexCloudBuildBuildStatus = "deleting"`

    - `const AgentexCloudBuildBuildStatusDeleteFailed AgentexCloudBuildBuildStatus = "delete_failed"`

    - `const AgentexCloudBuildBuildStatusTimedOut AgentexCloudBuildBuildStatus = "timed_out"`

    - `const AgentexCloudBuildBuildStatusError AgentexCloudBuildBuildStatus = "error"`

    - `const AgentexCloudBuildBuildStatusUnknown AgentexCloudBuildBuildStatus = "unknown"`

  - `CloudProviderBuildID string`

    The unique identifier of the build from the cloud provider, or an internal UUID when an existing image is copied without a provider build.

  - `CreatedAt Time`

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

  - `CreatedBy Identity`

    The identity that created the entity.

    - `ID string`

    - `Type IdentityType`

      - `const IdentityTypeUser IdentityType = "user"`

      - `const IdentityTypeServiceAccount IdentityType = "service_account"`

    - `Object IdentityObject`

      - `const IdentityObjectIdentity IdentityObject = "identity"`

  - `ImageName string`

    The name of the container image to build.

  - `ImageTag string`

    The tag for the container image.

  - `SourceCommit string`

    Git commit the build context was at, when a git work tree.

  - `SourceDirty bool`

    Whether the work tree had uncommitted changes at build time (null outside git).

  - `SourceRef string`

    Git branch or tag for source_commit, when resolvable.

  - `SourceRepo string`

    Normalized git remote the build context came from (host/path, no credentials).

  - `SourceSubpath string`

    Build-context path relative to the repo root (which agent, in a monorepo).

  - `WorkingTreeHash string`

    Deterministic SHA-256 content hash of the build inputs (not the tarball).

  - `AgentID string`

    The UUID of the agent that this build belongs to

  - `BuildEndTime Time`

    When the cloud provider finished the build

  - `BuildStartTime Time`

    When the cloud provider started the build

  - `ImageURL string`

    The URL of the container image. This is not guaranteed to be present until the build is complete.

  - `Object AgentexCloudBuildObject`

    - `const AgentexCloudBuildObjectAgentexCloudBuild AgentexCloudBuildObject = "agentex_cloud_build"`

### Example

```go
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.Build.List(context.TODO(), sgpdev.BuildListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
```

#### Response

```json
{
  "has_more": true,
  "items": [
    {
      "id": "id",
      "account_id": "account_id",
      "agent_name": "agent_name",
      "build_status": "queued",
      "cloud_provider_build_id": "cloud_provider_build_id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "created_by": {
        "id": "id",
        "type": "user",
        "object": "identity"
      },
      "image_name": "image_name",
      "image_tag": "image_tag",
      "source_commit": "source_commit",
      "source_dirty": true,
      "source_ref": "source_ref",
      "source_repo": "source_repo",
      "source_subpath": "source_subpath",
      "working_tree_hash": "working_tree_hash",
      "agent_id": "agent_id",
      "build_end_time": "2019-12-27T18:11:19.117Z",
      "build_start_time": "2019-12-27T18:11:19.117Z",
      "image_url": "image_url",
      "object": "agentex_cloud_build"
    }
  ],
  "total": 0,
  "limit": 0,
  "object": "list"
}
```
