Skip to main content

Telegram plugin for Crypto.com Agent Client

Project description

Crypto.com Agent Plugin – Telegram

The Crypto.com Agent Plugin – Telegram adds support for Telegram bots to the Crypto.com Agent Client ecosystem. This plugin enables conversational agents to operate directly within Telegram chats using the standard Agent SDK lifecycle and plugin system.

Features

Telegram Integration

  • Create conversational agents that respond directly to Telegram messages.
  • Handles /start and free-text message commands.
  • Automatically splits long messages (>4096 characters).
  • Uses Telegram’s polling API.

Plugin Architecture

  • Packaged as a standalone Python plugin.
  • Uses Python entry points and PEP 621 standards (pyproject.toml).
  • Implements the standard AgentPlugin interface with setup() and run() lifecycle hooks.
  • Declares its role as a primary plugin — meaning it can control the main execution loop (only one such plugin is allowed at a time).

Easy to Install and Extend

  • Fully decoupled from the core agent client.
  • Compatible with other plugins (e.g., storage, LangFuse, CLI).
  • Automatically discovered and initialized by the SDK.

Installation

Install the plugin into your environment:

pip install cryptocom-agent-plugin-telegram

Usage

Importing the Plugin

from cryptocom_agent_plugin_telegram import TelegramPlugin

Using with the Agent SDK

from cryptocom_agent_client import Agent

telegram_plugin = TelegramPlugin(bot_token="YOUR_TELEGRAM_BOT_TOKEN")

agent = Agent.init(
    llm_config={...},
    blockchain_config={...},
    plugins={...},
    plugin_instances=[telegram_plugin],
)

agent.start()

Plugin Lifecycle

This plugin defines:

  • mode = "primary" — only one primary plugin is started with agent.start().
  • setup(handler) — sets up Telegram handlers for messages and commands.
  • run() — starts the Telegram polling loop.
  • Optional on_ready(handler) for support-mode plugins (not used here).

Example

from cryptocom_agent_client import Agent
from cryptocom_agent_plugin_telegram import TelegramPlugin

telegram = TelegramPlugin(bot_token="123:abc...")

agent = Agent.init(
    llm_config={
        "provider": "OpenAI",
        "model": "gpt-4",
        "provider-api-key": "sk-...",
    },
    blockchain_config={
        "api-key": "YOUR_SDK_API_KEY",
    },
    plugins={
        "personality": {
            "tone": "friendly",
            "language": "English",
            "verbosity": "high",
        },
        "instructions": "Be helpful and concise.",
    },
    plugin_instances=[telegram],
)

agent.start()

Entry Point Declaration

This plugin is auto-discoverable via pyproject.toml:

[tool.poetry.plugins."crypto_com_agent.plugins"]
telegram = "cryptocom_agent_plugin_telegram:TelegramPlugin"

The Agent SDK uses this to dynamically discover and load plugins.

File Structure

crypto_com_agent_plugin_telegram/
├── __init__.py
└── telegram.py  # Main plugin implementation

Contributing

We welcome contributions! Please ensure your plugin follows the AgentPlugin interface and includes proper setup and lifecycle hooks.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Let me know if you’d like a pyproject.toml snippet included too, or a quickstart test script.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

File details

Details for the file cryptocom_agent_plugin_telegram-1.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for cryptocom_agent_plugin_telegram-1.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 75bc644d9e03543060383bedc9022ec334b769a31749f24c49a1c3f7055772e3
MD5 13f7006c51967329973f7b4051f10a63
BLAKE2b-256 95abd585f450f32afb0c6f9ca0b1325615a1314c79300c41bed894a467e239e0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page