Clawdbot Streaming

Learn about Clawdbot AI assistant streaming responses, chunking, typing indicators, and real-time message delivery.

Clawdbot Streaming Overview

Clawdbot supports streaming responses for real-time AI interactions. Streaming enables typing indicators, partial message updates, and chunked delivery for long responses.

Streaming Modes

Full Streaming

Full streaming delivers tokens as they're generated:

{
  "streaming": {
    "mode": "full",
    "chunkSize": 50
  }
}

Chunked Delivery

Chunked delivery splits long responses:

{
  "streaming": {
    "mode": "chunked",
    "maxLength": 4000,
    "delimiter": "\n\n"
  }
}

Provider Support

ProviderStreamingTypingChunking
WhatsAppPartialYesYes
TelegramFullYesYes
DiscordFullYesYes
WeChatNoNoYes
FeishuPartialYesYes

Typing Indicators

Configuration

{
  "typing": {
    "enabled": true,
    "interval": 3000,
    "stopOnComplete": true
  }
}

Behavior

  • Indicators sent every interval ms
  • Automatically stopped on response completion
  • Provider-specific implementation

Message Chunking

Why Chunking?

  • Platform message length limits
  • Better user experience
  • Reduced timeout risk

Chunk Settings

SettingDefaultDescription
maxLength4000Max characters per chunk
delimiter\n\nPreferred split point
delay500Ms between chunks

Example

Long response automatically split:

[Chunk 1] First part of response...

[Chunk 2] Continuation...

[Chunk 3] Final part...

Stream Events

Event Types

EventDescription
stream_startStreaming began
stream_chunkNew content chunk
stream_endStreaming complete
stream_errorError occurred

WebSocket Events

ws.on('message', (data) => {
  const event = JSON.parse(data);

  switch(event.type) {
    case 'stream_start':
      // Show typing indicator
      break;
    case 'stream_chunk':
      // Append content
      break;
    case 'stream_end':
      // Hide typing indicator
      break;
  }
});

Buffer Management

Configuration

{
  "buffer": {
    "maxSize": 10000,
    "flushInterval": 100,
    "strategy": "adaptive"
  }
}

Strategies

StrategyDescription
immediateSend each token immediately
batchedBatch tokens by interval
adaptiveAdjust based on network

Error Handling

Retry on Stream Error

{
  "streaming": {
    "retry": {
      "enabled": true,
      "maxAttempts": 3,
      "backoff": "exponential"
    }
  }
}

Fallback to Non-Streaming

If streaming fails, Clawdbot falls back to non-streaming delivery automatically.

Performance Tips

  1. Adjust chunk size based on provider limits
  2. Enable typing indicators for better UX
  3. Use adaptive buffering for variable networks
  4. Monitor stream latency for optimization

Next Steps