Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

fix(core): return 400 for ContextWindowExceededError instead of 500 (#9348)

Kian Jones32d87b70d761
diff --git a/letta/server/rest_api/app.py b/letta/server/rest_api/app.py
index 91d8905f2..e984a37ee 100644
--- a/letta/server/rest_api/app.py
+++ b/letta/server/rest_api/app.py
@@ -33,6 +33,7 @@ from letta.errors import (
AgentNotFoundForExportError,
BedrockPermissionError,
ConcurrentUpdateError,
+ ContextWindowExceededError,
ConversationBusyError,
EmbeddingConfigRequiredError,
HandleNotFoundError,
@@ -513,6 +514,7 @@ def create_application() -> "FastAPI":
app.add_exception_handler(AgentFileImportError, _error_handler_400)
app.add_exception_handler(EmbeddingConfigRequiredError, _error_handler_400)
app.add_exception_handler(LettaImageFetchError, _error_handler_400)
+ app.add_exception_handler(ContextWindowExceededError, _error_handler_400)
app.add_exception_handler(ValueError, _error_handler_400)
# 404 Not Found errors