From aee59459078598544e1500578fbe8c4a93ae1f0a Mon Sep 17 00:00:00 2001 From: Sharath <29162020+tnfssc@users.noreply.github.com> Date: Fri, 6 Jun 2025 12:36:11 +0530 Subject: [PATCH 1/2] hotfix(context-limit): truncate more content to allow more messages --- backend/agentpress/thread_manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/agentpress/thread_manager.py b/backend/agentpress/thread_manager.py index e130b683..3c6dc465 100644 --- a/backend/agentpress/thread_manager.py +++ b/backend/agentpress/thread_manager.py @@ -345,11 +345,11 @@ Here are the XML tools available with examples: if self._is_tool_result_message(msg): # Only compress ToolResult messages _i += 1 # Count the number of ToolResult messages msg_token_count = token_counter(messages=[msg]) # Count the number of tokens in the message - if msg_token_count > 5000: # If the message is too long + if msg_token_count > 1000: # If the message is too long if _i > 1: # If this is not the most recent ToolResult message message_id = msg.get('message_id') # Get the message_id if message_id: - msg["content"] = msg["content"][:10000] + "... (truncated)" + f"\n\nThis message is too long, use the expand-message tool with message_id \"{message_id}\" to see the full message" # Truncate the message + msg["content"] = msg["content"][:3000] + "... (truncated)" + f"\n\nThis message is too long, use the expand-message tool with message_id \"{message_id}\" to see the full message" # Truncate the message else: msg["content"] = msg["content"][:200000] + f"\n\nThis message is too long, repeat relevant information in your response to remember it" # Truncate to 300k characters to avoid overloading the context at once, but don't truncate otherwise From 49c9e0b9faf0cb716bbce8163e7c15e742efc24e Mon Sep 17 00:00:00 2001 From: Sharath <29162020+tnfssc@users.noreply.github.com> Date: Fri, 6 Jun 2025 13:29:20 +0530 Subject: [PATCH 2/2] hotfix(langfuse): fix langfuse verison --- backend/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/requirements.txt b/backend/requirements.txt index cc58b88b..395edcae 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -32,7 +32,7 @@ stripe>=12.0.1 dramatiq>=1.17.1 pika>=1.3.2 prometheus-client>=0.21.1 -langfuse>=2.60.5 +langfuse==2.60.5 httpx>=0.24.0 Pillow>=10.0.0 sentry-sdk[fastapi]>=2.29.1