Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
feat: add llm obs patch (#7449)
Kian Jones3c0502454c1f
diff --git a/letta/server/rest_api/app.py b/letta/server/rest_api/app.pyindex 56772be7d..be4b821d2 100644--- a/letta/server/rest_api/app.py+++ b/letta/server/rest_api/app.py@@ -241,10 +241,6 @@ def create_application() -> "FastAPI":os.environ.setdefault("DD_PROFILING_MEMORY_ENABLED", str(telemetry_settings.datadog_profiling_memory_enabled).lower())os.environ.setdefault("DD_PROFILING_HEAP_ENABLED", str(telemetry_settings.datadog_profiling_heap_enabled).lower())- # Enable LLM Observability for tracking LLM calls, prompts, and completions- os.environ.setdefault("DD_LLMOBS_ENABLED", "1")- os.environ.setdefault("DD_LLMOBS_ML_APP", "memgpt-server")-# Note: DD_LOGS_INJECTION, DD_APPSEC_ENABLED, DD_IAST_ENABLED, DD_APPSEC_SCA_ENABLED# are set via deployment configs and automatically picked up by ddtrace@@ -252,6 +248,15 @@ def create_application() -> "FastAPI":import ddtraceddtrace.patch_all() # Auto-instrument FastAPI, HTTP, DB, etc.++ llmobs_flag = os.getenv("DD_LLMOBS_ENABLED", "")+ from ddtrace.llmobs import LLMObs++ if llmobs_flag:+ LLMObs.enable(+ ml_app=os.getenv("DD_LLMOBS_ML_APP") or telemetry_settings.datadog_service_name,+ )+logger.info(f"Datadog tracer initialized: env={dd_env}, "f"service={telemetry_settings.datadog_service_name}, "