NumPy allowed · plain Python earns 10 bonus points
Implement a state-merge reducer, the real mechanism graph-based agent frameworks use to combine a node's partial output into the shared workflow state (some fields append, some overwrite).
Implement merge_state_update(current_state, update, list_keys). For keys in list_keys, the merged value is current_state.get(key, []) + update[key] (append/extend, list-valued fields like message history). For all other keys in update, simply overwrite current_state's value. Return the new merged dict (don't mutate current_state).
merge_state_update(current_state: dict, update: dict, list_keys: list[str]) -> dict