# Work with FAssets Agents

> List FAssets agents and read an agent's public details.

> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.

Source: https://dev.flare.network/fassets/developer-guides/fassets-agents

Agents hold collateral and pay redemptions. These examples use the FXRP Asset Manager on Coston2.

## List agents[​](#list-agents "Direct link to List agents")

[`AssetManager`](/fassets/reference/IAssetManager) exposes three list functions:

-   [`getAllAgents`](/fassets/reference/IAssetManager#getallagents) returns every agent, available or not, with basic information.
-   [`getAvailableAgentsList`](/fassets/reference/IAssetManager#getavailableagentslist) returns agents that are accepting work, with basic information.
-   [`getAvailableAgentsDetailedList`](/fassets/reference/IAssetManager#getavailableagentsdetailedlist) returns available agents with collateral ratios, fees, and vault status.

Public Core Vault minting does not ask the user to pick an agent. These lists are for agent UIs, monitoring, and the archived collateral-reservation flow.

Each function takes `_start` and `_end` and returns `_agents` plus `_totalLength`. `_start` is inclusive and `_end` is exclusive. `getAllAgents(0, 3)` returns agents at indexes 0, 1, and 2.

### Prerequisites[​](#prerequisites "Direct link to Prerequisites")

-   [FAssets overview](/fassets/overview).
-   [`@flarenetwork/flare-periphery-contracts`](https://www.npmjs.com/package/@flarenetwork/flare-periphery-contracts).

### Script[​](#script "Direct link to Script")

Fetch available agents in chunks so a long list does not time out the RPC.

scripts/fassets/listAgents.ts

```
import { getAssetManagerFXRP } from "../utils/getters";/** * Script to list all available FAssets agents in chunks * * This script demonstrates how to iterate through all agents in the FAssets system * by fetching them in chunks to avoid overwhelming the RPC endpoint with large requests. * * Run with: yarn hardhat run scripts/fassets/listAgents.ts --network coston2 */async function main() {  // 1. Get the FAssets FXRP asset manager contract instance  const assetManager = await getAssetManagerFXRP();  // 2. Define how many agents to fetch per request  // Using smaller chunks (e.g., 3) helps avoid RPC timeout issues  const chunkSize = 3;  // 3. Fetch the first chunk and get the total count  // The _totalLength property tells us how many agents exist in total  console.log("Fetching first chunk with offset 0 and chunk size " + chunkSize);  const firstChunk = await assetManager.getAvailableAgentsList(0, chunkSize);  console.log(firstChunk._agents);  const totalLength = Number(BigInt(firstChunk._totalLength).toString());  console.log(`Total number of agents: ${totalLength}`);  // 4. Iterate through remaining agents in chunks  // The getAvailableAgentsDetailedList(start, end) function uses:  // - start: inclusive start index (0-based)  // - end: exclusive end index (like array slicing)  // Example: (0, 3) returns agents at indices 0, 1, 2  for (let offset = chunkSize; offset < totalLength; offset += chunkSize) {    // Calculate end index, ensuring we don't exceed totalLength    const endIndex = Math.min(offset + chunkSize, totalLength);    console.log(      `\n--- Fetching agents ${offset} to ${endIndex - 1} (end index ${endIndex} exclusive) ---`,    );    // Fetch the chunk of agents    const agents = await assetManager.getAvailableAgentsList(offset, endIndex);    console.log(agents._agents);  }  console.log(`\nCompleted processing all ${totalLength} agents`);}main().catch((error) => {  console.error(error);  process.exitCode = 1;});
```

1.  Resolve the FXRP Asset Manager with `getAssetManagerFXRP()` from the periphery package.
2.  Set `chunkSize` to `3`. Raise or lower it for your RPC.
3.  Call `getAvailableAgentsList(0, chunkSize)`. `_totalLength` is the full count.
4.  Walk the rest of the list from `offset = chunkSize`, with `endIndex = min(offset + chunkSize, totalLength)`.

The same paging works for [`getAllAgents`](/fassets/reference/IAssetManager#getallagents) and [`getAvailableAgentsDetailedList`](/fassets/reference/IAssetManager#getavailableagentsdetailedlist).

```
yarn hardhat run scripts/fassets/listAgents.ts --network coston2
```

## Read agent details[​](#read-agent-details "Direct link to Read agent details")

[`AgentOwnerRegistry`](/fassets/reference/IAgentOwnerRegistry) stores the public profile for an agent's management address:

-   **Name** from [`getAgentName`](/fassets/reference/IAgentOwnerRegistry#getagentname).
-   **Description** from [`getAgentDescription`](/fassets/reference/IAgentOwnerRegistry#getagentdescription).
-   **Icon URL** from [`getAgentIconUrl`](/fassets/reference/IAgentOwnerRegistry#getagenticonurl).
-   **Terms of use URL** from [`getAgentTermsOfUseUrl`](/fassets/reference/IAgentOwnerRegistry#getagenttermsofuseurl).

The registry address is `getSettings().agentOwnerRegistry` on the Asset Manager.

```
import {IAssetManager} from "@flarenetwork/flare-periphery-contracts/coston2/IAssetManager.sol";import {ContractRegistry} from "@flarenetwork/flare-periphery-contracts/coston2/ContractRegistry.sol";import {IAgentOwnerRegistry} from "@flarenetwork/flare-periphery-contracts/coston2/IAgentOwnerRegistry.sol";IAssetManager assetManager = ContractRegistry.getAssetManagerFXRP();IAgentOwnerRegistry registry = IAgentOwnerRegistry(    assetManager.getSettings().agentOwnerRegistry);
```

```
function getAgentDetails(address _managementAddress)    external    view    returns (        string memory name,        string memory description,        string memory iconUrl,        string memory termsOfUseUrl    ){    IAssetManager assetManager = ContractRegistry.getAssetManagerFXRP();    IAgentOwnerRegistry registry = IAgentOwnerRegistry(        assetManager.getSettings().agentOwnerRegistry    );    name = registry.getAgentName(_managementAddress);    description = registry.getAgentDescription(_managementAddress);    iconUrl = registry.getAgentIconUrl(_managementAddress);    termsOfUseUrl = registry.getAgentTermsOfUseUrl(_managementAddress);}
```

The [Flare Hardhat Starter Kit](/network/guides/hardhat-foundry-starter-kit) includes a full example.

What's next

-   [Mint FXRP](/fassets/developer-guides/fassets-mint).
-   [Redeem FXRP](/fassets/developer-guides/fassets-redeem-amount).
-   [FAssets operational parameters](/fassets/operational-parameters).
