Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: pass in stop_reason for sleeptime loop (#8086)
Sarah Woodersc5c633285b0f
diff --git a/letta/groups/sleeptime_multi_agent_v3.py b/letta/groups/sleeptime_multi_agent_v3.pyindex df00fabd1..9a1d338a2 100644--- a/letta/groups/sleeptime_multi_agent_v3.py+++ b/letta/groups/sleeptime_multi_agent_v3.py@@ -13,6 +13,7 @@ from letta.schemas.job import JobUpdatefrom letta.schemas.letta_message import MessageTypefrom letta.schemas.letta_message_content import TextContentfrom letta.schemas.letta_response import LettaResponse+from letta.schemas.letta_stop_reason import StopReasonTypefrom letta.schemas.message import Message, MessageCreatefrom letta.schemas.run import Run, RunUpdatefrom letta.schemas.user import User@@ -214,6 +215,7 @@ class SleeptimeMultiAgentV3(LettaAgentV2):run_update = RunUpdate(status=RunStatus.completed,completed_at=datetime.now(timezone.utc).replace(tzinfo=None),+ stop_reason=result.stop_reason.stop_reason if result.stop_reason else StopReasonType.end_turn,metadata={"result": result.model_dump(mode="json"),"agent_id": sleeptime_agent_state.id,@@ -225,6 +227,7 @@ class SleeptimeMultiAgentV3(LettaAgentV2):run_update = RunUpdate(status=RunStatus.failed,completed_at=datetime.now(timezone.utc).replace(tzinfo=None),+ stop_reason=StopReasonType.error,metadata={"error": str(e)},)await self.run_manager.update_run_by_id_async(run_id=run_id, update=run_update, actor=self.actor)diff --git a/letta/groups/sleeptime_multi_agent_v4.py b/letta/groups/sleeptime_multi_agent_v4.pyindex 7b0ebc35d..bd4c9cf18 100644--- a/letta/groups/sleeptime_multi_agent_v4.py+++ b/letta/groups/sleeptime_multi_agent_v4.py@@ -13,6 +13,7 @@ from letta.schemas.job import JobUpdatefrom letta.schemas.letta_message import MessageTypefrom letta.schemas.letta_message_content import TextContentfrom letta.schemas.letta_response import LettaResponse+from letta.schemas.letta_stop_reason import StopReasonTypefrom letta.schemas.message import Message, MessageCreatefrom letta.schemas.run import Run, RunUpdatefrom letta.schemas.user import User@@ -231,6 +232,7 @@ class SleeptimeMultiAgentV4(LettaAgentV3):run_update = RunUpdate(status=RunStatus.completed,completed_at=datetime.now(timezone.utc).replace(tzinfo=None),+ stop_reason=result.stop_reason.stop_reason if result.stop_reason else StopReasonType.end_turn,metadata={"result": result.model_dump(mode="json"),"agent_id": sleeptime_agent_state.id,@@ -242,6 +244,7 @@ class SleeptimeMultiAgentV4(LettaAgentV3):run_update = RunUpdate(status=RunStatus.failed,completed_at=datetime.now(timezone.utc).replace(tzinfo=None),+ stop_reason=StopReasonType.error,metadata={"error": str(e)},)await self.run_manager.update_run_by_id_async(run_id=run_id, update=run_update, actor=self.actor)