Agent Communication

👤 dfshmily 📦 v0.1.1 ⭐ 4.4 ⬇️ 1.3K 下載
🤖 AI-Agent 免費

📖 技能介紹

Agent Communication Skill

一個通用的 Agent 間溝通技能,基於 WebSocket 實現即時雙向通訊,解決多 Agent 團隊協作中的溝通問題。

技術架構

🚀 WebSocket 即時通訊

┌─────────────────────────────────────────────────────┐
│            WebSocket 訊息代理架構                     │
├─────────────────────────────────────────────────────┤
│                                                     │
│   Agent A  ◄────►  WebSocket  ◄────►  Agent B      │
│                     Server                          │
│   Agent C  ◄──────────────────────►  Agent D       │
│                                                     │
│   ✅ 即時雙向通訊                                    │
│   ✅ 無需輪詢                                        │
│   ✅ 延遲 <50ms                                      │
│   ✅ 離線訊息佇列                                    │
└─────────────────────────────────────────────────────┘

核心功能

  • 🚀 WebSocket 即時通訊 - 高效能雙向通訊

    本技能來自小蔥技能站7w4.net。

  • 📨 訊息傳遞 - Agent 之間快速傳送訊息
  • 📢 廣播訊息 - 一次傳送給多個 Agent
  • 🗂️ 共享工作空間 - 檔案驅動的協作
  • 🟢 狀態同步 - Agent 線上狀態檢測
  • 💾 離線訊息 - 離線 Agent 自動排隊

安裝

# 安裝依賴
pip install websockets

# 通過 ClawHub 安裝
openclaw skill install agent-communication

使用方法

1. 啟動訊息代理(WebSocket 伺服器)

python3 scripts/broker.py

2. 傳送訊息

# WebSocket 模式(優先)
python3 scripts/send.py --from pm --to dev --message "開始開發"

# 檔案模式(回退)
python3 scripts/send.py --from pm --to dev --message "開始開發" --file

3. Agent 客戶端連線

import asyncio
from websocket_client import AgentClient

async def main():
    client = AgentClient("pm", "ws://localhost:8765")

    # 連線並監聽
    async def handle_message(msg):
        print(f"收到訊息: {msg}")

    await client.run(handle_message)

asyncio.run(main())

效能指標

指標 檔案方案 WebSocket 方案
延遲 500ms <50ms
即時性 輪詢 即時
CPU 佔用
離線支援

檔案結構

agent-communication/
├── scripts/
│   ├── broker.py           # WebSocket 訊息代理
│   ├── websocket_client.py # Agent 客戶端
│   ├── send.py             # 傳送訊息(智慧選擇)
│   ├── broadcast.py        # 廣播訊息
│   ├── status.py           # 狀態管理
│   └── workspace.py        # 共享工作空間
├── data/
│   ├── messages/           # 訊息儲存
│   ├── status/             # Agent 狀態
│   └── workspace/          # 共享資料
└── templates/
    └── config.json         # 配置檔案

解決的問題

問題 解決方案
sessions_send 超時 WebSocket 即時通訊
Agent 無法直接溝通 訊息代理轉發
團隊協作效率低 即時訊息傳遞

版本

  • 版本: 2.0.0
  • 更新: WebSocket 即時通訊
  • 作者: momoflowers_bot

🤖 AI 評測

這個技能質量較好,功能齊全,文件清晰,測試全部通過。它能實現多個Agent之間的即時通訊,支援訊息傳遞、廣播和狀態同步,還能在對方離線時自動排隊訊息。效能表現不錯,訊息延遲很低。不過使用前需要先啟動訊息代理伺服器,對新手來說可能稍顯複雜。總體來說,這是一個可靠實用的通訊工具,適合需要多Agent協作的場景。

📊 多維度評分

適應性4
規範性4.1
有效性4.7
可靠性4.2
可信度5

📁 包含檔案 (15 個)

📄 .clawhub/origin.json 103 B
📄 README.md 5.7 KB
📄 SKILL.md 3.7 KB
📄 TEST_REPORT.md 2.2 KB
📄 _meta.json 138 B
📄 scripts/broadcast.py 1.7 KB
📄 scripts/broker.py 8 KB
📄 scripts/send.py 3.6 KB
📄 scripts/status.py 2.5 KB
📄 scripts/test_skill.py 3.1 KB
📄 scripts/test_websocket.py 3 KB
📄 scripts/websocket_client.py 6.5 KB
📄 scripts/workspace.py 3.2 KB
📄 skill.json 532 B
📄 templates/config.json 305 B