Councils

Updated

The chaos.council.councils sub-namespace manages councils -- named groups of AI members paired with a consensus algorithm. Once created, a council can be referenced by ID when resolving queries, providing a reusable configuration for repeated deliberations.

Method Reference

MethodHTTPEndpointReturns
create(params)POST/v1/council/councilsCouncil
list()GET/v1/council/councilsCouncil[]
get(councilId)GET/v1/council/councils/{councilId}Council
update(councilId, params)PUT/v1/council/councils/{councilId}Council
delete(councilId)DELETE/v1/council/councils/{councilId}void

Create a Council

Group existing members into a council with a specified consensus algorithm. You must provide the member IDs (from council.members.create() or council.members.bulkCreate()) and a consensus algorithm (from council.consensus.algorithms()).

create-council.ts
import { Chaos } from '@chaoslabs/ai-sdk';
 
const chaos = new Chaos({ apiKey: process.env.CHAOS_API_KEY! });
 
// Create a council with majority vote
const council = await chaos.council.councils.create({
  name: 'DeFi Risk Board',
  member_ids: ['mem-abc123', 'mem-def456', 'mem-ghi789'],
  consensus_algorithm: 'majority_vote',
});
 
console.log(`Council: ${council.name} (${council.id})`);
console.log(`Algorithm: ${council.consensus_algorithm}`);
console.log(`Members: ${council.members.length}`);
console.log(`Created: ${council.created_at}`);
 
// Create a council with weighted vote and custom parameters
const weighted = await chaos.council.councils.create({
  name: 'Lending Parameter Committee',
  member_ids: ['mem-abc123', 'mem-def456', 'mem-ghi789'],
  consensus_algorithm: 'weighted_vote',
  consensus_parameters: [
    { name: 'min_confidence', value: 0.6 },
  ],
});
 
console.log(`Parameters:`);
if (weighted.consensus_parameters) {
  for (const p of weighted.consensus_parameters) {
    console.log(`  ${p.name}: ${p.value}`);
  }
}

CreateCouncilParams

FieldTypeRequiredDescription
namestringYesDisplay name for the council
member_idsstring[]YesArray of member IDs to include
consensus_algorithmstringYesAlgorithm identifier
consensus_parametersArray<{ name: string; value: unknown }>NoAlgorithm-specific tuning parameters

List Councils

Retrieve all councils for your account.

list-councils.ts
import { Chaos } from '@chaoslabs/ai-sdk';
 
const chaos = new Chaos({ apiKey: process.env.CHAOS_API_KEY! });
 
const councils = await chaos.council.councils.list();
 
for (const c of councils) {
  console.log(`${c.name} (${c.id})`);
  console.log(`  Algorithm: ${c.consensus_algorithm}`);
  console.log(`  Members: ${c.members.map(m => m.name).join(', ')}`);
  console.log(`  Resolutions: ${c.resolution_count}`);
  console.log(`  Updated: ${c.updated_at}`);
}

Get, Update, Delete

manage-councils.ts
import { Chaos } from '@chaoslabs/ai-sdk';
 
const chaos = new Chaos({ apiKey: process.env.CHAOS_API_KEY! });
 
// Get a specific council
const council = await chaos.council.councils.get('council-abc123');
console.log(`${council.name}: ${council.members.length} members, ${council.resolution_count} resolutions`);
 
// Update the council name
const renamed = await chaos.council.councils.update('council-abc123', {
  name: 'Senior DeFi Risk Board',
});
 
// Replace the member roster
const recomposed = await chaos.council.councils.update('council-abc123', {
  member_ids: ['mem-abc123', 'mem-new456', 'mem-new789', 'mem-new012'],
});
 
// Switch the consensus algorithm
const switched = await chaos.council.councils.update('council-abc123', {
  consensus_algorithm: 'weighted_vote',
  consensus_parameters: [{ name: 'min_confidence', value: 0.8 }],
});
 
// Delete a council
await chaos.council.councils.delete('council-abc123');
[@portabletext/react] Unknown block type "callout", specify a component for it in the `components.types` prop

UpdateCouncilParams

All fields are optional. Only include the fields you want to change.

FieldTypeDescription
namestringUpdated council name
member_idsstring[]Replacement member roster (full list)
consensus_algorithmstringUpdated algorithm identifier
consensus_parametersArray<{ name: string; value: unknown }>Updated algorithm parameters

Council

The response object returned by create, get, update, and list operations.

FieldTypeDescription
idstringUnique council identifier
namestringDisplay name
consensus_algorithmstringActive consensus algorithm
consensus_parametersConsensusParameter[] | nullAlgorithm parameters
membersCouncilMember[]Full member objects in this council
resolution_countnumberTotal resolutions performed by this council
created_atstringISO 8601 creation timestamp
updated_atstringISO 8601 last update timestamp
Was this helpful?