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(sentry): Add sentry filtering stop gap (#3185)

Kian Jones0ff12fdb44a0
diff --git a/letta/server/rest_api/app.py b/letta/server/rest_api/app.py
index 8ddb175f0..a3ff36d7c 100644
--- a/letta/server/rest_api/app.py
+++ b/letta/server/rest_api/app.py
@@ -160,6 +160,17 @@ async def lifespan(app_: FastAPI):
logger.info(f"[Worker {worker_id}] Lifespan shutdown completed")
+# TODO: Make this more robust
+def filter_out_sentry_errors(event, hint):
+ if (
+ "Fiel processing Failed" in str(event.get("exception"))
+ or "Failed to embed batch of size 32" in str(event.get("exception"))
+ or "`inputs` must have less than 512 tokens" in str(event.get("exception"))
+ ):
+ return None
+ return event
+
+
def create_application() -> "FastAPI":
"""the application start routine"""
# global server
@@ -175,6 +186,7 @@ def create_application() -> "FastAPI":
_experiments={
"continuous_profiling_auto_start": True,
},
+ before_send=filter_out_sentry_errors,
)
debug_mode = "--debug" in sys.argv