Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.
Python aiburrchatbot-frameworkdagsgenerative-aigraphshacktoberfestllmopsllmsmlopspersistent-data-structurestate-machinestate-managementvisibility
Fixes bug in which lifecycle hook got passed null action
elijahbenizzy760ac288da19
diff --git a/burr/core/application.py b/burr/core/application.pyindex c5d19d61..bb801e02 100644--- a/burr/core/application.py+++ b/burr/core/application.py@@ -211,13 +211,13 @@ class Application::return: Tuple[Function, dict, State] -- the function that was just ran, the result of running it, and the new state"""next_action = self.get_next_action()+ if next_action is None:+ return Noneif inputs is None:inputs = {}self._adapter_set.call_all_lifecycle_hooks_sync("pre_run_step", action=next_action, state=self._state)- if next_action is None:- return Noneexc = Noneresult = Nonenew_state = self._statediff --git a/tests/core/test_application.py b/tests/core/test_application.pyindex 8391fefc..a178e7c7 100644--- a/tests/core/test_application.py+++ b/tests/core/test_application.py@@ -792,6 +792,8 @@ def test_application_run_step_hooks_sync():assert set(tracker.post_called) == {"counter", "result"}assert len(tracker.pre_called) == 11assert len(tracker.post_called) == 11+ # quick inclusion to ensure that the action is not called when we're done running+ assert app.step() is None # should be Noneasync def test_application_run_step_hooks_async():