Skip to main content
Platform capabilities tell PraisonAI what your bot’s platform can do, so streaming, chunking, and rate limiting work the same way everywhere.

Quick Start

1

Look up built-in capabilities

from praisonai import Bot
from praisonaiagents import Agent
from praisonai.bots._registry import get_platform_capabilities

agent = Agent(name="assistant", instructions="Be helpful")
caps = get_platform_capabilities("telegram")
print(caps.max_message_length)  # 4096
print(caps.length_unit)         # utf16

bot = Bot("telegram", agent=agent)
2

Register a custom platform

from praisonaiagents.bots import PlatformCapabilities
from praisonai.bots._registry import register_platform

class MyBot:
    async def start(self): ...
    async def stop(self): ...

register_platform(
    "mybot",
    MyBot,
    capabilities=PlatformCapabilities(
        max_message_length=2000,
        supports_edit=True,
        markdown_dialect="markdown",
    ),
)

How it works

UnifiedDelivery (via create_delivery(bot)) reads platform_capabilities to chunk long replies, stream edits, and apply rate limits.

Configuration options

FieldTypeDefaultDescription
max_message_lengthint4096Maximum message length in the platform’s unit
length_unitstr"codepoints""codepoints" or "utf16"
supports_editboolFalseIn-place message edits (streaming)
supports_typingboolTrueTyping indicators
markdown_dialectstr"markdown"e.g. "telegram_markdown_v2", "discord_markdown"
needs_rate_limitboolTrueApply Praison rate limiting
edit_interval_msint1000Minimum ms between edits
max_files_per_messageint1Attachments per message
max_file_size_mbint10Max file size in MB
supported_file_typesList[str]["*"]Allowed mime types or extensions
Methods: to_dict() and from_dict(data).

Built-in platform defaults

PlatformNotes
Telegrammax_message_length=4096, length_unit="utf16", supports_edit=True, markdown_dialect="telegram_markdown_v2", needs_rate_limit=True, edit_interval_ms=1000, max_file_size_mb=50
Discordmax_message_length=2000, length_unit="codepoints", supports_edit=True, needs_rate_limit=False, edit_interval_ms=500, max_files_per_message=10, max_file_size_mb=8
slack, whatsapp, linear, email, agentmailUses PlatformCapabilities() defaults until the adapter declares its own

Common patterns

Subclass with default_capabilities() (Telegram and Discord use this):
@classmethod
def default_capabilities(cls) -> PlatformCapabilities:
    return PlatformCapabilities(max_message_length=2000, supports_edit=True)
Serialise for config files:
caps = get_platform_capabilities("telegram")
data = caps.to_dict()
restored = PlatformCapabilities.from_dict(data)

Best practices

Telegram counts UTF-16 code units. Wrong length_unit can silently truncate messages.
Discord.py handles limits internally; raw Telegram HTTP does not.
UnifiedDelivery streams via edits when this flag is true.
Keeps registry caching consistent when platforms override defaults.

Bot Platform Plugins

Register custom adapters

Bot Streaming Replies

Uses supports_edit and edit_interval_ms

Bot Rate Limiting

Uses needs_rate_limit

Chunking Strategies

Uses max_message_length and length_unit