Skip to main content

caspian-sdk

Give an agent an address on real messaging channels. One handler answers Telegram, Slack, Discord, email, SMS, WhatsApp, X and more — hosted through the Caspian gateway, or self-hosted straight against each platform with your own tokens.

pip install caspian-sdk

Version 1.0.0 is a new API. It replaces the legacy CommClient (0.6.x); see the migration note below.

Hosted: the gateway owns credentials

from caspian import Caspian

cx = Caspian(api_key="...")            # key from dashboard.trycaspianai.com
cx.channels.add("telegram", bot_token="...")   # telegram is BYO token

@cx.on_message({"overlap": "queue", "ack": "On it, one moment..."})
def handle(thread, msg, ctx):
    with thread.stream() as out:       # posts once, then edits as it writes
        out.append(answer(msg.text))

cx.run()                               # polls the gateway for inbound

Self-host: your process, your tokens, no gateway

cx = Caspian()
cx.channels.add("telegram", via="self-host", bot_token="...",
                webhook_url="https://your.server/telegram")

# from your own HTTP route:
results = cx.handle("telegram", request_body, request_headers)

Discord and Slack can receive over a held-open socket instead of a webhook — no public URL needed:

cx.channels.add("discord", via="self-host", bot_token="...")
cx.listen("discord")                   # pip install "caspian-sdk[discord]"

What a handler can do

thread.post, reply, send (unthreaded), send_media, send_blocks, typing, edit, react, pin, delete, forward, initiate (cold DM), schedule, and thread.stream() for replies that type themselves out. Rules take filters (channel, kind, command), an overlap policy (queue / debounce / drop / parallel) and an instant ack for channels with no typing indicator.

Your bot is data: cx.app.rules prints every predicate, policy and ack, so programs are inspectable and testable without a network.

Channels

telegram, slack, discord, email, sms, voice, whatsapp, messenger, imessage, x and linear self-host adapters ship in the package. Hosted mode covers any channel the gateway supports.

Optional extras: caspian-sdk[discord] and caspian-sdk[slack-socket] (websocket inbound).

Migrating from 0.6.x

The 0.6.x CommClient API is a different SDK. It remains published and its source is tagged legacy-sdk-0.6.x in the repository. New code should start here; there is no drop-in path between the two.

Links

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

caspian_sdk-1.0.1.tar.gz (168.6 kB view details)

Uploaded Source

Built Distribution

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

caspian_sdk-1.0.1-py3-none-any.whl (102.4 kB view details)

Uploaded Python 3

File details

Details for the file caspian_sdk-1.0.1.tar.gz.

File metadata

  • Download URL: caspian_sdk-1.0.1.tar.gz
  • Upload date:
  • Size: 168.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for caspian_sdk-1.0.1.tar.gz
Algorithm Hash digest
SHA256 1c8295bce9d14fe0b3622ec0d452a758b2f21217235f0b29f8aac026bf468c60
MD5 e170540cefe7ce470dba5d8bceebb6dc
BLAKE2b-256 de96e375c725cbcdb1bc91764d577381f878c419db492a103cf97647e677001f

See more details on using hashes here.

File details

Details for the file caspian_sdk-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: caspian_sdk-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 102.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for caspian_sdk-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e2fdfe72d05976a61995be6877af21ed0e3dc0d238e4c2fc413b45c5a9bda9c2
MD5 3a3cd1c4924340041a78164fd567a0f7
BLAKE2b-256 b47777a7b5649b9ef6dd32938ef2bdef9d81319915c9f6fbe51badda315b2773

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.2

2 files

This release

1.0.1 This release

2 files

1.0.0

2 files

0.6.4

2 files

0.6.3

2 files

0.6.1

2 files

0.6.0

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.2

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page