diff --git a/src/khoj/processor/operator/operate_browser.py b/src/khoj/processor/operator/operate_browser.py index ce69a6fd..a3944fb6 100644 --- a/src/khoj/processor/operator/operate_browser.py +++ b/src/khoj/processor/operator/operate_browser.py @@ -138,14 +138,6 @@ async def operate_browser( response = summary_message else: # Hit iteration limit response = f"Operator hit iteration limit ({max_iterations}). If the results seem incomplete try again, assign a smaller task or try a different approach.\nThese were the results till now:\n{summary_message}" - except requests.RequestException as e: - error_msg = f"Browser use failed due to a network error: {e}" - logger.error(error_msg) - raise ValueError(error_msg) - except Exception as e: - error_msg = f"Browser use failed due to an unexpected error: {e}" - logger.exception(error_msg) # Log full traceback for unexpected errors - raise ValueError(error_msg) finally: if environment and not user_input_message: # Don't close browser if user input required await environment.close() diff --git a/src/khoj/processor/operator/operator_agent_binary.py b/src/khoj/processor/operator/operator_agent_binary.py index 0b274f57..c506070e 100644 --- a/src/khoj/processor/operator/operator_agent_binary.py +++ b/src/khoj/processor/operator/operator_agent_binary.py @@ -168,6 +168,7 @@ Focus on the visual action and provide all necessary context. logger.info(f"Reasoning LLM suggested action: {natural_language_action}") except Exception as e: + logger.error(f"Error calling Reasoning LLM: {e}", exc_info=True) return {"type": "error", "message": f"Error calling Reasoning LLM: {e}"} return {"type": "action", "message": natural_language_action} @@ -212,7 +213,7 @@ Focus on the visual action and provide all necessary context. rendered_parts += [f"**Action**: {action.type}"] action_results += [{"content": None}] # content set after environment step except Exception as e: - logger.error(f"Error calling Grounding LLM: {e}") + logger.error(f"Error calling Grounding LLM: {e}", exc_info=True) rendered_parts += [f"**Error**: Error contacting Grounding LLM: {e}"] rendered_response = self._render_response(rendered_parts, current_state.screenshot) @@ -256,6 +257,8 @@ Focus on the visual action and provide all necessary context. # Append action results to history action_results_content = [] for action_result in agent_action.action_results: + if not action_result.get("content"): + logger.error("Action result content is empty or None: {action_result}") action_results_content.extend(action_result["content"]) self.messages.append(AgentMessage(role="environment", content=action_results_content))