Skip to content

Commit 699acdb

Browse files
committed
fix: windows sql lite session
1 parent 324f1d6 commit 699acdb

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

  • packages/uipath-openai-agents/src/uipath_openai_agents/runtime

packages/uipath-openai-agents/src/uipath_openai_agents/runtime/runtime.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ async def _run_agent(
211211
is_resuming = bool(options and options.resume)
212212

213213
# Get or create session for state persistence
214+
# Close any existing session before creating a new one
215+
if self._session:
216+
self._session.close()
217+
self._session = None
218+
214219
# SQLiteSession automatically loads existing data from the database when created
215220
if self.storage_path:
216221
self._session = SQLiteSession(self.runtime_id, self.storage_path)
@@ -487,6 +492,10 @@ async def get_schema(self) -> UiPathRuntimeSchema:
487492

488493
async def dispose(self) -> None:
489494
"""Cleanup runtime resources."""
495+
# Close OpenAI Agents SDK session if it exists
496+
if self._session:
497+
self._session.close()
498+
self._session = None
499+
490500
# Storage is shared across runtimes and managed by the factory
491501
# Do not dispose it here
492-
pass

0 commit comments

Comments
 (0)