Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
feat: ade support for showing errored messages in ade
Andy Lieb3babc687ea
diff --git a/letta/schemas/letta_message.py b/letta/schemas/letta_message.pyindex d1e9b2a70..1e772191d 100644--- a/letta/schemas/letta_message.py+++ b/letta/schemas/letta_message.py@@ -63,13 +63,13 @@ class LettaMessage(BaseModel):dt = dt.replace(tzinfo=timezone.utc)return dt.isoformat(timespec="seconds")- @field_serializer("is_err", when_used="unless-none")- def serialize_is_err(self, value: bool | None, _info):+ @field_serializer("is_err", mode="wrap")+ def serialize_is_err(self, value: bool | None, handler, _info):"""Only serialize is_err field when it's True (for debugging purposes).When is_err is None or False, this field will be excluded from the JSON output."""- return value if value is True else None+ return handler(value) if value is True else Noneclass SystemMessage(LettaMessage):diff --git a/letta/schemas/message.py b/letta/schemas/message.pyindex ec690577a..73bf73db6 100644--- a/letta/schemas/message.py+++ b/letta/schemas/message.py@@ -269,6 +269,7 @@ class Message(BaseMessage):otid=otid,sender_id=self.sender_id,step_id=self.step_id,+ is_err=self.is_err,))# Otherwise, we may have a list of multiple types@@ -287,6 +288,7 @@ class Message(BaseMessage):otid=otid,sender_id=self.sender_id,step_id=self.step_id,+ is_err=self.is_err,))elif isinstance(content_part, ReasoningContent):@@ -301,6 +303,7 @@ class Message(BaseMessage):name=self.name,otid=otid,step_id=self.step_id,+ is_err=self.is_err,))elif isinstance(content_part, RedactedReasoningContent):@@ -315,6 +318,7 @@ class Message(BaseMessage):otid=otid,sender_id=self.sender_id,step_id=self.step_id,+ is_err=self.is_err,))elif isinstance(content_part, OmittedReasoningContent):@@ -328,6 +332,7 @@ class Message(BaseMessage):name=self.name,otid=otid,step_id=self.step_id,+ is_err=self.is_err,))else:@@ -355,6 +360,7 @@ class Message(BaseMessage):otid=otid,sender_id=self.sender_id,step_id=self.step_id,+ is_err=self.is_err,))else:@@ -371,6 +377,7 @@ class Message(BaseMessage):otid=otid,sender_id=self.sender_id,step_id=self.step_id,+ is_err=self.is_err,))elif self.role == MessageRole.tool:@@ -416,6 +423,7 @@ class Message(BaseMessage):otid=Message.generate_otid_from_id(self.id, len(messages)),sender_id=self.sender_id,step_id=self.step_id,+ is_err=self.is_err,))elif self.role == MessageRole.user:@@ -437,6 +445,7 @@ class Message(BaseMessage):otid=self.otid,sender_id=self.sender_id,step_id=self.step_id,+ is_err=self.is_err,))elif self.role == MessageRole.system:diff --git a/letta/server/rest_api/streaming_response.py b/letta/server/rest_api/streaming_response.pyindex 4daf65a7f..344d067df 100644--- a/letta/server/rest_api/streaming_response.py+++ b/letta/server/rest_api/streaming_response.py@@ -125,14 +125,7 @@ class StreamingResponseWithStatusCode(StreamingResponse):if not isinstance(content, bytes):content = content.encode(self.charset)more_body = False- await send(- {- "type": "http.response.body",- "body": content,- "more_body": more_body,- }- )- raise Exception(f"An exception occurred mid-stream with status code {status_code}", detail={"content": content})+ raise Exception(f"An exception occurred mid-stream with status code {status_code} with content {content}")else:content = chunk