agentbus
AgentBus
SQLite をバックエンドとした MCP イベントバス & 制御サーフェス。多様なエージェント群(Swarm)向け。
Cursor、Claude、Antigravity、そして Hermes のような Terminal エージェントが同じワークスペースを共有する場合、通常は壊れやすい追記専用ファイル(log.md)で調整します。しかし、SLA タイムアウト、Human-in-the-Loop(HITL)介入、厳格なスキーマ検証、暗号化 RBAC が必要になると、その方法では限界があります。
AgentBus は「伝言ゲーム」を localhost サイドカー に置き換えます。SQLite をバックエンドとした Python MCP サーバーです。オーケストレーターのランタイムに縛られることなく、重いクラウドダッシュボードも不要。最高級の AI オーケストレーション向けに設計された、超高速ローカル pub/sub です。
v0.18.0(2026年8月): MCP Python SDK v2 への移行。v0.12〜v0.16 でリリースされたヘッドレスランナー、非同期サスペンド/レジューム、ウェイクプレーン、耐障害性配信に続くものです。詳細はチェンジログを参照してください。
注: インストールは
okf-agentbusとして行ってください(CLI コマンドはagentbusのまま)。追加機能:[obs,devex,jupyter,sdk]。
⚡ 「アハ体験」:再起動不要の統合
すでに Aider、OpenHands、またはカスタムエージェントを tmux ペインで動かしていますか? セッションを終了しないでください。 AgentBus は二重インターフェース(MCP + CLI)を備えています。今日すぐテストするために JSON 設定を準備する必要はありません。実行中のエージェントに以下のようにプロンプトを出すだけです:
「ターミナルで
agentbus publish --topic okf/handoff --payload '{\"from\":\"grok\",\"to\":\"hermes\",\"summary\":\"Write tests\"}'を実行して。」
SQLite バスは MCP サーバーを必要とせずに即座にそのイベントを捕捉します。Mission Control TUI に納得したら、次回の起動時に強力な型付き MCP サーバーを配線できます。
Related MCP server: Hivemind
AgentBus を選ぶ理由
代替案 | 制限 | AgentBus |
| スキーマなし、競合状態 | 型付きトピック、単調増加 ID、アドバイザリロック |
LangGraph / CrewAI | 同じランタイムに固定 | 異種プロセス外クライアント(IDE + CLI) |
LangSmith | クラウドのみ、過去志向 | ローカル SQLite、未来志向の実行 TUI |
Redis pub/sub | 追加デーモン、複雑なセットアップ | 設定不要の SQLite、ネイティブ stdio MCP |
機能一覧(v0.3〜v0.18)
MCP Python SDK v2(v0.18): 既存のイベントストア契約を維持しながら stdio MCP サーバーを移行。
耐障害性配信(v0.16.4): ジッター付きの上限付きリトライ、リトライ枯渇時のデッドレター、SQLite 競合時のファイルスピルオーバー。
非同期サスペンド/レジューム(v0.16): 永続的な待機と関連付けられたウェイクイベントにより、ヘッドレスエージェントがビジーポーリングなしで制御を譲れる。
ヘッドレスランナー(v0.15): オプトイン型アダプター。異種 CLI エージェント向けに、境界付きチェーン動作と構造化応答を提供。
ウェイクプレーンと Go ヘルパー(v0.12〜v0.13): プラットフォームパッケージ化されたワーカー、ロールリース、ウェイクイングレス、ウェブフック配信。
Jupyter 非同期クライアント(v0.11):
from agentbus.jupyter import AsyncAgentBusおよび%agentbus start— ノートブックのイベントループに制御を譲る非ブロッキングポーリング。TypeScript クライアント(v0.11):
packages/js/agentbus-client— Node EventEmitter & MCP stdio 起動(@agentbus/agentbus-client、現在はパスインストール)。God View Mesh(v0.9): パッシブ OS + MCP 監視により、サイレントエージェントもバスに足跡を残す(
system/mcp、system/fs、system/shell、system/monologue)。Mission Control TUI(v0.8以降): キーボード操作で使えるリッチな
Textualダッシュボード(agentbus monitor)。トレースウォーターフォール、HITL、Wiretap ペイン、Dark Agent 警告。プラグイン可能な Pydantic スキーマ(v0.7): コードファーストの
@bus.topicデコレータで、挿入レイヤーでの厳格な JSON スキーマを強制。分散コンテキスト(v0.6):
--attachで巨大なコンテキスト(git の diff など)を渡す。1MB のハード制限によりコンテキストウィンドウの爆発を防止。エージェント監視(v0.5): ネイティブな OpenTelemetry スタイルの
trace_idとparent_span_idの系統追跡。SLA タイムアウト&デッドレター(v0.4): 幽霊のようなデッドロックを防止。エージェントが群れから消えた場合、SLA タイマーがペイロードを
okf/dead-letterにルーティング。群れの RBAC とドロイド証明(v0.3): 暗号化 JWT/UUID トークンにより、承認されたエージェントのみが制限付きトピックに公開可能。
HITL 介入(v0.3): 危険なペイロード(例:
DROP TABLE)を検出し、TUI 経由で人間のレビューのためにPENDING_APPROVALに配置。
インストール
最速の方法(インストールと IDE の自動配線を一度で行う):
curl -sSL https://raw.githubusercontent.com/onicarps/agentbus/main/install.sh | bashまたは pip で手動インストール:
pip install -U "okf-agentbus[devex,sdk]"
agentbus init --apply --producer-id my-agentJupyter ノートブックの場合:
pip install -U "okf-agentbus[jupyter]"%load_ext agentbus.jupyter
%agentbus start
# or
from agentbus.jupyter import AsyncAgentBus
bus = AsyncAgentBus() # AGENTBUS_WORKSPACE or cwd
bus.on_event(print)
await bus.start_background(interval=1.0)TypeScript(モノレポのチェックアウトから):
cd packages/js/agentbus-client && npm install && npm test
# set AGENTBUS_WORKSPACE + agentbus on PATH, then use createStdioMcpClient / AgentBusクイックスタート&例
AgentBus を最もよく理解するには、コピー&ペースト可能な例を読むのが一番です。
examples/ ディレクトリには、基本的な Pub/Sub から Pydantic スキーマや SLA タイムアウトまで、すべての機能をカバーする 7 つの完璧で独立した Python スクリプトがあります。
# Terminal A — Launch the Mission Control TUI
agentbus monitor
# Terminal B — Publish a handoff
agentbus publish \
--topic okf/handoff \
--payload '{"from":"cursor","to":"hermes","summary":"Write tests"}'God View 監視(v0.9.0):
サイレントエージェントの操作を傍受して追跡:
# Intercept MCP tool calls
mcp-serve --wiretap
# Watch file edits and command executions
agentbus watch
# Tail internal agent reasoning logs
agentbus tailイベントは system/mcp、system/fs、system/shell、system/monologue トピックとして TUI の Wiretap ペインにストリーミングされます。
📦 ワークスペース分離(.agentbus ディレクトリ)
AgentBus は ワークスペース分離 の概念で動作します(git の .git や Docker の docker-compose.yml と同様)。
バスとそのイベントは、実行したディレクトリに物理的にスコープされます。これにより、Swarm が OS 全体を追跡したり、異なるプロジェクト間で相互汚染したりするのを防ぎます。
特定のプロジェクトフォルダに移動して agentbus init または agentbus up を実行すると、そのディレクトリ専用のローカライズされた .agentbus/events.db SQLite データベースが作成されます。
1クリック Swarm オーケストレーション(v0.10.0)
エージェントと監視デーモンを起動するために手動で 5 つの tmux ペインを開く代わりに、新しいオーケストレーターを使用:
cd /path/to/my-project
# 1. Generate a boilerplate .agentbus/swarm.yaml
agentbus up --init
# 2. Boot the swarm (Watchers, Agents, and TUI) in one click
agentbus up
# 3. View running background agents
agentbus ps
# 4. Safely kill the entire swarm
agentbus downドキュメント
完全なアーキテクチャドキュメントは docs/ ディレクトリを参照してください。
ライセンス
MIT — LICENSE を参照。
Available Tools
10 toolsagentbus_approveC
Approve a pending event so agents can see it on poll.
Inputs: event_id (required), auth_token, reviewer_id. Returns: result
agentbus_lock_acquireC
Acquire an exclusive advisory lease on a workspace resource.
Inputs: owner_id (required), resource (required), auth_token, ttl_seconds. Returns: result
agentbus_lock_releaseB
Release a held lease (idempotent if already expired).
Inputs: lease_id (required), owner_id (required), resource (required), auth_token. Returns: result
agentbus_lock_renewC
Extend TTL on an active lease (heartbeat).
Inputs: lease_id (required), owner_id (required), resource (required), auth_token, +1 more. Returns: result
agentbus_lock_statusB
Check lock state without acquiring (no auth required).
Inputs: resource (required). Returns: result
agentbus_pollA
Fetch events after cursor (at-least-once delivery).
Inputs: topic (required), limit, since_id. Returns: result
agentbus_publishC
Append one event to the workspace event log.
Inputs: topic (required), payload (required), action, trace_id, +7 more. Returns: result
agentbus_rejectB
Reject a pending event and notify the originating agent.
Inputs: event_id (required), reason, auth_token, reviewer_id. Returns: result
agentbus_reviewA
List events pending human approval (hidden from standard poll).
Inputs: limit, topic. Returns: result
agentbus_statusB
Workspace bus health and topic list.
Inputs: no named parameters. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Tools are mostly distinct: publish vs poll vs review vs approve/reject are clearly separated, and lockdown tools (acquire/status/release/renew) are distinguishable. Minor potential overlap between poll and review for fetching events, but descriptions clarify that review shows hidden pending events.
Consistent 'agentbus_' prefix with verb_noun patterns for most tools (e.g., lock_acquire, lock_release, lock_renew). Deviations like 'approve' and 'reject' use a single verb, but they remain readable and fit the domain.
10 tools are well-scoped for an agent bus handling event approval, polling, publishing, and lock leasing. Each tool appears to serve a distinct purpose with no redundancy.
Covers the full lifecycle: publish, poll, review, approve/reject, status, and lock management (acquire, status, renew, release). No obvious gaps for the stated event bus and lock leasing domain.
Maintenance
Related MCP Connectors
Private-by-default, local-first memory/context/task orchestrator for MCP apps and agents.
An agent-native database over MCP: shared, validated, structured records in every AI chat.
System-of-record notebook for AI coding agents: pages, datastores, tasks, skills over MCP.
Persistent, inspectable memory for AI agents with lineage, correction, and a hosted MCP endpoint.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceLocal-first MCP server that enables multiple Claude agents to coordinate through a shared message bus with SQLite persistence and real-time clock anchoring.MIT
- FlicenseNot gradedqualityDmaintenancePersistent, append-only event log for AI agent coordination, enabling agents to publish, query, and react to structured events across tools and sessions.1-
- FlicenseNot gradedqualityDmaintenanceSQLite-backed MCP server for Claude Code session persistence and multi-agent coordination. Provides tools for session management, event logging, decision tracking, file locking, agent registry, and plan tracking.-
- AlicenseNot gradedqualityFmaintenanceLocal-first, auditable memory for AI agents. Provides durable context for MCP hosts with SQLite storage, CLI, and MCP tools for memory management.2Apache 2.0