Skip to main content

Telegram bot powered by PraisonAI multi-agent framework

Project description

telegram-praisonai-bot

Telegram bot powered by PraisonAI multi-agent framework.

Installation

pip install telegram-praisonai-bot

Quick Start

  1. Create a Telegram Bot

    • Message @BotFather on Telegram
    • Send /newbot and follow the instructions
    • Copy the bot token
  2. Start PraisonAI Server

    pip install praisonai
    praisonai serve agents.yaml --port 8080
    
  3. Run the Bot

    export TELEGRAM_BOT_TOKEN=your_telegram_token
    export PRAISONAI_API_URL=http://localhost:8080
    telegram-praisonai-bot
    

    Or create a .env file:

    TELEGRAM_BOT_TOKEN=your_telegram_token
    PRAISONAI_API_URL=http://localhost:8080
    PRAISONAI_TIMEOUT=300
    

Commands

Command Description
/start Start the bot and show welcome message
/help Show help message
/ask <query> Ask PraisonAI agents a question
/agent <name> <query> Ask a specific agent
/agents List available PraisonAI agents

You can also just send a message directly and the bot will process it.

Usage Examples

/ask What are the latest trends in AI?
/agent researcher Research quantum computing
/agents

Programmatic Usage

from telegram_praisonai_bot.bot import PraisonAITelegramBot

bot = PraisonAITelegramBot(
    token="YOUR_TELEGRAM_TOKEN",
    api_url="http://localhost:8080",
    timeout=300
)
bot.run()

Using the Client Directly

import asyncio
from telegram_praisonai_bot import PraisonAIClient

async def main():
    client = PraisonAIClient(api_url="http://localhost:8080")
    
    # Run workflow
    result = await client.run_workflow("Research AI trends")
    print(result)
    
    # Run specific agent
    result = await client.run_agent("Write an article", "writer")
    print(result)
    
    # List agents
    agents = await client.list_agents()
    print(agents)

asyncio.run(main())

Configuration

Environment Variable Default Description
TELEGRAM_BOT_TOKEN (required) Telegram bot token from @BotFather
PRAISONAI_API_URL http://localhost:8080 PraisonAI server URL
PRAISONAI_TIMEOUT 300 Request timeout in seconds

Links

License

MIT

Project details


Download files

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

Source Distribution

telegram_praisonai_bot-0.1.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

telegram_praisonai_bot-0.1.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file telegram_praisonai_bot-0.1.0.tar.gz.

File metadata

  • Download URL: telegram_praisonai_bot-0.1.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for telegram_praisonai_bot-0.1.0.tar.gz
Algorithm Hash digest
SHA256 65807c0ccd58f755f675c4f0acfec81c224840ade839448ea92f161d4f0a8942
MD5 95ac11d49a0d30e70bc8d0505c577de2
BLAKE2b-256 ce6f3ad3e2902929c66adea2af480d312c0219d46c5af4e00d4970c0335efd74

See more details on using hashes here.

File details

Details for the file telegram_praisonai_bot-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for telegram_praisonai_bot-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 85328ef72222038296d6e7c1c9544fb1120d15a0078b91146ef9d33af1790d03
MD5 bbc6735b60606e82e0c0efd7bd9dc573
BLAKE2b-256 c5844d5664c3513dbe27af1dbf7395296a2904d9a15f5267a4c4a1c82f2a4c58

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