From 7b2e7e2f4cd867c38548fb1a4023e91e30676c8d Mon Sep 17 00:00:00 2001 From: cthomas Date: Tue, 21 Oct 2025 13:02:18 -0700 Subject: [PATCH] feat: remove un-paginated message list on usage stats [LET-5747] (#5599) feat: remove un-paginated message list on usage stats --- fern/openapi.json | 18 ------------------ letta/schemas/usage.py | 1 - letta/server/rest_api/utils.py | 2 +- tests/test_sdk_client.py | 1 - 4 files changed, 1 insertion(+), 21 deletions(-) diff --git a/fern/openapi.json b/fern/openapi.json index 2b5a7a75..cde9fa4d 100644 --- a/fern/openapi.json +++ b/fern/openapi.json @@ -31250,24 +31250,6 @@ "description": "The number of steps taken by the agent.", "default": 0 }, - "steps_messages": { - "anyOf": [ - { - "items": { - "items": { - "$ref": "#/components/schemas/Message" - }, - "type": "array" - }, - "type": "array" - }, - { - "type": "null" - } - ], - "title": "Steps Messages", - "description": "The messages generated per step" - }, "run_ids": { "anyOf": [ { diff --git a/letta/schemas/usage.py b/letta/schemas/usage.py index d2f2c688..547c61da 100644 --- a/letta/schemas/usage.py +++ b/letta/schemas/usage.py @@ -22,5 +22,4 @@ class LettaUsageStatistics(BaseModel): total_tokens: int = Field(0, description="The total number of tokens processed by the agent.") step_count: int = Field(0, description="The number of steps taken by the agent.") # TODO: Optional for now. This field makes everyone's lives easier - steps_messages: Optional[List[List[Message]]] = Field(None, description="The messages generated per step") run_ids: Optional[List[str]] = Field(None, description="The background task run IDs associated with the agent interaction") diff --git a/letta/server/rest_api/utils.py b/letta/server/rest_api/utils.py index 048dd3ae..972dd13c 100644 --- a/letta/server/rest_api/utils.py +++ b/letta/server/rest_api/utils.py @@ -121,7 +121,7 @@ async def sse_async_generator( err_msg = f"Expected LettaUsageStatistics, got {type(usage)}" logger.error(err_msg) raise ValueError(err_msg) - yield sse_formatter(usage.model_dump(exclude={"steps_messages"})) + yield sse_formatter(usage.model_dump()) except ContextWindowExceededError as e: capture_sentry_exception(e) diff --git a/tests/test_sdk_client.py b/tests/test_sdk_client.py index 396e88ca..a7196c7c 100644 --- a/tests/test_sdk_client.py +++ b/tests/test_sdk_client.py @@ -2363,7 +2363,6 @@ def test_create_agent(client: LettaSDKClient) -> None: "prompt_tokens", "total_tokens", "step_count", - "steps_messages", "run_ids", }, )