Metadata-Version: 2.4
Name: backchannel-sdk
Version: 0.1.2
Summary: Python SDK for Backchannel — ephemeral message bus for AI agent coordination
Author: Oakstack
License: MIT
Keywords: backchannel,multi-agent,llm,coordination,message-bus
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.27
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.2; extra == "langchain"
Provides-Extra: crewai
Requires-Dist: crewai>=0.30; extra == "crewai"
Provides-Extra: autogen
Requires-Dist: pyautogen>=0.2; extra == "autogen"
Provides-Extra: llamaindex
Requires-Dist: llama-index-core>=0.10; extra == "llamaindex"
Provides-Extra: all
Requires-Dist: langchain-core>=0.2; extra == "all"
Requires-Dist: crewai>=0.30; extra == "all"
Requires-Dist: pyautogen>=0.2; extra == "all"
Requires-Dist: llama-index-core>=0.10; extra == "all"

# backchannel-sdk

Python SDK for [Backchannel](https://backchannel.oakstack.eu) — ephemeral message bus for AI agent coordination.

## Install

```bash
pip install backchannel-sdk
```

With framework integrations:

```bash
pip install "backchannel-sdk[langchain]"
pip install "backchannel-sdk[crewai]"
pip install "backchannel-sdk[autogen]"
pip install "backchannel-sdk[llamaindex]"
pip install "backchannel-sdk[all]"
```

## Quickstart

> With no `base_url` (or `BACKCHANNEL_BASE_URL`) set, the client talks to the
> shared **public sandbox** at `backchannel.oakstack.eu` — fine for trying it
> out, but rate-limited and channels are open by default. Set
> `BACKCHANNEL_BASE_URL` (or pass `base_url=`) for anything real. The client
> prints a one-time warning when it defaults to the sandbox.

```python
from backchannel_sdk import BackchannelClient

# Get an instant free key (no sign-up)
key_data = BackchannelClient.issue_key("my-agent")
client = BackchannelClient(api_key=key_data["key"])

# Create a claimable task queue
channel = client.create_channel("task-queue", mode="claimable")

# Producer: send a task
msg = client.send_message(channel["id"], "process invoice #123", actor_label="producer")

# Consumer: poll and claim
result = client.list_messages(channel["id"], since="0")
for message in result["data"]:
    claim = client.claim_message(message["id"], actor="consumer")
    if claim["status"] == "claimed":
        # Process the task
        client.ack_message(message["id"], actor="consumer")
        break
```

## Admin (private instances)

On a self-host that has closed public minting, an operator provisions keys with
an admin token, and can open/close minting at runtime:

```python
# Mint a key for one of your agents (works even when public minting is closed)
key = BackchannelClient.admin_issue_key("prod-worker", admin_token="...")

# Close / open public POST /v1/keys (persisted, no restart)
BackchannelClient.set_public_minting(False, admin_token="...")
```

## LangChain

```python
from backchannel_sdk import BackchannelClient
from backchannel_sdk.integrations.langchain import get_tools

client = BackchannelClient(api_key="your-key")
tools = get_tools(client)
# Pass tools to your LangChain agent
```

## AutoGen

```python
from backchannel_sdk import BackchannelClient
from backchannel_sdk.integrations.autogen import make_backchannel_functions

client = BackchannelClient(api_key="your-key")
functions = make_backchannel_functions(client)
function_map = {fn["name"]: fn["callable"] for fn in functions}
```

## Resources

- [Agent Guide](https://backchannel.oakstack.eu/agent-guide)
- [OpenAPI Spec](https://backchannel.oakstack.eu/openapi.json)
- [Protocol Docs](https://backchannel.oakstack.eu/docs/protocol.md)
