Skip to main content

A lightweight, broker-agnostic message bus designed specifically for AI Agents

Project description

AMB - Agent Message Bus

PyPI version License: MIT CI

Broker-agnostic message transport for decoupled agent communication. Part of the Agent OS ecosystem.

Why AMB?

In multi-agent systems, tight coupling between agents creates dependency graphs that scale exponentially with system size. When Agent A must know about Agent B, C, and D to communicate, the system becomes rigid and unmaintainable.

We built amb because direct agent coupling creates spaghetti code. The solution: Scale by Subtraction.

By removing the requirement for agents to know about each other, we eliminate O(nยฒ) dependencies and replace them with O(1) broadcast semantics. Agents emit signals ("I am thinking", "I need verification") without knowing who listens. The bus stays dumb and fastโ€”it just transports the envelope.

Installation

pip install amb-core

For production deployments with Redis, RabbitMQ, or Kafka:

pip install amb-core[redis]      # Redis support
pip install amb-core[rabbitmq]   # RabbitMQ support
pip install amb-core[kafka]      # Kafka support
pip install amb-core[all]        # All adapters

Quick Start

import asyncio
from amb_core import MessageBus, Message

async def main():
    async with MessageBus() as bus:
        async def handler(msg: Message): print(msg.payload)
        await bus.subscribe("agent.events", handler)
        await bus.publish("agent.events", {"status": "ready"})
        await asyncio.sleep(0.1)

asyncio.run(main())

Features

๐Ÿšฆ Priority Lanes

Tag messages as CRITICAL (Security/Governance) vs BACKGROUND (Memory consolidation). Critical messages jump the queue.

# Critical security alert - jumps ahead
await bus.publish(
    "agent.alerts", 
    {"alert": "Security anomaly detected"},
    priority=MessagePriority.CRITICAL
)

# Background task - processed when system is idle
await bus.publish(
    "agent.tasks",
    {"task": "Memory consolidation"},
    priority=MessagePriority.BACKGROUND
)

Priority Levels: CRITICAL > URGENT > HIGH > NORMAL > LOW > BACKGROUND

๐ŸŒŠ Backpressure Protocols

Implements Reactive Streams-style flow control. If a consumer is slow, the producer automatically slows down.

# Configure backpressure parameters
broker = InMemoryBroker(
    max_queue_size=1000,           # Max messages per topic
    backpressure_threshold=0.8,    # Activate at 80% capacity
    backpressure_delay=0.01        # 10ms delay when active
)

bus = MessageBus(adapter=broker)

# If 100 agents spam the bus, backpressure prevents crashes
for agent_id in range(100):
    await bus.publish("agent.events", {"agent": agent_id})
# Producer automatically throttles when consumer is overwhelmed

Scale by Subtraction: No external load balancer needed. The bus handles flow control automatically.

๐Ÿ” OpenTelemetry Tracing (The "X-Ray")

Built-in distributed tracing for debugging multi-agent workflows. When an SDLC agent fails, trace the flow: Thought โ†’ Message โ†’ Tool Call โ†’ Error across all agents.

from amb_core import MessageBus, get_tracer, initialize_tracing

# Initialize tracing (usually done once at startup)
initialize_tracing("my-agent-system")

# Get a tracer for creating spans
tracer = get_tracer("agent-workflow")

async with MessageBus() as bus:
    # Messages published within a span automatically get the trace_id
    with tracer.start_as_current_span("agent-thinking"):
        await bus.publish("agent.thoughts", {"thought": "Processing data"})
    
    # Or explicitly set trace_id for cross-system tracing
    await bus.publish(
        "agent.action",
        {"action": "execute"},
        trace_id="custom-trace-id-from-upstream"
    )

Key Features:

  • Automatic Injection: trace_id automatically injected from active OpenTelemetry span
  • Cross-Agent Tracing: Same trace_id flows through request-response patterns
  • Explicit Control: Can manually set trace_id for integration with external systems
  • Zero Config: Works out of the box with InMemoryBroker, scales to production backends

See examples/tracing_demo.py for a complete multi-agent tracing example.

Architecture

amb sits in Layer 2 (Infrastructure) of the Agent OS stack. It transports message envelopes without inspecting content or enforcing policy.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Layer 3: Framework                  โ”‚  agent-control-plane, scak
โ”‚  (Orchestration & Self-Correction)   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                 โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Layer 2: Infrastructure    โ† AMB    โ”‚  iatp (Trust), atr (Registry)
โ”‚  (Transport & Discovery)             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                 โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Layer 1: Primitives                 โ”‚  caas (Context), cmvk (Verification),
โ”‚  (State & Identity)                  โ”‚  emk (Memory)
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Design Principles:

  • No Business Logic: The bus never decides routing based on message content.
  • Broker Agnostic: Swap Redis for RabbitMQ without changing application code.
  • Local-First: Works on a laptop with InMemoryBrokerโ€”no Docker required.
  • Separation of Concerns: The bus transports. The receiver validates trust (via iatp), not the bus.

The Agent OS Ecosystem

amb is one component of a modular Agent Operating System. Each layer solves a specific problem.

Layer 1: Primitives (State & Identity)

  • caas - Context as a Service: Manages agent context and state
  • cmvk - Context Merkle Verification Kit: Cryptographic verification of context
  • emk - Episodic Memory Kit: Persistent memory for agents

Layer 2: Infrastructure (Transport & Discovery)

  • iatp - Inter-Agent Trust Protocol: Trust verification for agent messages
  • amb - Agent Message Bus: Broker-agnostic transport (you are here)
  • atr - Agent Tool Registry: Decentralized tool discovery

Layer 3: Framework (Orchestration & Self-Correction)

  • agent-control-plane - The orchestration core
  • scak - Self-Correction & Alignment Kit: Runtime safety and alignment

Citation

If you use AMB in research, please cite:

@software{amb2026,
  author = {Siddique, Imran},
  title = {AMB: Agent Message Bus for Decoupled Multi-Agent Systems},
  year = {2026},
  url = {https://github.com/imran-siddique/amb},
  version = {0.1.0}
}

License: MIT | Contributing: CONTRIBUTING.md | Changelog: CHANGELOG.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

amb_core-0.3.0.tar.gz (44.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

amb_core-0.3.0-py3-none-any.whl (41.3 kB view details)

Uploaded Python 3

File details

Details for the file amb_core-0.3.0.tar.gz.

File metadata

  • Download URL: amb_core-0.3.0.tar.gz
  • Upload date:
  • Size: 44.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for amb_core-0.3.0.tar.gz
Algorithm Hash digest
SHA256 8edb5ea6130039a239dc53f15f7a11ce421e24b119776f8302f946f94168b35f
MD5 b86df5d0550b7e569b1c9e06e68d2ee7
BLAKE2b-256 2041d0c21f0d97a3e3f10d27747b1fb9408beb08e15f2964bca368c2f9d5d2fe

See more details on using hashes here.

File details

Details for the file amb_core-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: amb_core-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 41.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for amb_core-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f2bdb06464e67f40250a0c927530a3683a67719f1ecd35584e88e9dee610ceb
MD5 2383be90f1d86101283c8d186b0ebcce
BLAKE2b-256 eafd77b6591e0de7fb0d38273f087a2bd1fdf3d88a03db1e6881476bcaa5ee9b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page