AI & Agents

How to Configure OpenClaw Streaming and Response Chunking

OpenClaw ships two independent streaming layers, block streaming and preview streaming, but the docs drop you into a flat config reference with no map between them. This guide walks through each layer, explains how the EmbeddedBlockChunker splits long responses without breaking markdown, and provides per-channel recipes for Discord, Telegram, WhatsApp, and Slack. You will also learn how to store and version your streaming configs in a shared workspace so your whole team can iterate on them.

Fastio Editorial Team 11 min read
Real-time response delivery across messaging channels

Two Streaming Layers, One Gateway

OpenClaw connects 22+ messaging channels to a single AI gateway, but response delivery is not a single pipeline. The gateway runs two independent streaming layers that solve different problems.

A 2024 Forrester study found that a 2-second delay in chatbot responses can reduce task completion rates by 15 to 20 percent. For AI agents that produce multi-paragraph answers, the delay compounds. Users stare at a blank chat bubble while the model finishes generating, then receive a wall of text all at once. OpenClaw's two-layer approach addresses both sides of this problem.

Block streaming waits for the model to finish a logical chunk (a paragraph, a code block, a sentence) and sends it as a normal channel message. The user's chat history looks clean because each message is a complete, properly formatted unit. Block streaming is the structural layer: it controls how a long response gets split into separate messages.

Preview streaming tackles perceived latency. While the model is still generating, the gateway sends a temporary message and continuously updates it with new tokens. On Telegram, this means editing the same message via editMessageText. On Discord, it uses automation hooks edits. On Slack, it can use the native streaming API. The preview vanishes once the final block-streamed messages land.

These layers are independent. You can run block streaming without preview, preview without block, both together, or neither. Per-channel overrides let you tune each platform separately, which matters because a Discord server with inline embeds behaves differently from a WhatsApp thread with a 4,000-character message cap.

AI agent delivering structured responses across channels

How the EmbeddedBlockChunker Works

The EmbeddedBlockChunker is the engine behind block streaming. It buffers the model's output and decides where to split it into separate messages. Understanding its algorithm saves you from trial-and-error tuning.

The chunker uses a low/high bound system. It will not emit a chunk until the buffer reaches minChars (the low bound), and it prefers to split before maxChars (the high bound). If the buffer exceeds maxChars with no natural break point, it forces a hard split.

Between those bounds, the chunker looks for the best break point using a preference hierarchy: paragraph break first, then newline, then sentence boundary, then whitespace. You control this order with the breakPreference setting.

Break preference hierarchy (default order):

  1. Paragraph (double newline)
  2. Newline (single newline)
  3. Sentence (period, question mark, exclamation followed by space)
  4. Whitespace (any space character)
  5. Hard break (forced split at maxChars)

The chunker also handles code fences intelligently. If it must split inside a fenced code block, it closes the fence at the split point and reopens it in the next chunk. This keeps markdown rendering valid across all channels.

One constraint to plan for: maxChars is clamped to the channel's textChunkLimit. If you set maxChars: 6000 but WhatsApp's limit is 4,000 characters, the chunker will use 4,000. This happens silently, so check your channel limits before tuning chunk sizes.

Flush Modes

OpenClaw offers two flush modes that control when the chunker actually sends its buffered content. The streaming docs call these text_end and message_end.

The text_end mode flushes progressively. Each time the model completes a text segment, the chunker emits whatever it has buffered. Users see messages arrive during generation, which works well for conversational agents where responsiveness matters.

The message_end mode waits for the entire assistant response to finish before flushing. The chunker still applies its splitting logic to break long output into multiple messages, but nothing ships until generation is complete. This is useful when an agent runs tool calls mid-generation, because early text might be revised before the response is final.

How to Tune Streaming for Each Channel

Each messaging platform has different constraints: message length limits, edit support, and native streaming capabilities. OpenClaw lets you override streaming settings per channel through its configuration system, so you can optimize delivery for each platform independently.

Discord: preview plus block streaming

Discord supports message editing, which makes it a strong fit for preview streaming. Users see tokens arriving in a temporary message while the model generates, then block streaming sends the final formatted messages as permanent posts. You can also cap the number of lines per message to prevent enormous embeds from dominating the channel. The combination of both layers gives Discord users the best of both worlds: real-time feedback during generation and clean, readable output when the response is complete.

