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.2.tar.gz (169.0 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.2-py3-none-any.whl (102.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: caspian_sdk-1.0.2.tar.gz
  • Upload date:
  • Size: 169.0 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.2.tar.gz
Algorithm Hash digest
SHA256 435a25f7b9a8c9ae0e8e804d6c7917cdbb787307757804a9f8cafbd4bdbf90cc
MD5 ad88f1581b1539d312e2cdd876020e01
BLAKE2b-256 d2112e6853ba7a3ad68c36da6099412925ed80c0a80f121b33a679bcbfc661ba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: caspian_sdk-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 102.6 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 97e40e984d945f063e67b970e154352a4b7a95e18cf9104c2026a0add9ad7d0e
MD5 797d8ad690491cb2da2a769f3871d23a
BLAKE2b-256 5321e614fc1069f7900cb1fde4d8b62257f0ba763d024c20a1f7127d62d8c5b0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 files

1.0.1

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