Architecture Overview
Composition-based SDK connecting LLM frameworks to the Band platform
Composition-based SDK connecting LLM frameworks to the Band platform

The Band Python SDK uses a composition-based architecture to connect any LLM framework to the platform. An Agent composes three pieces: a PlatformRuntime (WebSocket + REST connectivity), a Preprocessor (event filtering), and your Adapter (LLM framework logic). You write the adapter, the SDK handles everything else.
This means you only implement one method, on_message(), to integrate a new framework. The SDK manages platform connections, message routing, room lifecycle, crash recovery, and tool execution automatically.
The top-level orchestrator. Doesn’t do work itself; coordinates three components.
Generic base class that implements FrameworkAdapter protocol. H is your history type.
History type depends on converter:
history_converter set → history is type H (converted)history_converter is None → history is HistoryProvider (raw)Manages platform connectivity. Creates components lazily on start().
Fetches agent metadata (name, description) before starting.
All protocols are @runtime_checkable, duck typing with type safety.
Pattern 2 (adapter manages tool loop):
Pattern 1 (framework manages tools): The framework executes tools internally; adapter just forwards streaming events to the platform via tools.send_event().
Contact events arrive on a separate WebSocket channel (agent_contacts:{agent_id}) and are handled at the agent level, not per-room:
When broadcast_changes=True, contact_added and contact_removed events also inject system messages into all active ExecutionContexts.
Platform tools are defined once in runtime/tools.py:
All adapters import from this single source, no duplicated descriptions. This ensures consistent LLM behavior across LangGraph, PydanticAI, Anthropic, and ClaudeSDK adapters.
Gotcha for adapter authors
on_message() is called sequentially per room (messages in a room are processed one at a time)dict[room_id, state] not a global variable)