Skip to content

Commit 74e1d74

Browse files
committed
feat: Add engine property accessor to SQLAlchemySession
Adds a read-only engine property to provide direct access to the underlying AsyncEngine for advanced use cases such as: - Checking connection pool status - Configuring engine settings - Manually disposing the engine when needed Users are responsible for managing the engine lifecycle when using the engine property directly.
1 parent 9db9c01 commit 74e1d74

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/agents/extensions/memory/sqlalchemy_session.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,3 +319,16 @@ async def clear_session(self) -> None:
319319
await sess.execute(
320320
delete(self._sessions).where(self._sessions.c.session_id == self.session_id)
321321
)
322+
323+
@property
324+
def engine(self) -> AsyncEngine:
325+
"""Access the underlying SQLAlchemy AsyncEngine.
326+
327+
This property provides direct access to the engine for advanced use cases,
328+
such as checking connection pool status, configuring engine settings,
329+
or manually disposing the engine when needed.
330+
331+
Returns:
332+
AsyncEngine: The SQLAlchemy async engine instance.
333+
"""
334+
return self._engine

0 commit comments

Comments
 (0)