AI / Apache Burr Interview questions
How does tracking get linked between a parent application and a sub-application?
Inside the parent action that spawns a sub-application, you request the ApplicationContext via the special __context parameter, then wire two things into the child’s ApplicationBuilder: a copy of the parent’s tracker, and the parent’s identifying coordinates via with_spawning_parent(...).
@action(reads=["parameters_to_map"], writes=["joined_results"]) def run_multiple_sub_apps(state: State, __context: ApplicationContext) -> State: results = [] for parameter_set in state["parameters_to_map"]: subapp = ( ApplicationBuilder() .with_actions(...) .with_transitions(...) .with_tracker(__context.tracker.copy()) .with_spawning_parent( __context.app_id, __context.sequence_id, __context.partition_key, ) .with_entrypoint(...) .with_state(...) .build() ) results.append(subapp.run(...)) return state.update(joined_results=_join(results))
Calling .copy() on the tracker (rather than reusing the same instance directly) is required so the child doesn’t corrupt the parent’s tracking state; forgetting it is a known footgun the docs call out explicitly. Once wired, the Burr UI renders the sub-application as a nested "child" run under the step that launched it.
More Related questions...