Telegram: preview streaming with tool progress

Telegram's message-editing API makes preview streaming work well here too. The useful addition for Telegram is tool progress: users see status indicators like "searching web" or "reading file" while the agent works through tool calls. This is especially valuable for agents that run multiple tools per response, because without progress indicators the user just sees a static "typing" state for several seconds.

WhatsApp: block streaming only

WhatsApp does not support editing sent messages, which rules out preview streaming entirely. Block streaming is the only option. The important constraint is WhatsApp's 4,000-character message limit. OpenClaw's chunker respects per-channel character caps, so it will split long responses into separate messages that fit within the limit. Set the break preference to paragraph or newline boundaries for cleaner splits.

Slack: native streaming transport

Slack offers its own streaming API that OpenClaw can use directly, bypassing the edit-based preview approach. Native transport delivers smoother incremental updates with lower latency than editing a message repeatedly. Pair it with block streaming and moderately aggressive coalescing to batch short fragments before sending, which keeps the channel from flooding with tiny updates.

Multi-channel AI response delivery configuration
Fastio features

Store and version your OpenClaw streaming configs

Free 50GB workspace with semantic search across your config files, agent logs, and response archives. No credit card, no expiration, MCP-ready for your agents.

Coalescing Settings to Reduce Message Spam

Without coalescing, a fast model can fire dozens of tiny messages in quick succession. The coalescing layer merges consecutive block chunks before sending, turning a stream of fragments into readable messages.

Three parameters control coalescing behavior. The minimum character threshold prevents tiny one-line fragments from shipping as standalone messages. The maximum character cap forces a send when the buffer gets large enough. The idle gap threshold flushes whatever is buffered when no new content has arrived for a set number of milliseconds.

The coalescer also respects your break preference when joining chunks. If set to paragraph mode, chunks are joined with double newlines. Newline mode joins with single newlines. This keeps the merged output formatted consistently.

You can override coalescing per channel. A WhatsApp channel might use aggressive coalescing (high minimum characters, long idle gap) to send fewer, larger messages. A Discord channel might use lighter coalescing so responses feel more interactive. The OpenClaw streaming docs list the exact config keys and their defaults per platform.

One common mistake: setting the idle gap too low on channels with rate limits. If your agent pauses briefly during tool calls, a short idle threshold triggers premature flushes, and the rapid message bursts can hit platform rate limits. Start with a 2-second idle gap and adjust downward only if responsiveness feels sluggish.

Human Delay and Natural Pacing

Raw streaming can feel robotic. Messages appear at machine speed with perfectly even timing that no human typist would produce. OpenClaw's human delay feature adds randomized pauses between block replies to make the conversation feel more natural.

Three modes are available. The default is off, with no delay and immediate sends. Natural mode adds randomized pauses between 800ms and 2,500ms, mimicking human typing rhythm. Custom mode lets you define the delay range yourself.

Human delay applies between block-streamed messages, not during preview streaming. This is intentional. Preview streaming should feel fast because it is showing work-in-progress. Block streaming delivers the finished product, and a brief pause between messages gives the reader time to process each one before the next arrives.

This setting is more useful than it might sound. In customer-facing bots, perfectly instant multi-message responses can feel overwhelming or robotic. In internal tools where speed matters more than polish, turn it off. Per-channel overrides let you use natural pacing for customer-facing WhatsApp while keeping instant delivery for your team's Slack channel.

The agent's response files, configuration, and prompt templates all benefit from version control. If you use a shared workspace like Fastio to store your OpenClaw configuration alongside agent outputs, every team member can see which streaming settings were active when a particular response was generated. Enable Intelligence Mode on the workspace and you can search your config history by meaning, asking questions like "when did we change the WhatsApp chunk limit?" Fastio's Business Trial includes 50GB of storage and included credits with no credit card required, which covers config files, agent logs, and the response archives that help you tune streaming over time. Agents can read and write config files through the Fastio MCP server, and ownership transfer lets a developer hand the workspace off to a client's team when the bot is ready for production.

Searching configuration history in an intelligent workspace

