Consensus & Resolutions
NewUpdated
After setting up a council (see Council Quick Start), you can fine-tune how decisions are made and browse the history of all past resolutions.
In this guide you'll learn how to:
- Configure consensus algorithms
- Browse and filter resolution history
- Deep-dive into resolution audits
Consensus Algorithms
Different algorithms aggregate votes differently. List available options and configure the one that fits your use case.
import { Chaos } from '@chaoslabs/ai-sdk';
const chaos = new Chaos({ apiKey: process.env.CHAOS_API_KEY! });
// List available algorithms
const { algorithms, default_algorithm } = await chaos.council.consensus.algorithms();
for (const algo of algorithms) {
console.log(`${algo.algorithm}: ${algo.description}`);
if (algo.parameters) {
for (const p of algo.parameters) {
console.log(` param: ${p.name} (${p.type}) — ${p.description}`);
}
}
}
console.log(`\nDefault: ${default_algorithm}`);Copy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
Configure Consensus
Set the default consensus algorithm and its parameters.
// Get current config
const current = await chaos.council.consensus.get();
console.log(`Current algorithm: ${current.algorithm}`);
// Update to weighted voting with minimum confidence
const updated = await chaos.council.consensus.set({
algorithm: 'weighted_vote',
parameters: [
{ name: 'min_confidence', value: 0.6 },
],
});
console.log(`Updated to: ${updated.algorithm}`);Copy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
Browse Resolutions
View the history of all council resolutions with pagination and filtering.
const { resolutions, total } = await chaos.council.resolutions.list({
page: 1,
pageSize: 20,
});
console.log(`${total} total resolutions\n`);
for (const r of resolutions) {
console.log(`[${r.status}] ${r.query.slice(0, 60)}...`);
console.log(` Result: ${r.final_result ?? 'pending'}`);
console.log(` Council: ${r.council_name ?? 'ad-hoc'}`);
console.log(` Date: ${r.created_at}\n`);
}Copy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
Audit a Resolution
Dig into exactly how a decision was made — each member's vote, reasoning, confidence, and timing.
const sessionId = resolutions[0].session_id;
// Full detail
const detail = await chaos.council.resolutions.get(sessionId);
console.log(`Query: ${detail.query}`);
console.log(`Final Result: ${detail.finalResult}`);
// Audit trail
const audit = await chaos.council.resolutions.audit(sessionId);
// Summary
console.log(`\nVotes: ${audit.voteTally.completed_votes}/${audit.voteTally.total_votes}`);
for (const [choice, count] of Object.entries(audit.voteTally.choices)) {
const pct = ((count / audit.voteTally.completed_votes) * 100).toFixed(0);
console.log(` ${choice}: ${count} (${pct}%)`);
}
// Detailed votes
for (const vote of audit.memberVotes) {
if (vote.status !== 'completed') continue;
console.log(`\n${vote.model_name} → ${vote.choice}`);
console.log(` Confidence: ${(vote.confidence! * 100).toFixed(0)}%`);
console.log(` Time: ${vote.elapsed_ms}ms`);
console.log(` Reasoning: ${vote.reasoning}`);
}Copy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
Was this helpful?