AI / Apache Burr Interview questions
When would you choose a RunnableGraph over a single action for a parallel branch?
Choose a RunnableGraph when the thing you want to fan out isn’t a single computation but a small multi-step subflow — for example, a "process the prompt, then call the LLM" pair of actions that should run together as one parallel branch.
graph = ( GraphBuilder() .with_action(process_prompt=process_prompt, query_llm=query_llm) .with_transitions(("process_prompt", "query_llm")) .build() ) runnable_graph = RunnableGraph( graph=graph, entrypoint="process_prompt", halt_after=["query_llm"], ) class TestMultiplePromptsWithSubgraph(MapStates): def action(self, state, inputs): return runnable_graph def states(self, state, context, inputs): for prompt in [...]: yield state.update(prompt=prompt) ...
You return the RunnableGraph from .action()/.actions() exactly where you would otherwise return a plain Action — Burr treats it the same way under the hood, as a sub-application driven by recursion. Use a single action when one function is genuinely sufficient; reach for RunnableGraph as soon as that branch needs more than one step of its own logic.
More Related questions...