Strands' model stream produces a sequence of StreamEvents (token deltas, tool-use chunks, message-stop, etc.). With TemporalAgent(streaming_topic="events"), the model activity publishes each chunk onto a workflow-hosted WorkflowStream; external subscribers read it via WorkflowStreamClient. Chunks are batched on streaming_batch_interval (default 100ms) to keep activity overhead low.
- Hosting a
WorkflowStreamon a workflow TemporalAgent(streaming_topic=...)publishing model events- An external subscriber reading
StreamEvents in real time viaWorkflowStreamClient
# Terminal 1
uv run strands_plugin/streaming/run_worker.py
# Terminal 2
uv run strands_plugin/streaming/run_workflow.pyThe starter prints text deltas as they arrive, then the final workflow result.
| File | Description |
|---|---|
workflow.py |
StreamingWorkflow hosting WorkflowStream + TemporalAgent(streaming_topic="events") |
run_worker.py |
Registers StrandsPlugin, starts the worker |
run_workflow.py |
Starts the workflow and subscribes to the events topic |