AI / Apache Burr Interview questions
Explain the execution flow of a streaming action from the first yield to the last?
A streaming action is written as a generator, and Burr treats every yield except the last as an intermediate result, with the final yield carrying the real state update:
flowchart TD
A["application.stream_result() called"] --> B["Action's stream_run() starts executing"]
B --> C["Chunk arrives from underlying source (e.g. LLM token)"]
C --> D["yield {'response': delta}, None"]
D --> E{"More chunks?"}
E -- "Yes" --> C
E -- "No, source exhausted" --> F["yield {'response': full_response}, state.append(...)"]
F --> G["StreamingResultContainer marks iterator complete"]
G --> H["Hooks / state persistence fire using the FINAL yield's state"]
H --> I["Caller retrieves (result, state) via .get()"]
Concretely: on each intermediate yield the tuple is (partial_result_dict, None) — the None tells Burr not to touch state yet. On the very last yield, the tuple becomes (final_result_dict, updated_state), and that is what gets merged into the application’s real state and passed to any hooks or persisters. Forgetting that last yield means the action never actually commits a state update, even though the caller saw all the streamed text.
More Related questions...