Skip to main content

getAgentsByStatus

client.swarm.getAgentsByStatus(swarmId: string, status: string): Promise<SwarmAgentInfo[]>

Get agents filtered by status in a swarm.

Retrieves all agents in a swarm that match a specific status, such as all available agents or all agents in error state. This is useful for finding agents ready for task assignment.

Parameters​

ParameterTypeRequiredDescription
swarmIdstringYesThe unique identifier of the swarm
statusstringYesThe status to filter by (available, busy, offline, etc.)

Returns​

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

Example​

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

const client = new CodeBoltClient();

const result = await client.swarm.getAgentsByStatus('swarmId', 'status');
console.log(result);