def _step_callback()

in backend.py [0:0]


    def _step_callback(self, step, output_queue):
        if hasattr(step, "error") and step.error:
            output_queue.put(("STEP_ERROR", step.error.message))
        elif hasattr(step, "model_output"):
            thought = step.model_output.strip() if step.model_output else "None"
            action = (
                str([tc.dict() for tc in step.tool_calls])
                if step.tool_calls
                else "None"
            )
            observation = step.observations if step.observations else "None"
            full_output = (
                f"Step {step.step_number}\n\n"
                f"{thought}\n"
                f"\n"
                f"Action:\n"
                f"{action}\n"
                f"\n"
                f"Observation:\n"
                f"{observation}\n"
            )
            output_queue.put(("STEP", (str(thought), str(full_output))))
            if step.tool_calls and "final_answer" in step.tool_calls[0].arguments:
                output_queue.put(("FINAL_ANSWER", str(step.action_output)))