From 6f51fa74be2421d99be98595073223f78dedc3fa Mon Sep 17 00:00:00 2001 From: jnjpng Date: Tue, 10 Feb 2026 12:22:10 -0800 Subject: [PATCH] fix: handling should continue for non system exceeded exceptions (#9406) * base * add log --- letta/agents/letta_agent_v3.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/letta/agents/letta_agent_v3.py b/letta/agents/letta_agent_v3.py index 5c8cc9d2..2edc5f7a 100644 --- a/letta/agents/letta_agent_v3.py +++ b/letta/agents/letta_agent_v3.py @@ -1221,6 +1221,14 @@ class LettaAgentV3(LettaAgentV2): self.logger.warning(f"Error during step processing: {error_detail}") self.job_update_metadata = {"error": error_detail} + # Stop the agent loop on any exception to prevent wasteful retry loops + # (e.g., if post-step compaction fails, we don't want to keep retrying) + self.should_continue = False + self.logger.warning( + f"Agent loop stopped due to exception (step_progression={step_progression.name}, " + f"exception_type={type(e).__name__}): {error_detail}" + ) + # This indicates we failed after we decided to stop stepping, which indicates a bug with our flow. if not self.stop_reason: self.stop_reason = LettaStopReason(stop_reason=StopReasonType.error.value)