Telegram channel for Kestrel agents — isolated-venv feature (Telegram Bot API).
Project description
kestrel-channel-telegram
Telegram channel for Kestrel agents — an isolated-venv feature where the agent talks over a Telegram bot it owns (a Bot API token), not a device grafted onto a personal account.
Unlike the WhatsApp channel (a companion device linked to a personal number), Telegram gives the agent its own identity with almost no friction:
- Create a bot with @BotFather → you get a token. No phone number, no QR, no linked device.
- You DM the bot; the agent replies as the bot.
- Access is default-deny: with an empty
allowed_sendersthe bot replies to no one. Send/startto the bot and it tells you your Telegram user id; add that id (or your@username) toallowed_sendersto enable the conversation.
Setup — the agent walks you through it
You don't need to remember these steps: enable the feature and ask the agent to
set up Telegram. It calls telegram_status, which returns a plain-language
next_step, and guides you through whichever step is next. The full flow:
- Create the bot (only you can do this — it's in your Telegram):
- Open Telegram, search @BotFather (the blue-check official one), press Start.
- Send
/newbot, choose a name (e.g.Emma) and a username ending inbot(e.g.emma_kestrel_bot). - BotFather replies with a token like
12345678:AAExample…(~46 chars). Copy it. (It's the bot's password — keep it private; it's fine to give to the agent/operator to store in config.)
- Configure the token: save the token in this feature's config (
token) via the features UI (or hand it to the operator). The agent tells you when it's set and connected (as your bot's@username). - Get on the allowlist (this is how you get access — default-deny):
- Ask the agent for the link, or run
telegram_link→ it returnshttps://t.me/<your_bot>. - Open it, press Start, send
/start→ the bot replies with your numeric Telegram id. - Add that id (or your
@username) toallowed_senders.
- Ask the agent for the link, or run
- Chat: DM the bot — the agent replies. Done.
What the agent does vs. what you do. The agent can't create your bot or read your Telegram, so steps 1 and the
/startin step 3 are yours. Everything else — telling you exactly what's missing (telegram_status.next_step), handing you thet.melink (telegram_link), and surfacing your id from/start— the agent drives. Setting the token/allowlist config today goes through the features UI/operator; an agent-sidefeature_configuretool would let the agent do that for you too (planned).
How it works
The package has two roles (same shape as kestrel-channel-whatsapp):
- Discovery marker
TelegramFeature(SDK-only) — installed into the host. - Transport service
kestrel_channel_telegram.service— its only dep ishttpx(the[service]extra), installed by the host loader into a per-agent isolated venv and run as thekestrel-telegram-serviceconsole script over the SDK stdio JSON-RPC contract.
The service:
- registers
telegram_send,telegram_status,telegram_linktools; - long-polls the Bot API (
getUpdates) for inbound and emitschannel.inboundfor allowed senders (routed intoChannelFeature.handle_inbound); - sends via
sendMessage.
Config
| key | meaning |
|---|---|
enabled |
turn the channel on/off |
token |
Bot API token from @BotFather (the agent's identity) |
allowed_senders |
Telegram numeric user ids or @usernames allowed to DM the agent. Empty = deny all. |
Development
uv run --no-project --with "kestrel-sovereign-sdk>=0.29.0" --with httpx \
--with pytest --with pytest-asyncio python -m pytest -q
Release
Bump version in pyproject.toml (+ uv.lock), tag vX.Y.Z; publish.yml
verifies the tag matches and publishes to PyPI via OIDC trusted publishing
(environment: pypi).
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kestrel_channel_telegram-0.1.1.tar.gz.
File metadata
- Download URL: kestrel_channel_telegram-0.1.1.tar.gz
- Upload date:
- Size: 32.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
431c7669cbb98a0552a826427814dfdb9563adfa55fd2ad7479c39c3553cd70c
|
|
| MD5 |
925197c3d12104f9bc0a5897377edf1c
|
|
| BLAKE2b-256 |
74d34f2dd301e3ea45a084211d2ef3bfda835c72167ea5ea25790400b41e91b4
|
Provenance
The following attestation bundles were made for kestrel_channel_telegram-0.1.1.tar.gz:
Publisher:
publish.yml on KestrelSovereignAI/kestrel-channel-telegram
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kestrel_channel_telegram-0.1.1.tar.gz -
Subject digest:
431c7669cbb98a0552a826427814dfdb9563adfa55fd2ad7479c39c3553cd70c - Sigstore transparency entry: 2088722340
- Sigstore integration time:
-
Permalink:
KestrelSovereignAI/kestrel-channel-telegram@d408306be2265487666b638c361b761125643527 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/KestrelSovereignAI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d408306be2265487666b638c361b761125643527 -
Trigger Event:
push
-
Statement type:
File details
Details for the file kestrel_channel_telegram-0.1.1-py3-none-any.whl.
File metadata
- Download URL: kestrel_channel_telegram-0.1.1-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fbed143867455db401887a354ec6444b454b6f0750e3714403c9a0db4388d9b
|
|
| MD5 |
79332056875a5c982c0dd0efd350d40b
|
|
| BLAKE2b-256 |
d57744f5fa4c56b820140909f7bc41d3ccc45643c17d3d7b06b5babf715f58c8
|
Provenance
The following attestation bundles were made for kestrel_channel_telegram-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on KestrelSovereignAI/kestrel-channel-telegram
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kestrel_channel_telegram-0.1.1-py3-none-any.whl -
Subject digest:
1fbed143867455db401887a354ec6444b454b6f0750e3714403c9a0db4388d9b - Sigstore transparency entry: 2088723058
- Sigstore integration time:
-
Permalink:
KestrelSovereignAI/kestrel-channel-telegram@d408306be2265487666b638c361b761125643527 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/KestrelSovereignAI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d408306be2265487666b638c361b761125643527 -
Trigger Event:
push
-
Statement type: