Skip to main content

createRole

client.swarm.createRole(swarmId: string, data: CreateRoleRequest): Promise<SwarmRole>

Create a role in a swarm.

Creates a new role that agents can be assigned to. Roles define agent responsibilities, permissions, and capabilities within the swarm context.

Parameters​

ParameterTypeRequiredDescription
swarmIdstringYesThe unique identifier of the swarm
dataCreateRoleRequestYesThe role creation information

Returns​

Promise<SwarmRole> — A promise that resolves to the created SwarmRole object

Example​

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

const client = new CodeBoltClient();

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