Skip to main content
Learn how to stream agent responses in real-time, providing immediate feedback and better user experience for long-running tasks.

Overview

Streaming enables:
  • Real-time output as the agent thinks
  • Better user experience with immediate feedback
  • Progress monitoring for long tasks
  • Integration with dashboards and UIs
  • Token-by-token response visualization

Basic Streaming

Enable streaming with a simple flag:

Streaming with Callback

Use callbacks to process streaming tokens in real-time:

Advanced Streaming Modes

1. Detailed Streaming (stream=True)

Get detailed token information with metadata:

2. Silent Streaming

Collect chunks without printing:

3. Custom Streaming Panel

Create custom visual displays:

Streaming in Multi-Agent Workflows

Concurrent Workflow with Streaming

Sequential Workflow with Streaming

Streaming Configuration

Agent-Level Configuration

Runtime Configuration

Real-World Examples

1. WebSocket Integration

2. Progress Bar Integration

3. File Logging

Best Practices

1. Buffer Management

2. Error Handling

3. Rate Limiting

Output Examples

Basic Streaming Output

Concurrent Workflow Dashboard

Troubleshooting

Streaming Not Working

Tokens Not Appearing

Next Steps

Learn More