Skip to main content

addAgent

client.swarm.addAgent(swarmId: string, data: AgentRegistration): Promise<SwarmAgentInfo>

Add an agent to a swarm.

Registers a new agent with the swarm, making it available for assignment to teams and roles. Agents are the worker entities that perform tasks within the swarm context.

Parameters

ParameterTypeRequiredDescription
swarmIdstringYesThe unique identifier of the swarm
dataAgentRegistrationYesThe agent registration information

Returns

Promise<SwarmAgentInfo> — A promise that resolves to the registered SwarmAgentInfo object

Example

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

const client = new CodeBoltClient();

const result = await client.swarm.addAgent('swarmId', /* AgentRegistration */);
console.log(result);