diff --git a/agent.py b/agent.py index 031b2b9..74bd856 100644 --- a/agent.py +++ b/agent.py @@ -564,7 +564,8 @@ class Agent: system=system, ) except TimeoutError as e: - error_msg = "⏱️ Task timed out after 20 minutes. This is a very large task - consider breaking it into smaller steps or delegating to a background sub-agent." + # Use the detailed timeout message from llm_interface.py + error_msg = str(e) if str(e) else "⏱️ Task timed out - consider breaking it into smaller steps or using delegate_task." print(f"[Agent] TIMEOUT: {error_msg}") self.healing_system.capture_error( error=e, @@ -578,6 +579,7 @@ class Agent: ) return error_msg except Exception as e: + # Include actual error message for better debugging error_msg = f"Agent SDK error: {e}" print(f"[Agent] {error_msg}") self.healing_system.capture_error( @@ -589,7 +591,8 @@ class Agent: "message_preview": user_message[:100], }, ) - return "Sorry, I encountered an error communicating with the AI model. Please try again." + # Return the actual error message instead of generic text + return f"Sorry, I encountered an error: {str(e)[:500]}" finally: # Always stop progress updates when done self._stop_progress_updates() @@ -658,7 +661,8 @@ class Agent: "iteration": iteration, }, ) - return "Sorry, I encountered an error communicating with the AI model. Please try again." + # Return actual error message instead of generic text + return f"Sorry, I encountered an error: {str(e)[:500]}" if response.stop_reason == "end_turn": text_content = []