Skip to main content

A Python SDK implementing the Blackboard Pattern for LLM-powered multi-agent systems

Project description

Blackboard-Core

A Python SDK for building LLM-powered multi-agent systems using the Blackboard Pattern.

Python 3.9+ License: MIT PyPI version

What is Blackboard-Core?

Blackboard-Core provides a centralized state architecture for multi-agent AI systems. Instead of agents messaging each other directly, all agents read from and write to a shared Blackboard (state), while a Supervisor LLM orchestrates which agent runs next.

┌─────────────────────────────────────────────────────────────┐
│                       ORCHESTRATOR                          │
│  ┌─────────────┐    ┌──────────────────────────────────┐    │
│  │  Supervisor │──▶│          BLACKBOARD              │    │
│  │    (LLM)    │    │  • Goal      • Artifacts         │    │
│  └─────────────┘    │  • Status    • Feedback          │    │
│         │           │  • History   • Metadata          │    │
│         ▼           └──────────────────────────────────┘    │
│  ┌─────────────────────────────────────────────────────┐    │
│  │                       WORKERS                       │    │
│  │  [Writer]  [Critic]  [Refiner]  [Researcher]  ...   │    │
│  └─────────────────────────────────────────────────────┘    │
└─────────────────────────────────────────────────────────────┘

Features

  • Centralized State - All agents share a typed Pydantic state model
  • LLM Orchestration - A supervisor LLM decides which worker runs next
  • Async-First - Built for high-performance async/await patterns
  • LiteLLM Integration - 100+ LLM providers via LiteLLMClient
  • Model Context Protocol - Connect to MCP servers for external tools (v1.2.0)
  • OpenTelemetry - Distributed tracing with span hierarchy (v1.2.0)
  • Session Replay - Record and replay for debugging (v1.2.0)
  • Middleware System - Budget tracking, logging, human approval
  • Tool Calling - Native support for OpenAI-style function calling
  • Memory System - Vector memory with pluggable embeddings

Installation

pip install blackboard-core

# Optional extras
pip install blackboard-core[mcp]        # Model Context Protocol
pip install blackboard-core[telemetry]  # OpenTelemetry
pip install blackboard-core[chroma]     # ChromaDB for memory

Quick Start

from blackboard import Orchestrator, worker
from blackboard.llm import LiteLLMClient

# Define workers with decorators
@worker(name="Writer", description="Writes content")
def write(topic: str) -> str:
    return f"Article about {topic}..."

@worker(name="Critic", description="Reviews content")  
def critique(content: str) -> str:
    return "Approved!" if len(content) > 50 else "Needs more detail"

# Create orchestrator
llm = LiteLLMClient(model="gpt-4o")  # Auto-detects API key
orchestrator = Orchestrator(llm=llm, workers=[write, critique])

# Run
result = orchestrator.run_sync(goal="Write about AI safety")
print(result.artifacts[-1].content)

Core Concepts

Concept Description
Blackboard Shared state containing goal, artifacts, feedback, and metadata
Worker An agent that reads state and produces artifacts or feedback
Orchestrator Manages the control loop and calls the supervisor LLM
Supervisor The LLM that decides which worker to call next
Artifact Versioned output produced by a worker
Feedback Review/critique of an artifact

What's New in v1.2.0

Model Context Protocol (MCP)

from blackboard.mcp import MCPServerWorker

# Connect to filesystem MCP server
fs = await MCPServerWorker.create(
    name="Filesystem",
    command="npx",
    args=["-y", "@modelcontextprotocol/server-filesystem", "/path"]
)

# Each tool exposed as separate worker
workers = fs.expand_to_workers()  # read_file, write_file, etc.
orchestrator = Orchestrator(llm=llm, workers=workers)

OpenTelemetry Tracing

from blackboard.telemetry import OpenTelemetryMiddleware

otel = OpenTelemetryMiddleware(service_name="my-agent")
orchestrator = Orchestrator(llm=llm, workers=workers, middleware=[otel])
# Creates spans: orchestrator.run → step.N → worker.Name

Session Replay

from blackboard.replay import SessionRecorder, ReplayOrchestrator

# Record
recorder = SessionRecorder()
recorder.attach(orchestrator.event_bus)
result = await orchestrator.run(goal="...")
recorder.save("session.json")

# Replay (no API calls!)
replay = ReplayOrchestrator.from_file("session.json", workers=workers)
replayed = await replay.run()

Advanced Features

Middleware

from blackboard.middleware import BudgetMiddleware, HumanApprovalMiddleware

orchestrator = Orchestrator(
    llm=my_llm,
    workers=[...],
    middleware=[
        BudgetMiddleware(max_tokens=100000),
        HumanApprovalMiddleware(require_approval_for=["Deployer"])
    ]
)

Memory System

from blackboard.memory import SimpleVectorMemory, MemoryWorker
from blackboard.embeddings import OpenAIEmbedder

memory = SimpleVectorMemory(embedder=OpenAIEmbedder())
worker = MemoryWorker(memory=memory)

Persistence

# Save session
result.save_to_json("session.json")

# Resume later
state = Blackboard.load_from_json("session.json")
await orchestrator.run(state=state)

Documentation

See DOCS.md for the complete API reference and advanced usage guide.

License

MIT License - see LICENSE for details.

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

blackboard_core-1.2.0.tar.gz (92.5 kB view details)

Uploaded Source

Built Distribution

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

blackboard_core-1.2.0-py3-none-any.whl (83.5 kB view details)

Uploaded Python 3

File details

Details for the file blackboard_core-1.2.0.tar.gz.

File metadata

  • Download URL: blackboard_core-1.2.0.tar.gz
  • Upload date:
  • Size: 92.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for blackboard_core-1.2.0.tar.gz
Algorithm Hash digest
SHA256 afffac4729fdef12da5899b3393efb5e7f147807be225b95f5e97e7b366158ab
MD5 be63f12dd3161997eb8b31da0cc1b1d9
BLAKE2b-256 5dbacaf9d6506b7c30a9af2b325dff543438fe24423c49dc3a2b52bc7f483845

See more details on using hashes here.

Provenance

The following attestation bundles were made for blackboard_core-1.2.0.tar.gz:

Publisher: publish.yml on hemantsingh443/blackboard-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file blackboard_core-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for blackboard_core-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4550c038741b01d7548418381af1a7930ec826803abd7550c7137a4c33012de9
MD5 e8d598947515755ed133a440b6f3722a
BLAKE2b-256 18305a58e7c2cde71781aecea0c5fc9d7c0fc32e96ed7e357c22ab668efb7da3

See more details on using hashes here.

Provenance

The following attestation bundles were made for blackboard_core-1.2.0-py3-none-any.whl:

Publisher: publish.yml on hemantsingh443/blackboard-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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