Skip to main content
Every agent reply on Telegram, Slack, and Discord is split at paragraph boundaries, keeps its code fences intact, and is measured in the length unit each platform actually enforces.
The user asks a question; the delivery layer chunks the reply so a long, code-heavy, or emoji-heavy answer reaches them whole rather than being rejected by the platform’s length limit.

Quick Start

1

Nothing to configure

Chunking runs automatically on every adapter. A reply that fits the platform cap is sent as-is; a longer one is split at paragraph boundaries before sending.
2

Code fences stay intact

A fenced code block is kept whole rather than split mid-block, so users always see complete, copyable code.
3

Telegram measures in UTF-16

Telegram counts its 4096-character cap in UTF-16 code units. PraisonAI counts in the same unit, so emoji- and CJK-heavy replies are chunked at the point Telegram actually enforces.

How It Works

chunk_message splits the reply, using the platform’s length_unit to measure each piece. chunk_message(text, max_length, preserve_fences, length_unit) returns a list of chunks, each within the platform cap:
The adapter reads length_unit from its own platform_capabilities(), so you rarely call chunk_message yourself — it runs inside _send_long_message on every reply.

Platform Caps

Only Telegram declares length_unit="utf16" in the current SDK (TelegramBot.default_capabilities()). Every other adapter uses the "codepoints" default, where one character counts as one unit.

Common Patterns

A reply longer than the platform cap is split at paragraph boundaries and sent as several messages — no manual chunking needed in the agent.

Best Practices

The delivery layer already splits at paragraph boundaries and measures in the correct unit. Manual chunking inside the agent duplicates work and usually produces worse breaks.
If you build a custom adapter for a platform that counts UTF-16 (like Telegram), set length_unit="utf16" on its PlatformCapabilities so emoji/CJK replies are measured correctly.
Leaving preserve_fences=True keeps code blocks whole. Turn it off only when you specifically want a fenced block hard-split by character count.

Messaging Bots

Deploy bots on Telegram, Slack, and Discord

Bot Platform Capabilities

Per-platform length units and limits

Durable Outbound Delivery

Persist, retry, and drain outbound replies across restarts