← 返回
未分类 中文

Pilot Consensus

Distributed voting and agreement protocols for multi-agent decision making. Use this skill when: 1. Multiple agents need to agree on a value or decision 2. Y...
Distributed voting and agreement protocols for multi-agent decision making. Use this skill when: 1. Multiple agents need to agree on a value or decision 2. Y...
teoslayer teoslayer 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 353
下载
💾 0
安装
1
版本
#latest

概述

pilot-consensus

Implement distributed consensus protocols for multi-agent coordination.

Commands

Propose a value

PROPOSAL_ID=$(uuidgen)
pilotctl --json publish "registry-hostname" "consensus:$CONSENSUS_GROUP" \
  --data "{\"type\":\"proposal\",\"id\":\"$PROPOSAL_ID\",\"proposer\":\"$AGENT_ID\",\"value\":$PROPOSAL_VALUE,\"term\":$CURRENT_TERM}"

Vote on a proposal

pilotctl --json send-message "$PROPOSER_ADDRESS" \
  --data "{\"type\":\"vote\",\"proposal_id\":\"$PROPOSAL_ID\",\"voter\":\"$AGENT_ID\",\"approve\":true,\"term\":$CURRENT_TERM}"

Collect votes and check quorum

VOTES=$(pilotctl --json received | jq '[.messages[] | select(.payload.type == "vote" and .payload.proposal_id == "'$PROPOSAL_ID'")]')
APPROVALS=$(echo "$VOTES" | jq '[.[] | select(.payload.approve == true)] | length')
QUORUM=$(( ($TOTAL_VOTERS / 2) + 1 ))

if [ "$APPROVALS" -ge "$QUORUM" ]; then
  echo "Consensus reached"
fi

Workflow Example

Three-phase consensus protocol:

#!/bin/bash
CONSENSUS_GROUP="config-update"
PROPOSAL_VALUE='{"max_workers":10}'
REGISTRY_HOST="registry.example.com"

# Phase 1: Prepare
PROPOSAL_ID=$(uuidgen)
pilotctl --json publish "$REGISTRY_HOST" "consensus:$CONSENSUS_GROUP" \
  --data "{\"type\":\"prepare\",\"id\":\"$PROPOSAL_ID\",\"value\":$PROPOSAL_VALUE,\"term\":$CURRENT_TERM}"

# Phase 2: Vote
sleep 3
VOTES=$(pilotctl --json received | jq '[.messages[] | select(.payload.type == "vote")]')
APPROVALS=$(echo "$VOTES" | jq '[.[] | select(.payload.approve == true)] | length')

# Phase 3: Commit
if [ "$APPROVALS" -ge "$QUORUM" ]; then
  pilotctl --json publish "$REGISTRY_HOST" "consensus:$CONSENSUS_GROUP" \
    --data "{\"type\":\"commit\",\"proposal_id\":\"$PROPOSAL_ID\",\"value\":$PROPOSAL_VALUE}"
fi

Dependencies

Requires pilot-protocol skill, jq, and uuidgen.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-07 16:49 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

it-ops-security

Pilot Priority Queue

teoslayer
基于Pilot协议网络的优先级消息传递,支持紧急程度级别。适用场景:1. 需要处理带优先级的紧急消息...
★ 0 📥 558
ai-agent

Agent Browser

rez0
用于 AI 代理的浏览器自动化 CLI。当用户需要与网站交互(包括浏览页面、填写表单、点击按钮、截图等)时使用。
★ 871 📥 349,519
ai-agent

self-improving agent

pskoett
记录自身发现以实现自我改进的技能
★ 4,171 📥 943,480