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
| Method | HTTP | Endpoint | Returns |
|---|---|---|---|
create(params) | POST | /v1/council/councils | Council |
list() | GET | /v1/council/councils | Council[] |
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()).
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}`);
}
}Copy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
CreateCouncilParams
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Display name for the council |
member_ids | string[] | Yes | Array of member IDs to include |
consensus_algorithm | string | Yes | Algorithm identifier |
consensus_parameters | Array<{ name: string; value: unknown }> | No | Algorithm-specific tuning parameters |
List Councils
Retrieve all councils for your account.
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}`);
}Copy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
Get, Update, Delete
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');Copy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
UpdateCouncilParams
All fields are optional. Only include the fields you want to change.
| Field | Type | Description |
|---|---|---|
name | string | Updated council name |
member_ids | string[] | Replacement member roster (full list) |
consensus_algorithm | string | Updated algorithm identifier |
consensus_parameters | Array<{ name: string; value: unknown }> | Updated algorithm parameters |
Council
The response object returned by create, get, update, and list operations.
| Field | Type | Description |
|---|---|---|
id | string | Unique council identifier |
name | string | Display name |
consensus_algorithm | string | Active consensus algorithm |
consensus_parameters | ConsensusParameter[] | null | Algorithm parameters |
members | CouncilMember[] | Full member objects in this council |
resolution_count | number | Total resolutions performed by this council |
created_at | string | ISO 8601 creation timestamp |
updated_at | string | ISO 8601 last update timestamp |
Was this helpful?