> ## Documentation Index
> Fetch the complete documentation index at: https://studio.chat-atp.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Pagination

> Iterating over collections

List methods return a `PageIterator<T>` that wraps the results and lets you iterate naturally.

## Iterate with for-await

```typescript theme={null}
const page = await client.agents.list();

for await (const agent of page) {
  console.log(agent.name);
}
```

## Collect to an array

```typescript theme={null}
const page = await client.agents.list();
const agents = await page.toArray();
```

## Access the raw data

```typescript theme={null}
const page = await client.agents.list();
console.log(page.data.length);
console.log(page.data[0]);
```
