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: add project id during run creation [LET-5960] (#5846)

Christina Tong9524d7937c81
diff --git a/letta/services/run_manager.py b/letta/services/run_manager.py
index ca6b74ce2..7a6b324ef 100644
--- a/letta/services/run_manager.py
+++ b/letta/services/run_manager.py
@@ -63,14 +63,16 @@ class RunManager:
run = RunModel(**run_data)
run.organization_id = organization_id
- run = await run.create_async(session, actor=actor, no_commit=True, no_refresh=True)
-
- # Create run metrics with start timestamp
- import time
# Get the project_id from the agent
agent = await session.get(AgentModel, agent_id)
project_id = agent.project_id if agent else None
+ run.project_id = project_id
+
+ run = await run.create_async(session, actor=actor, no_commit=True, no_refresh=True)
+
+ # Create run metrics with start timestamp
+ import time
metrics = RunMetricsModel(
id=run.id,
@@ -328,8 +330,8 @@ class RunManager:
logger.error(error_message)
result["callback_error"] = error_message
# Continue silently - callback failures should not affect run completion
- finally:
- return result
+
+ return result
@enforce_types
@raise_on_invalid_id(param_name="run_id", expected_prefix=PrimitiveType.RUN)