AI / Apache Burr Interview questions
What is the difference between step and iterate in a Burr Application?
step/astep and iterate/aiterate both run actions, but at different granularities:
| API | Behavior |
step / astep | Runs exactly one action and returns the tuple (action, result, state). Best for manual, step-by-step control. |
iterate / aiterate | Calls step repeatedly as a generator until a halt_before/halt_after condition is met, yielding each (action, result, state) along the way. |
run / arun | A convenience wrapper around iterate that just returns its final value instead of a generator. |
for action, result, state in application.iterate(halt_after=["final_action"]): print(action.name, result)
You would reach for step when you need to inspect or react to every single action (e.g. custom UI updates between turns), and iterate/run for the common "just run it to completion" case.
More Related questions...