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: correct negative step execution time metrics (#3117)

Eric Ly4d15b08b2cd9
diff --git a/letta/agents/letta_agent.py b/letta/agents/letta_agent.py
index 750a42b1d..c48251b5f 100644
--- a/letta/agents/letta_agent.py
+++ b/letta/agents/letta_agent.py
@@ -464,7 +464,7 @@ class LettaAgent(BaseAgent):
),
)
- MetricRegistry().step_execution_time_ms_histogram.record(step_start - get_utc_timestamp_ns(), get_ctx_attributes())
+ MetricRegistry().step_execution_time_ms_histogram.record(get_utc_timestamp_ns() - step_start, get_ctx_attributes())
if not should_continue:
break
@@ -701,7 +701,7 @@ class LettaAgent(BaseAgent):
yield f"data: {tool_return.model_dump_json()}\n\n"
# TODO (cliandy): consolidate and expand with trace
- MetricRegistry().step_execution_time_ms_histogram.record(step_start - get_utc_timestamp_ns(), get_ctx_attributes())
+ MetricRegistry().step_execution_time_ms_histogram.record(get_utc_timestamp_ns() - step_start, get_ctx_attributes())
if not should_continue:
break