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.

feat: remove organization id from trace object in api (#2952)

cthomas7eb80ca318ad
diff --git a/letta/adapters/letta_llm_request_adapter.py b/letta/adapters/letta_llm_request_adapter.py
index 6d98a6fd5..705965aaa 100644
--- a/letta/adapters/letta_llm_request_adapter.py
+++ b/letta/adapters/letta_llm_request_adapter.py
@@ -106,7 +106,6 @@ class LettaLLMRequestAdapter(LettaLLMAdapter):
request_json=self.request_data,
response_json=self.response_data,
step_id=step_id, # Use original step_id for telemetry
- organization_id=actor.organization_id,
),
),
label="create_provider_trace",
diff --git a/letta/adapters/letta_llm_stream_adapter.py b/letta/adapters/letta_llm_stream_adapter.py
index 98a3b46fd..565cf455e 100644
--- a/letta/adapters/letta_llm_stream_adapter.py
+++ b/letta/adapters/letta_llm_stream_adapter.py
@@ -164,7 +164,6 @@ class LettaLLMStreamAdapter(LettaLLMAdapter):
},
},
step_id=step_id, # Use original step_id for telemetry
- organization_id=actor.organization_id,
),
),
label="create_provider_trace",
diff --git a/letta/agents/letta_agent.py b/letta/agents/letta_agent.py
index e5639be0f..2551e6c25 100644
--- a/letta/agents/letta_agent.py
+++ b/letta/agents/letta_agent.py
@@ -405,7 +405,6 @@ class LettaAgent(BaseAgent):
request_json=request_data,
response_json=response_data,
step_id=step_id, # Use original step_id for telemetry
- organization_id=self.actor.organization_id,
),
)
step_progression = StepProgression.LOGGED_TRACE
@@ -751,7 +750,6 @@ class LettaAgent(BaseAgent):
request_json=request_data,
response_json=response_data,
step_id=step_id, # Use original step_id for telemetry
- organization_id=self.actor.organization_id,
),
)
step_progression = StepProgression.LOGGED_TRACE
@@ -1173,7 +1171,6 @@ class LettaAgent(BaseAgent):
},
},
step_id=step_id, # Use original step_id for telemetry
- organization_id=self.actor.organization_id,
),
)
step_progression = StepProgression.LOGGED_TRACE
diff --git a/letta/llm_api/llm_api_tools.py b/letta/llm_api/llm_api_tools.py
index 8a75bc7bf..c10e24570 100644
--- a/letta/llm_api/llm_api_tools.py
+++ b/letta/llm_api/llm_api_tools.py
@@ -235,7 +235,6 @@ def create(
request_json=prepare_openai_payload(data),
response_json=response.model_json_schema(),
step_id=step_id,
- organization_id=actor.organization_id,
),
)
diff --git a/letta/llm_api/llm_client_base.py b/letta/llm_api/llm_client_base.py
index af3730a83..ccbfc3b8e 100644
--- a/letta/llm_api/llm_client_base.py
+++ b/letta/llm_api/llm_client_base.py
@@ -64,7 +64,6 @@ class LLMClientBase:
request_json=request_data,
response_json=response_data,
step_id=step_id,
- organization_id=self.actor.organization_id,
),
)
log_event(name="llm_response_received", attributes=response_data)
@@ -98,7 +97,6 @@ class LLMClientBase:
request_json=request_data,
response_json=response_data,
step_id=step_id,
- organization_id=self.actor.organization_id,
),
)
diff --git a/letta/schemas/provider_trace.py b/letta/schemas/provider_trace.py
index bcc151def..382f4b8f0 100644
--- a/letta/schemas/provider_trace.py
+++ b/letta/schemas/provider_trace.py
@@ -19,7 +19,6 @@ class ProviderTraceCreate(BaseModel):
request_json: dict[str, Any] = Field(..., description="JSON content of the provider request")
response_json: dict[str, Any] = Field(..., description="JSON content of the provider response")
step_id: str = Field(None, description="ID of the step that this trace is associated with")
- organization_id: str = Field(..., description="The unique identifier of the organization.")
class ProviderTrace(BaseProviderTrace):
@@ -39,5 +38,4 @@ class ProviderTrace(BaseProviderTrace):
request_json: Dict[str, Any] = Field(..., description="JSON content of the provider request")
response_json: Dict[str, Any] = Field(..., description="JSON content of the provider response")
step_id: Optional[str] = Field(None, description="ID of the step that this trace is associated with")
- organization_id: str = Field(..., description="The unique identifier of the organization.")
created_at: datetime = Field(default_factory=get_utc_time, description="The timestamp when the object was created.")
diff --git a/letta/services/telemetry_manager.py b/letta/services/telemetry_manager.py
index b23d62463..804343f91 100644
--- a/letta/services/telemetry_manager.py
+++ b/letta/services/telemetry_manager.py
@@ -26,6 +26,7 @@ class TelemetryManager:
async def create_provider_trace_async(self, actor: PydanticUser, provider_trace_create: ProviderTraceCreate) -> PydanticProviderTrace:
async with db_registry.async_session() as session:
provider_trace = ProviderTraceModel(**provider_trace_create.model_dump())
+ provider_trace.organization_id = actor.organization_id
if provider_trace_create.request_json:
request_json_str = json_dumps(provider_trace_create.request_json)
provider_trace.request_json = json_loads(request_json_str)
@@ -43,6 +44,7 @@ class TelemetryManager:
def create_provider_trace(self, actor: PydanticUser, provider_trace_create: ProviderTraceCreate) -> PydanticProviderTrace:
with db_registry.session() as session:
provider_trace = ProviderTraceModel(**provider_trace_create.model_dump())
+ provider_trace.organization_id = actor.organization_id
if provider_trace_create.request_json:
request_json_str = json_dumps(provider_trace_create.request_json)
provider_trace.request_json = json_loads(request_json_str)