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
| Provider | Streaming | Typing | Chunking |
|---|---|---|---|
| Partial | Yes | Yes | |
| Telegram | Full | Yes | Yes |
| Discord | Full | Yes | Yes |
| No | No | Yes | |
| Feishu | Partial | Yes | Yes |
Typing Indicators
Configuration
{
"typing": {
"enabled": true,
"interval": 3000,
"stopOnComplete": true
}
}Behavior
- Indicators sent every
intervalms - Automatically stopped on response completion
- Provider-specific implementation
Message Chunking
Why Chunking?
- Platform message length limits
- Better user experience
- Reduced timeout risk
Chunk Settings
| Setting | Default | Description |
|---|---|---|
maxLength | 4000 | Max characters per chunk |
delimiter | \n\n | Preferred split point |
delay | 500 | Ms between chunks |
Example
Long response automatically split:
[Chunk 1] First part of response...
[Chunk 2] Continuation...
[Chunk 3] Final part...Stream Events
Event Types
| Event | Description |
|---|---|
stream_start | Streaming began |
stream_chunk | New content chunk |
stream_end | Streaming complete |
stream_error | Error 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
| Strategy | Description |
|---|---|
immediate | Send each token immediately |
batched | Batch tokens by interval |
adaptive | Adjust 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
- Adjust chunk size based on provider limits
- Enable typing indicators for better UX
- Use adaptive buffering for variable networks
- Monitor stream latency for optimization
Next Steps
- Clawdbot Concepts - Core concepts
- Clawdbot Channels - Channel setup
- Clawdbot Gateway - Gateway configuration