> Documentation index: https://www.gooddata.ai/docs/gooddata-ui/llms.txt lists every page of these docs as Markdown.

# IAgentsQuery

- Package: [@gooddata/sdk-backend-spi](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/index.md)
- Kind: interface
- Stability: alpha
- Source: https://github.com/gooddata/gooddata-ui-sdk/blob/rel/11.64/libs/sdk-backend-spi/src/organization/agents/index.ts

> **Alpha API.** Initial API, highly likely to change outside SemVer. Don't build on it in production. See [API maturity](https://www.gooddata.ai/docs/gooddata-ui/latest/integrations/platform/api-maturity/index.md).
> 

Service to query agents.

**Signature:**

```typescript
export interface IAgentsQuery 
```

## Methods

| Method | Description |
| --- | --- |
| [query()](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iagentsquery/index.md#iagentsqueryquery) | **_(ALPHA)_** Starts the agents query. |
| [queryAll()](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iagentsquery/index.md#iagentsqueryqueryall) | **_(ALPHA)_** Starts the agents query. |
| [withFilter(filter)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iagentsquery/index.md#iagentsquerywithfilter) | **_(ALPHA)_** Sets filter for the query. |
| [withPage(page)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iagentsquery/index.md#iagentsquerywithpage) | **_(ALPHA)_** Sets starting page for the query. Backend WILL return no data if the page is greater than total number of pages. Default page: 0 |
| [withSize(size)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iagentsquery/index.md#iagentsquerywithsize) | **_(ALPHA)_** Sets number of agents to return per page. Default size: 100 |
| [withSorting(sort)](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iagentsquery/index.md#iagentsquerywithsorting) | **_(ALPHA)_** Sets sorting for the query. |

## Method details

### IAgentsQuery.query()

> **Alpha API.** Initial API, highly likely to change outside SemVer. Don't build on it in production. See [API maturity](https://www.gooddata.ai/docs/gooddata-ui/latest/integrations/platform/api-maturity/index.md).
> 

Starts the agents query.

**Signature:**

```typescript
query(): Promise<IAgentsQueryResult>;
```
**Returns:**

Promise&lt;[IAgentsQueryResult](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iagentsqueryresult/index.md)&gt;

promise of first page of the results

### IAgentsQuery.queryAll()

> **Alpha API.** Initial API, highly likely to change outside SemVer. Don't build on it in production. See [API maturity](https://www.gooddata.ai/docs/gooddata-ui/latest/integrations/platform/api-maturity/index.md).
> 

Starts the agents query.

**Signature:**

```typescript
queryAll(): Promise<IAgent[]>;
```
**Returns:**

Promise&lt;[IAgent](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.iagent/index.md)[]&gt;

promise with a list of all agents matching the specified options

### IAgentsQuery.withFilter()

> **Alpha API.** Initial API, highly likely to change outside SemVer. Don't build on it in production. See [API maturity](https://www.gooddata.ai/docs/gooddata-ui/latest/integrations/platform/api-maturity/index.md).
> 

Sets filter for the query.

**Signature:**

```typescript
withFilter(filter: {
        name?: string;
        isPreview?: boolean;
    }): IAgentsQuery;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| filter | { name?: string; isPreview?: boolean; } | filter object with optional name for name-based search, and optional `isPreview` to filter by the preview flag (omit to return both). |

**Returns:**

[IAgentsQuery](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iagentsquery/index.md)

agents query

### IAgentsQuery.withPage()

> **Alpha API.** Initial API, highly likely to change outside SemVer. Don't build on it in production. See [API maturity](https://www.gooddata.ai/docs/gooddata-ui/latest/integrations/platform/api-maturity/index.md).
> 

Sets starting page for the query. Backend WILL return no data if the page is greater than total number of pages. Default page: 0

**Signature:**

```typescript
withPage(page: number): IAgentsQuery;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| page | number | zero indexed, must be non-negative |

**Returns:**

[IAgentsQuery](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iagentsquery/index.md)

agents query

### IAgentsQuery.withSize()

> **Alpha API.** Initial API, highly likely to change outside SemVer. Don't build on it in production. See [API maturity](https://www.gooddata.ai/docs/gooddata-ui/latest/integrations/platform/api-maturity/index.md).
> 

Sets number of agents to return per page. Default size: 100

**Signature:**

```typescript
withSize(size: number): IAgentsQuery;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| size | number | desired max number of agents per page, must be a positive number |

**Returns:**

[IAgentsQuery](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iagentsquery/index.md)

agents query

### IAgentsQuery.withSorting()

> **Alpha API.** Initial API, highly likely to change outside SemVer. Don't build on it in production. See [API maturity](https://www.gooddata.ai/docs/gooddata-ui/latest/integrations/platform/api-maturity/index.md).
> 

Sets sorting for the query.

**Signature:**

```typescript
withSorting(sort: string[]): IAgentsQuery;
```

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| sort | string[] | Sorting criteria in the format: property,(asc\|desc). Default sort order is ascending. Multiple sort criteria are supported. |

**Returns:**

[IAgentsQuery](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-backend-spi/sdk-backend-spi.iagentsquery/index.md)

agents query
