@beyond-bot-ai/sdk) is the official way to interact with the B-Bot Platform. It provides a type-safe interface to manage Distribution Channels (Assistants), Threads, and Runs, built on top of the LangGraph SDK but adapted for B-Bot’s terminology.
NPM Package
View on NPM
Installation
Quick Start
Initialize the client with your B-Bot API Key. The SDK is pre-configured to connect to the B-Bot API.Getting Your API Key
- Go to B-Bot Hub
- Navigate to Settings → API Keys
- Click Create New API Key
- Copy the key (starts with
bbot_) - Store it securely (treat it like a password!)
Core Concepts
1. Distribution Channels
In B-Bot, AI Assistants are exposed as Distribution Channels. You can search, retrieve, and manage them using theclient.distributionChannels property.
2. Threads
Threads persist the state of a conversation. Every interaction happens within a thread.3. Streaming Runs (Recommended)
The SDK includes a powerful Streaming Handler (client.streamRun) that simplifies processing real-time events like token streaming, tool execution, and state updates.
Manual Streaming (Advanced)
If you need lower-level control over the stream:State Management (Todos & Files)
The SDK automatically extracts structured data like Todos and Files generated by the AI.Debugging
IfonMessage is not being called or you’re not receiving events, enable debug mode:
- Every chunk received from the stream
- Event types and data structures
- Content extraction process
- Total chunks processed
Common Pitfalls
1. Missing entity_id
B-Bot requires entity_id in the initial state. Always extract it from the channel config:
2. Using channel_id instead of assistant_id
The API returns assistant_id, not channel_id. Use channel.assistant_id.
3. Appending cumulative content
B-Bot sends the full message so far in each chunk. Always replace content whenisCumulative=true.
Features
- Native Terminology: Uses
client.distributionChannelsinstead ofclient.assistants. - Streaming Handler: Built-in
streamRunhelper for easy real-time UI updates. - State Extraction: Automatically extracts Todos and Files from stream events.
- Auto-Configuration: Pre-configured for
api.b-bot.space. - Type Safety: Full TypeScript support.
- Cumulative Streaming: Properly handles B-Bot’s cumulative content streaming.