Skip to main content

telegram-agent

Agent-first Telegram community management tools.

telegram-agent is an AgentCulture sibling repo. The shape it wears — pyproject layout, CLI conventions, vendored skills, CI pipeline — comes from steward's sibling pattern.

Status

Alpha. v0.2 lands the Telegram surface: telegram-agent bot send, telegram-agent group roster, telegram-agent group pin. Every write verb is dry-run by default; pass --apply to commit.

Install

uv tool install telegram-agent

Then telegram-agent --version should work on your PATH. uv tool install is the supported path — not pip install.

Usage

telegram-agent learn               # structured self-teaching prompt for an agent
telegram-agent learn --json        # same, as a JSON payload
telegram-agent explain             # top-level overview
telegram-agent explain whoami      # per-verb markdown
telegram-agent whoami              # nick + version + bot-token-configured probe
telegram-agent whoami --json       # structured payload

Every command supports --json where it produces a listing or report, and respects the exit-code policy (0 success / 1 user error / 2 env error). Errors carry a {code, message, remediation} shape; text mode renders as error: ... + hint: ... on stderr.

Telegram verbs (requires pip install 'telegram-agent[telegram]')

# read-only: count + admins + bot's own permissions
telegram-agent group roster --chat @announcements --json

# write (dry-run by default; --apply to commit)
telegram-agent bot send --chat @announcements --text "hello" --parse-mode markdown
telegram-agent bot send --chat @announcements --text "hello" --apply

# pin / unpin (also dry-run by default)
telegram-agent group pin --chat @announcements --message 123 --apply
telegram-agent group pin --chat @announcements --unpin --apply

Configuration

Variable Purpose
TELEGRAM_AGENT_BOT_TOKEN Telegram bot token. Required for write verbs once they land. Never logged.

Bot tokens, group IDs, and webhook secrets must never be committed to the repo — keep them in repo secrets or a git-ignored .env.

Tokens are loaded from os.environ first, then from a .env file in the current directory, then from a .env at the nearest enclosing git root. Process env always wins. .env files that are world-writable on POSIX are skipped with a warning.

Testing

The unit suite runs offline. Run it with:

uv run pytest -v

Live smoke tests

Optional live tests in tests/test_telegram_live.py exercise bot send / group roster / group pin / unpin against the real Bot API. Enable by exporting two numeric chat IDs the bot can reach:

export TELEGRAM_AGENT_LIVE_TEST_USER_CHAT=<numeric user chat_id>
export TELEGRAM_AGENT_LIVE_TEST_GROUP_CHAT=<numeric group chat_id>
uv run pytest tests/test_telegram_live.py -v

The bot must be a member of the user DM (the user must have started a chat with the bot) and a member-admin (with Pin Messages) in the group. CI does not set these env vars, so live tests skip in CI.

Project shape

See CLAUDE.md for the directory layout, build / test / publish commands, and the sibling-pattern conventions telegram-agent inherits.

Contributing

Every PR must bump the version in pyproject.toml and prepend a Keep a Changelog entry to CHANGELOG.md. The version-check CI job enforces this. Use the vendored version-bump skill:

python .claude/skills/version-bump/scripts/bump.py patch  # or minor / major

Metadata

Release files for telegram-agent 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for telegram-agent 0.3.1
File Size Uploaded Provenance
telegram_agent-0.3.1.tar.gz 114.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for telegram-agent 0.3.1
File Interpreter ABI Platform
telegram_agent-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 137.7 kB

Release files / telegram_agent-0.3.1.tar.gz

Download URL telegram_agent-0.3.1.tar.gz
Size 114.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9df4e3dccedba669b65ac7a4a9787d01ad316c14ea09babcf8175d9128144053
BLAKE2b-256 checksum
How to use checksums
556d1e83adeb1e3909e2827aa8aef4f67741ef53584b906580db2221d28661c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / telegram_agent-0.3.1-py3-none-any.whl

Download URL telegram_agent-0.3.1-py3-none-any.whl
Size 23.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9d9895534e8f89c7ad8dfdbd6b913fb940669088105bd7d73744e0a46593ba9
BLAKE2b-256 checksum
How to use checksums
a657e86d7c914f62f338b2af734e525b333973fe5f876d12c798e75872de8fe8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for telegram-agent 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files No provenance

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