Local MCP event log for multi-agent workspaces
Project description
AgentBus
Local MCP event log and advisory lease coordinator for multi-agent workspaces.
When Cursor, Claude Code, Antigravity, Hermes, and other agents share a workspace, they usually coordinate through append-only files (log.md, sticky notes, Slack). That works until you need ordering, idempotency, cursors, schema validation, or file-edit mutexes.
AgentBus is a localhost sidecar: a Python MCP server backed by SQLite. Agents publish structured events; peers poll with since_id cursors. Advisory lease locks prevent concurrent edits. No orchestrator runtime lock-in.
v0.2 (July 2026): Events + advisory lease locks —
publish,poll,status,lock_*. SSE subscribe and custom topics on the roadmap.
Note: PyPI names
agentbus(NATS) andagentbus-mcp(blocked as too similar) are unavailable. Install asokf-agentbus(CLI command remainsagentbus).
Why AgentBus?
| Alternative | Limitation | AgentBus |
|---|---|---|
log.md blackboard |
No schema, races, manual cursors | Typed topics, monotonic IDs, poll API |
flock / git mutex |
No agent identity, no TTL | Advisory leases with heartbeat renewal |
| Redis pub/sub | Extra daemon, no MCP path | stdio MCP — works in existing IDEs |
| LangGraph / AutoGen | Same-runtime only | Heterogeneous out-of-process clients |
Install
pip install okf-agentbus
# Or from GitHub
pip install "okf-agentbus @ git+https://github.com/onicarps/agentbus@v0.2.3"
# Or clone for development
git clone https://github.com/onicarps/agentbus.git
cd agentbus
python3 -m venv .venv
.venv/bin/pip install -e ".[dev]"
Quickstart
export AGENTBUS_WORKSPACE=/path/to/workspace
export AGENTBUS_PRODUCER_ID=my-agent
# Terminal A — MCP server (stdio)
agentbus serve --workspace "$AGENTBUS_WORKSPACE"
# Terminal B — publish a handoff
agentbus publish \
--topic okf/handoff \
--payload '{"from":"my-agent","to":"peer","summary":"Hello bus"}'
# Poll events
agentbus poll --topic okf/handoff --since-id 0
# Acquire an advisory lease before editing a shared file
agentbus lock acquire --resource "$AGENTBUS_WORKSPACE/log.md" --owner-id my-agent
agentbus lock status --resource "$AGENTBUS_WORKSPACE/log.md"
agentbus lock release --resource "$AGENTBUS_WORKSPACE/log.md" --lease-id <uuid> --owner-id my-agent
MCP setup
Use scripts/mcp-serve.sh so the workspace token is injected automatically:
{
"mcpServers": {
"agentbus": {
"command": "/path/to/agentbus/scripts/mcp-serve.sh",
"env": {
"AGENTBUS_WORKSPACE": "/path/to/workspace",
"AGENTBUS_PRODUCER_ID": "cursor"
}
}
}
}
Client-specific templates:
| Client | Config |
|---|---|
| Cursor | examples/mcp-cursor.json |
| Claude Desktop | examples/mcp-claude-desktop.json |
| Hermes | examples/mcp-hermes.json |
MCP tools
| Tool | Auth | Purpose |
|---|---|---|
agentbus_publish |
Yes | Append one validated event |
agentbus_poll |
No | Fetch events after since_id (at-least-once) |
agentbus_status |
No | Event counts, topics, health |
agentbus_lock_acquire |
Yes | Exclusive advisory lease on a resource path |
agentbus_lock_release |
Yes | Release a held lease |
agentbus_lock_renew |
Yes | Extend TTL (heartbeat) |
agentbus_lock_status |
No | Check lock state without acquiring |
Documentation
For full documentation, see the docs/ directory:
- MCP Schema & Event Reference
- Authentication
- Lease Locks Architecture
- End-to-End Walkthrough - Learn how a PM, Engineer, and QA agent coordinate.
- Client Capability Matrix - See how Cursor, Claude, and Antigravity compare.
Authentication
On serve, AgentBus writes an ephemeral token to {workspace}/.agentbus/token (mode 0600). Publish and lock mutations require a matching token via:
scripts/mcp-serve.sh(recommended for MCP — reads workspace file, not stale env)AGENTBUS_TOKENenvironment variable--tokenCLI flagauth_tokenMCP tool argument (optional; omit when usingmcp-serve.sh)
Poll, status, and lock_status remain open. Set AGENTBUS_AUTH=off to disable during local development.
Details: docs/AUTH.md
Topics (v0.2)
| Topic | Purpose |
|---|---|
okf/handoff |
Structured agent handoff (from, to, summary) |
okf/status/<name> |
Status ping (idle, active, blocked, complete) |
Custom topics are planned — contributions welcome.
CLI reference
agentbus serve [--workspace PATH] [--rotate-token]
agentbus publish --topic TOPIC --payload JSON [--producer-id ID]
agentbus poll --topic TOPIC [--since-id N] [--limit N]
agentbus status [--producer-id ID]
agentbus token show|ensure|rotate
agentbus lock acquire|release|renew|status
agentbus project-log [--log-file log.md] # optional markdown projection
Set AGENTBUS_WORKSPACE to avoid repeating --workspace.
Development
.venv/bin/pytest tests/ -q # 40+ tests
.venv/bin/pytest tests/ --cov=agentbus --cov-report=term-missing
Project layout
src/agentbus/ # Python package
tests/ # pytest suite (40 tests)
docs/ # MCP schema, auth guide
examples/ # MCP client configs (Cursor, Claude, Hermes)
scripts/ # mcp-serve.sh wrapper
Roadmap
See ROADMAP.md. v0.2 ships events + advisory locks; v0.3 targets custom topics and HTTP transport.
Contributing
We want real-world use cases from teams running heterogeneous agent stacks. See CONTRIBUTING.md.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file okf_agentbus-0.4.0.tar.gz.
File metadata
- Download URL: okf_agentbus-0.4.0.tar.gz
- Upload date:
- Size: 39.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47b858acd8a921131c2d8b6b6dda60868842221b6e534fa37d9fd08ae0b7f7c9
|
|
| MD5 |
fc6075d036f6cfffe4f552a9aca366c7
|
|
| BLAKE2b-256 |
101162c35c8861eeed6a2c2397ee29f5234f17e1f6b3eadfe12834dafbcbe64f
|
File details
Details for the file okf_agentbus-0.4.0-py3-none-any.whl.
File metadata
- Download URL: okf_agentbus-0.4.0-py3-none-any.whl
- Upload date:
- Size: 28.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a8a64e2aaaeec13341a04a9e7ee95869a558d51de18e750993c4b6982d7bd52
|
|
| MD5 |
c83971aa5ee9529d9f72d0ccc6d78a83
|
|
| BLAKE2b-256 |
edb1ce68806d0fdf0ae00ad19589c47f139cc67d2a831e2772242a0fcfc08806
|