diff --git a/burr/core/application.py b/burr/core/application.py index 569271b7..58b392f0 100644 --- a/burr/core/application.py +++ b/burr/core/application.py @@ -874,7 +874,7 @@ def _process_inputs(self, inputs: Dict[str, Any], action: Action) -> Dict[str, A raise ValueError( BASE_ERROR_MESSAGE + f"Inputs starting with a double underscore ({starting_with_double_underscore}) " - f"are reserved for internal use/injected inputs. " + f"are reserved for internal use/injected inputs." "Please do not directly pass keys starting with a double underscore." ) inputs = inputs.copy() @@ -945,12 +945,13 @@ async def _astep(self, inputs: Optional[Dict[str, Any]], _run_hooks: bool = True return None if inputs is None: inputs = {} + action_inputs = self._process_inputs(inputs, next_action) if _run_hooks: await self._adapter_set.call_all_lifecycle_hooks_sync_and_async( "pre_run_step", action=next_action, state=self._state, - inputs=inputs, + inputs=action_inputs, sequence_id=self.sequence_id, app_id=self._uid, partition_key=self._partition_key, @@ -965,12 +966,10 @@ async def _astep(self, inputs: Optional[Dict[str, Any]], _run_hooks: bool = True # TODO -- add an option/configuration to launch a thread (yikes, not super safe, but for a pure function # which this is supposed to be its OK). # this delegates hooks to the synchronous version, so we'll call all of them as well - # In this case we allow the self._step to do input processing - return self._step( - inputs=inputs, _run_hooks=False + next_action, result, new_state = self._step( + inputs=action_inputs, _run_hooks=False ) # Skip hooks as we already ran all of them/will run all of them in this function's finally - # In this case we want to process inputs because we run the function directly - action_inputs = self._process_inputs(inputs, next_action) + return next_action, result, new_state if next_action.single_step: result, new_state = await _arun_single_step_action( next_action, self._state, inputs=action_inputs