# Repository Briefing: TryCaspian/caspian-sdk
> Source: https://repoforai.com/repo/TryCaspian/caspian-sdk (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/TryCaspian/caspian-sdk
- **Official Docs / Website**: https://trycaspianai.com
- **Category**: Agents & Frameworks (智能体与框架)
- **Primary Language**: Python
- **License**: AGPL-3.0
- **Engineering Health**: B (56/100 · Maintenance 12/35 · Adoption 19/25 · Releases 14/20 · License 11/20)
- **Latest Release**: v0.1.2 (2026-07-21) — https://github.com/TryCaspian/caspian-sdk/releases
- **Review Snapshot**: 2026-12-02
- **Deployment / Stack Signals**: Docker, Self-Hosted, CLI, API
- **Momentum**: 970 ★ total (+0 24h / +2 7d) · 138 forks
- **Topics**: `agent-communication`, `agent-messaging`, `ai-agent`, `ai-agents`, `communication`, `crewai`, `discord`, `email`, `imessage`, `langchain`, `llm`, `mcp`
- **When to Use**: Best for: Support assistants and community bots that should share handler logic across email, Slack, Telegram, or Discord while replying in the originating thread. Skip if: You only need one channel's native features, require a channel unavailable in your chosen deployment mode, or need agent-to-agent interoperability rather than human messaging.

## Overview
```text
### Architecture & Core Mechanics
Caspian is a transport layer for human-facing agents, not a reasoning runtime. Channel adapters verify inbound traffic, normalize payloads into kernel events, and dispatch those events to declarative message or action handlers. Handlers work with a common `Thread` and `Message` model; replies use the thread context to reach the originating conversation. Rules are inspectable through `cx.app.rules`, with overlap policies such as queue, debounce, drop, and parallel affecting what happens when messages arrive while a handler is busy.

The 1.0 facade lives in `packages/python` and `packages/typescript`. Hosted bindings poll a gateway; self-hosted bindings run adapters in the application process behind a webhook route or, for supported channels, a socket listener. The root `uv` workspace links the local Python package and configures pytest against `packages/python/tests`. The Bun CLI in `packages/cli` uses the SDK command surface; OpenClaw and OpenCode integrations are separate packages rather than prerequisites for message dispatch.

### Key Capabilities & Differentiators
The SDK handles threaded replies, immediate acknowledgements, typing indicators, media, reactions, and callback actions. Streaming is implemented by posting once and editing the message as content arrives. Rich blocks map to native representations such as Slack Block Kit, Discord embeds, and Telegram keyboards, with plain-text fallback where needed. `cx.tools(thread)` exposes schemas derived from the same command catalog that handlers use; it does not choose or run a model.

Channel availability depends on deployment mode. The 1.0 matrix lists local Telegram bot webhooks or polling, Discord socket inbound, and Slack sockets or webhooks, alongside adapters for channels including email, WhatsApp Business, and Twilio SMS or voice. Linear is listed as self-host only; Bluesky and Instagram DM are listed as hosted only. Inbound verification is provider-specific, including Slack signing secrets, Meta `X-Hub-Signature-256`, and Telegram's secret header. The offline fakes exercise platform-shaped payloads without live provider calls.

### Trade-offs & Limitations
Compared with native channel SDKs, Caspian removes duplicate routing, reply handling, and test scaffolding when several channels share an agent. The cost is an abstraction boundary: rich-message behavior and channel availability still vary, so verify every required channel and feature in the intended mode. The common thread model routes replies, but do not treat it as evidence of automatic identity matching across platforms. For a single-channel application that depends on native features, a direct integration may be simpler.

Hosted mode reduces the inbound infrastructure you operate but adds a gateway dependency and a polling path. Direct self-hosting gives you control over ingress and tokens while leaving endpoint availability, credentials, and socket operations to your team. It does not remove upstream constraints: X DMs require paid API access, and GSM-modem SMS requires a modem, SIM, and attention to carrier rules. Review AGPL-3.0 obligations before modifying and operating the software as a network service.

### Hardware & Deployment Guide
The SDK requires Python 3.10+ or, for TypeScript, Node.js 18+ or Bun. For hosted use, configure `CASPIAN_API_KEY` and run `cx.run()` to poll the gateway; `CASPIAN_BASE_URL` can override the endpoint. In-process self-hosting uses platform credentials and your own ingress: route HTTP requests to `cx.handle()` in Python or the channel webhook handler in TypeScript. Slack and Discord socket inbound can avoid a public webhook URL; the Python Discord listener requires the optional `caspian-sdk[discord]` extra.

The Docker Compose path is a separate gateway setup. It builds `./server`, publishes port `8000`, uses PostgreSQL and an inline worker, and defaults to a credential-free fake provider and a development bootstrap key. Replace that key before exposing the service. The v0.1.2 release covers the first public open core, the Compose quickstart still targets `CommClient`, and the SDK examples describe the 1.0 `Caspian` rewrite. These are distinct surfaces: pin a matching package and gateway revision before deployment rather than assuming the legacy Compose example works with the 1.0 SDK.
```

## Key Capabilities
```text
- Dispatch: Inspectable `cx.app.rules` apply channel, chat-kind, and command filters, with acknowledgement and overlap policies.
- Ingress: Adapters verify incoming webhooks using platform-specific mechanisms such as Slack signing secrets, Meta HMAC signatures, and Telegram secret headers.
- Delivery: `Thread` supports contextual replies, rich blocks with text fallback, and streaming by editing a posted message.
- Testing: Channel fakes accept platform-shaped payloads; the project lists more than 650 Python and TypeScript tests and network-free CI.
- Packaging: TypeScript offers per-channel imports such as `caspian-sdk/telegram` for parse, plan, and execute without the full SDK facade.
- Tooling: `cx.tools(thread)` exposes kernel-derived command schemas; the Bun CLI offers `catalog`, `call`, and `threads tail`.
```

## Quick Start / Clone
```bash
pip install caspian-sdk        # Python 3.10+
npm install caspian-sdk        # TypeScript / Node 18+ / Bun
```
