2.4.2 · Lesson 17 of 25
Streaming AI Responses
Normal response:
Overview
Normal response:
Request ↓ FM processes ↓ Wait ↓ Complete response
Streaming:
Request ↓ FM ↓ Chunk 1 Chunk 2 Chunk 3 Chunk 4 ↓ Client displays progressively
This improves perceived responsiveness.
Bedrock Streaming APIs
The model can return incremental output rather than waiting for the entire response.
WebSockets
Useful for persistent two-way communication.
Client ←──── WebSocket ────→ Server
Server-Sent Events
SSE allows the server to send incremental updates to the client.
Server │ ├── chunk 1 → Client ├── chunk 2 → Client ├── chunk 3 → Client └── chunk 4 → Client
Chunked Transfer
The response can be delivered in pieces rather than as one complete payload.
Exam clue
If the question says:
"Display generated text to the user as it becomes available"
Think:
Streaming
Key points
- Bedrock Streaming APIs
- WebSockets
- Server-Sent Events
- Chunked Transfer
- Request
- Client ←──── WebSocket ────→ Server
Exam focus
If the question says: "Display generated text to the user as it becomes available" Think: Streaming