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: step metrics db timeouts [LET-6697] (#8136)

cthomase904330dde37
diff --git a/letta/orm/step.py b/letta/orm/step.py
index 00f7a37b2..13d6d5525 100644
--- a/letta/orm/step.py
+++ b/letta/orm/step.py
@@ -75,9 +75,9 @@ class Step(SqlalchemyBase, ProjectMixin):
status: Mapped[Optional[StepStatus]] = mapped_column(None, nullable=True, doc="Step status: pending, success, or failed")
# Relationships (foreign keys)
- organization: Mapped[Optional["Organization"]] = relationship("Organization")
- provider: Mapped[Optional["Provider"]] = relationship("Provider")
- run: Mapped[Optional["Run"]] = relationship("Run", back_populates="steps")
+ organization: Mapped[Optional["Organization"]] = relationship("Organization", lazy="raise")
+ provider: Mapped[Optional["Provider"]] = relationship("Provider", lazy="raise")
+ run: Mapped[Optional["Run"]] = relationship("Run", back_populates="steps", lazy="raise")
# Relationships (backrefs)
messages: Mapped[List["Message"]] = relationship("Message", back_populates="step", cascade="save-update", lazy="noload")
diff --git a/letta/orm/step_metrics.py b/letta/orm/step_metrics.py
index ead5feda7..267630f44 100644
--- a/letta/orm/step_metrics.py
+++ b/letta/orm/step_metrics.py
@@ -82,8 +82,8 @@ class StepMetrics(SqlalchemyBase, ProjectMixin, AgentMixin):
# Relationships (foreign keys)
step: Mapped["Step"] = relationship("Step", back_populates="metrics", uselist=False)
- run: Mapped[Optional["Run"]] = relationship("Run")
- agent: Mapped[Optional["Agent"]] = relationship("Agent")
+ run: Mapped[Optional["Run"]] = relationship("Run", lazy="raise")
+ agent: Mapped[Optional["Agent"]] = relationship("Agent", lazy="raise")
def create(
self,