Agent-to-Agent Communication Layer — Real-time message bus for AI agents with pub/sub, WebSocket streaming, and MCP integration.
Project description
Synapse
Agent-to-Agent Communication Layer — Real-time message bus for AI agents.
Synapse is a lightweight pub/sub message bus designed for multi-agent AI systems. It provides real-time communication between AI agents via REST API, WebSocket streaming, and MCP (Model Context Protocol) integration.
Features
- Pub/Sub Message Bus — Channel-based messaging with priority levels and message types
- Agent Registry — Auto-discovery, heartbeat monitoring, capability-based routing
- WebSocket Streaming — Real-time push to connected agents
- SQLite Persistence — Messages survive restarts, queryable history
- MCP Server — Native integration with Claude Code and other MCP clients
- Web Dashboard — Live monitoring at
/dashboard - Zero Dependencies Client —
SynapseClientuses only stdlib (urllib)
Quick Start
pip install synapse-bus
Start the Server
synapse-server
# → Synapse bus running on http://localhost:8200
Connect an Agent
from synapse import SynapseClient, Priority
client = SynapseClient("my-agent")
client.register(capabilities=["analysis"], channels=["#alerts"])
# Publish a message
client.publish("#alerts", {"status": "online"})
# Send a critical alert
client.alert("Something went wrong!")
# Read inbox
messages = client.inbox()
# Get bus health
print(client.health())
Use as MCP Server
Add to your Claude Code config (~/.claude.json):
{
"mcpServers": {
"synapse": {
"command": "synapse-mcp",
"args": []
}
}
}
This gives Claude Code 7 tools: synapse_publish, synapse_inbox, synapse_agents, synapse_channels, synapse_history, synapse_alert, synapse_command.
Architecture
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Agent A │ │ Agent B │ │ Agent C │
│ (Trading) │ │ (Analysis) │ │ (Assistant) │
└──────┬───────┘ └──────┬───────┘ └──────┬───────┘
│ HTTP/WS │ HTTP/WS │ MCP
└────────────┬───────┴────────────────────┘
│
┌───────▼───────┐
│ Synapse Bus │
│ (FastAPI) │
├────────────────┤
│ #alerts │
│ #market-data │
│ #commands │
│ #system │
│ #heartbeat │
│ (custom...) │
├────────────────┤
│ SQLite Store │
└────────────────┘
API
REST Endpoints
| Method | Endpoint | Description |
|---|---|---|
POST |
/agents/register |
Register an agent |
POST |
/agents/{name}/heartbeat |
Send heartbeat |
GET |
/agents |
List all agents |
GET |
/agents/{name} |
Get agent details |
POST |
/publish |
Publish a message |
POST |
/subscribe |
Subscribe to a channel |
GET |
/inbox/{agent} |
Get agent inbox |
GET |
/channels |
List channels |
GET |
/history/{channel} |
Get message history |
GET |
/health |
Bus health & stats |
GET |
/dashboard |
Web dashboard |
WebSocket
Connect to /ws/{agent_name} for real-time streaming:
const ws = new WebSocket("ws://localhost:8200/ws/my-agent");
ws.onmessage = (event) => console.log(JSON.parse(event.data));
// Publish via WebSocket
ws.send(JSON.stringify({
action: "publish",
channel: "#alerts",
payload: { message: "Hello from WS" }
}));
Message Model
SynapseMessage(
channel="#alerts", # Target channel
sender="my-agent", # Sender name
payload={"key": "value"}, # Arbitrary dict
type=MessageType.EVENT, # alert|data|command|query|response|event
priority=Priority.NORMAL, # 0=CRITICAL, 1=HIGH, 2=NORMAL, 3=LOW, 4=BACKGROUND
ttl=0, # Seconds until expiry (0=never)
)
Default Channels
| Channel | Purpose |
|---|---|
#alerts |
Critical notifications |
#market-data |
Trading signals, prices |
#learning |
AI insights, patterns |
#commands |
Direct instructions |
#heartbeat |
Agent health (automatic) |
#system |
Bus internal events |
Development
git clone https://github.com/engram-memory/synapse.git
cd synapse
pip install -e ".[dev]"
pytest
Part of the Engram Ecosystem
Synapse is the communication backbone for Engram — the universal memory layer for AI agents. Together they enable persistent, communicating multi-agent systems.
License
MIT
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 synapse_bus-0.1.0.tar.gz.
File metadata
- Download URL: synapse_bus-0.1.0.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2c9a2ffe83c66325e993343eb57865c496ecaa34230a1ed3890d058bf3ee1e6
|
|
| MD5 |
9d496d440324429a049dac82210463f6
|
|
| BLAKE2b-256 |
adb85d0ce3dbbac6b36a76644fd3cded59fe58359496814be24c148c371ef764
|
Provenance
The following attestation bundles were made for synapse_bus-0.1.0.tar.gz:
Publisher:
publish.yml on engram-memory/synapse
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
synapse_bus-0.1.0.tar.gz -
Subject digest:
e2c9a2ffe83c66325e993343eb57865c496ecaa34230a1ed3890d058bf3ee1e6 - Sigstore transparency entry: 952374075
- Sigstore integration time:
-
Permalink:
engram-memory/synapse@c1e8076a0ad78ef15a0a3a0b3183dda311be0d7d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/engram-memory
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c1e8076a0ad78ef15a0a3a0b3183dda311be0d7d -
Trigger Event:
release
-
Statement type:
File details
Details for the file synapse_bus-0.1.0-py3-none-any.whl.
File metadata
- Download URL: synapse_bus-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f872866e2af6fa69c3ef45e2aed032553afff7a3dbac5640a0fba5cbf892e5c
|
|
| MD5 |
bc6525efd254150a71c91465da16d26d
|
|
| BLAKE2b-256 |
e524fb18d91fd29d79df1cd00216d2d17cff7d6e20912ef18c54277f8f3632b0
|
Provenance
The following attestation bundles were made for synapse_bus-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on engram-memory/synapse
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
synapse_bus-0.1.0-py3-none-any.whl -
Subject digest:
2f872866e2af6fa69c3ef45e2aed032553afff7a3dbac5640a0fba5cbf892e5c - Sigstore transparency entry: 952374076
- Sigstore integration time:
-
Permalink:
engram-memory/synapse@c1e8076a0ad78ef15a0a3a0b3183dda311be0d7d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/engram-memory
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c1e8076a0ad78ef15a0a3a0b3183dda311be0d7d -
Trigger Event:
release
-
Statement type: