diff --git a/src/khoj/processor/operator/operate_browser.py b/src/khoj/processor/operator/operate_browser.py index e5a56bfc..871f1288 100644 --- a/src/khoj/processor/operator/operate_browser.py +++ b/src/khoj/processor/operator/operate_browser.py @@ -144,6 +144,8 @@ async def operate_browser( finally: if environment and not user_input_message: # Don't close browser if user input required await environment.close() + if operator_agent: + operator_agent.reset() yield { "text": user_input_message or response, diff --git a/src/khoj/processor/operator/operator_agent_binary.py b/src/khoj/processor/operator/operator_agent_binary.py index c0d39726..6573f906 100644 --- a/src/khoj/processor/operator/operator_agent_binary.py +++ b/src/khoj/processor/operator/operator_agent_binary.py @@ -168,7 +168,6 @@ Focus on the visual action and provide all necessary context. actions: List[OperatorAction] = [] action_results: List[dict] = [] rendered_parts = [f"**Thought (Vision)**: {action_instruction}"] - self.grounding_agent.reset() # Reset grounding agent state try: grounding_response, actions = await self.grounding_agent.act(action_instruction, current_state) @@ -318,3 +317,4 @@ Focus on the visual action and provide all necessary context. def reset(self): """Reset the agent state.""" super().reset() + self.grounding_agent.reset() # Reset grounding agent state