FastAPI Streaming
This example demonstrates how to implement streaming responses with the Multi-Agent Orchestrator using FastAPI. It shows how to build a simple API that streams responses from multiple AI agents in real-time.
Features
- Real-time streaming responses using FastAPI’s
StreamingResponse
- Custom streaming handler implementation
- Multiple agent support (Tech and Health agents)
- Queue-based token streaming
- CORS-enabled API endpoint
Quick Start
API Endpoint
Request body:
Implementation Highlights
- Uses FastAPI’s event streaming capabilities
- Custom callback handler for real-time token streaming
- Thread-safe queue implementation for token management
- Configurable orchestrator with multiple specialized agents
- Error handling and proper stream closure
Example Usage
Ready to build your own multi-agent chat application? Check out the complete source code in our GitHub repository.