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: avoid holding sessions open (#6769)

Sarah Wooders0634aa13a1c7
diff --git a/letta/services/step_manager.py b/letta/services/step_manager.py
index c64a1e089..605717ebd 100644
--- a/letta/services/step_manager.py
+++ b/letta/services/step_manager.py
@@ -363,12 +363,10 @@ class StepManager:
await session.commit()
pydantic_step = step.to_pydantic()
-
- # Send webhook notification for step completion
- webhook_service = WebhookService()
- await webhook_service.notify_step_complete(step_id)
-
- return pydantic_step
+ # Send webhook notification for step completion outside the DB session
+ webhook_service = WebhookService()
+ await webhook_service.notify_step_complete(step_id)
+ return pydantic_step
@enforce_types
@trace_method
@@ -416,12 +414,10 @@ class StepManager:
await session.commit()
pydantic_step = step.to_pydantic()
-
- # Send webhook notification for step completion
- webhook_service = WebhookService()
- await webhook_service.notify_step_complete(step_id)
-
- return pydantic_step
+ # Send webhook notification for step completion outside the DB session
+ webhook_service = WebhookService()
+ await webhook_service.notify_step_complete(step_id)
+ return pydantic_step
@enforce_types
@trace_method
@@ -458,12 +454,10 @@ class StepManager:
await session.commit()
pydantic_step = step.to_pydantic()
-
- # Send webhook notification for step completion
- webhook_service = WebhookService()
- await webhook_service.notify_step_complete(step_id)
-
- return pydantic_step
+ # Send webhook notification for step completion outside the DB session
+ webhook_service = WebhookService()
+ await webhook_service.notify_step_complete(step_id)
+ return pydantic_step
@enforce_types
@trace_method