Consensus & Voting
Open Astra supports multi-agent consensus building with configurable voting strategies. Agents vote on proposals with reasoning, and the system resolves outcomes based on the chosen strategy.
Consensus rounds
A consensus round has a topic, participants, and a required majority threshold (default 66.7%).
bash
# Start a consensus round
curl -X POST http://localhost:3000/consensus/rounds \
-H "Authorization: Bearer ${JWT_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"topic": "Should we migrate from REST to GraphQL?",
"description": "Evaluate trade-offs for our current API surface",
"participants": ["arch-agent", "api-agent", "frontend-agent"],
"requiredMajority": 0.667
}'Casting votes
Votes can be agree, disagree, or abstain. Each vote includes reasoning.
bash
# Cast a vote
curl -X POST http://localhost:3000/consensus/rounds/cr_abc123/votes \
-H "Authorization: Bearer ${JWT_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"agentId": "arch-agent",
"vote": "agree",
"reasoning": "GraphQL reduces over-fetching and simplifies frontend queries"
}'
# Resolve the round
curl -X POST http://localhost:3000/consensus/rounds/cr_abc123/resolve \
-H "Authorization: Bearer ${JWT_TOKEN}"Resolution logic
- Approved: agrees ≥ ceil(totalVoters × requiredMajority)
- Rejected: disagrees > totalVoters - threshold
- Failed: neither condition met
Voting strategies
For programmatic voting (used internally by swarms and debate protocols):
text
// Voting strategies available via conductVote()
"majority" — simple majority (> 50%)
"unanimous" — all votes must agree (margin = 1)
"weighted" — votes weighted by confidence (margin > 0.3 = consensus)
"ranked" — Borda count ranking (margin > 0.2 = consensus)Endpoint reference
| Method | Endpoint | Description |
|---|---|---|
POST | /consensus/rounds | Start a round |
GET | /consensus/rounds | List rounds |
GET | /consensus/rounds/:id | Get round details |
POST | /consensus/rounds/:id/votes | Cast a vote |
POST | /consensus/rounds/:id/resolve | Resolve the round |
Defaults
| Field | Default | Range |
|---|---|---|
requiredMajority | 0.667 (66.7%) | 0.5–1.0 |
participants | — | Minimum 1 agent |