Skip to main content

getRoleAgents

client.swarm.getRoleAgents(swarmId: string, roleId: string): Promise<SwarmAgentInfo[]>

Get agents assigned to a specific role.

Retrieves all agents that currently have the specified role assigned to them. Use this to view role membership or manage role assignments.

Parameters​

ParameterTypeRequiredDescription
swarmIdstringYesThe unique identifier of the swarm
roleIdstringYesThe unique identifier of the role

Returns​

Promise<SwarmAgentInfo[]> — A promise that resolves to an array of SwarmAgentInfo objects with the role

Example​

import { CodeBoltClient } from '@codebolt/clientsdk';

const client = new CodeBoltClient();

const result = await client.swarm.getRoleAgents('swarmId', 'roleId');
console.log(result);