Skip to main content

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 — SynapseClient uses 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

Metadata

Release files for synapse-bus 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for synapse-bus 0.1.0
File Size Uploaded
synapse_bus-0.1.0.tar.gz 15.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for synapse-bus 0.1.0
File Interpreter ABI Platform
synapse_bus-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 33.7 kB

Release files / synapse_bus-0.1.0.tar.gz

Download URL synapse_bus-0.1.0.tar.gz
Size 15.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e2c9a2ffe83c66325e993343eb57865c496ecaa34230a1ed3890d058bf3ee1e6
BLAKE2b-256 checksum
How to use checksums
adb85d0ce3dbbac6b36a76644fd3cded59fe58359496814be24c148c371ef764
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 14, 2026.

Transparency log

Release files / synapse_bus-0.1.0-py3-none-any.whl

Download URL synapse_bus-0.1.0-py3-none-any.whl
Size 18.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f872866e2af6fa69c3ef45e2aed032553afff7a3dbac5640a0fba5cbf892e5c
BLAKE2b-256 checksum
How to use checksums
e524fb18d91fd29d79df1cd00216d2d17cff7d6e20912ef18c54277f8f3632b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 14, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page