What to Do When Streaming Breaks

Messages arriving out of order on Telegram

Telegram rate-limits message edits. If preview streaming fires updates too quickly, they can arrive out of sequence. Fix this by increasing the idle gap in your coalescing settings, or switch from preview mode to block-only streaming. Block mode sends chunked updates as new messages without editing a draft, which sidesteps the edit rate limit entirely.

Code blocks splitting mid-line on WhatsApp

WhatsApp's 4,000-character limit can force splits inside code fences. The chunker closes and reopens fences automatically, but some WhatsApp clients render the closing fence oddly. Lower the max character threshold to give the chunker room to find a clean break before hitting the platform limit.

Excessive message spam on Discord

If your agent sends 15+ messages for a single response, your coalescing settings are too loose. Increase the minimum character threshold and idle gap timer so the coalescer batches more content per message. Also check the lines-per-message cap; setting it too low forces more splits than necessary.

Preview updates feel laggy on Slack

Enable native streaming transport if you have not already. The edit-based fallback adds round-trip latency per update. Native transport uses Slack's own streaming infrastructure and delivers smoother incremental updates. If native transport is already on, the bottleneck is likely your model's token generation speed, not OpenClaw's delivery layer.

Agent tool calls cause premature message breaks

When an agent runs tools mid-generation, the model pauses output. If the coalescing idle timer is set too low, the coalescer interprets this pause as idle time and flushes the buffer. The result is an incomplete first message followed by the rest of the response in a second message. Switch to message_end flush mode for agents that frequently use tools, or increase the idle threshold above the typical tool execution time.

Frequently Asked Questions

How do I enable streaming in OpenClaw?

Enable block streaming globally in your OpenClaw agent defaults, then configure preview streaming per channel. You can enable both layers independently or together. Block streaming controls how finished text gets split into messages, while preview streaming shows in-progress tokens in a temporary message. The OpenClaw streaming documentation at docs.openclaw.ai/concepts/streaming covers the exact configuration keys and their defaults.

What is block streaming vs preview streaming in OpenClaw?

Block streaming waits for the model to complete a logical section (paragraph, sentence, code block) and sends it as a permanent channel message. Preview streaming updates a temporary draft message in real time as tokens generate, then removes the preview once the final messages land. Block streaming is about structure (how to split long responses), while preview streaming is about perceived speed (showing progress during generation). Most deployments use both: preview streaming for responsiveness and block streaming for clean message formatting.

How do I configure OpenClaw streaming for Telegram?

Enable preview streaming on your Telegram channel for real-time updates via message editing, and turn on block streaming so finished blocks arrive as separate, well-formatted messages. Telegram also supports tool progress indicators, which show status lines like 'searching web' during tool calls. If you hit Telegram's edit rate limits, switch from preview mode to block-only streaming, which sends chunked updates as new messages without editing a draft.

How do I control message chunk size in OpenClaw?

Set minimum and maximum character bounds in your block streaming chunk configuration. The EmbeddedBlockChunker will not emit a chunk smaller than the minimum and will try to split before the maximum. The break preference setting controls where splits happen, with paragraph, newline, sentence, and whitespace as the available options. For channel-specific limits, each platform has a text chunk limit that overrides the global maximum if it is lower.

What does the coalescing setting do in OpenClaw streaming?

Coalescing merges consecutive small chunks into larger messages before sending. Without it, a fast model can spam dozens of tiny messages. The minimum character threshold prevents fragments below a certain size from sending alone, the max character setting caps the buffer, and the idle gap flushes the buffer after a pause in generation. You can override coalescing settings per channel so that each platform gets the right balance of responsiveness and readability.

Can I use different streaming modes on different channels?

Yes. OpenClaw supports per-channel overrides for all streaming settings. You can run preview streaming on Discord, block-only streaming on WhatsApp (which does not support message editing), and native streaming on Slack, all from the same gateway process. Each channel's configuration is independent, so you can tune delivery for each platform's constraints without affecting the others.

Related Resources

Fastio features

Store and version your OpenClaw streaming configs

Free 50GB workspace with semantic search across your config files, agent logs, and response archives. No credit card, no expiration, MCP-ready for your agents.