You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Vasanthan88 Thanks for opening this request. Could you please share more information about your use case? It will help us understand your request better.
Thank you
@klateefa : I have a mongo DB and I need to store the session using DatabaseSessionService. I need to use mongo DB instead of regular relational database
Something like DatabaseSessionService(Mongo_DB_URL) so that all the sessions, events,app are stored in the Mongo DB and it can be retrieved, created, deleted using default goolge adk api's.
I believe this feature is not implemented yet, from what I can see DatabaseSessionService currently supports SQLite, PostgreSQL and MySQL via SQLAlchemy. Please correct me if I'm wrong.
If adding a MongoDBSessionService aligns with your vision I would be happy to contribute, if so please assign the issue to me and I will start working on it.
Based on what I noticed from the source code, this is the approach I would take:
Subclass BaseSessionService and implement all 5 required methods (create_session, get_session, list_sessions, delete_session, append_event) using motor, the official async MongoDB Python driver.
Use two collections: sessions for metadata and state, and events for event JSON indexed by app_name, user_id, session_id and timestamp.
In append_event, call the existing base helpers _trim_temp_delta_state and _update_session_state to stay consistent with how other session services handle state deltas, then persist the event and update the session document.
Happy to discuss any design decisions before starting.
I believe this feature is not implemented yet, from what I can see DatabaseSessionService currently supports SQLite, PostgreSQL and MySQL via SQLAlchemy. Please correct me if I'm wrong.
If adding a MongoDBSessionService aligns with your vision I would be happy to contribute, if so please assign the issue to me and I will start working on it.
Based on what I noticed from the source code, this is the approach I would take:
Subclass BaseSessionService and implement all 5 required methods (create_session, get_session, list_sessions, delete_session, append_event) using motor, the official async MongoDB Python driver.
Use two collections: sessions for metadata and state, and events for event JSON indexed by app_name, user_id, session_id and timestamp.
In append_event, call the existing base helpers _trim_temp_delta_state and _update_session_state to stay consistent with how other session services handle state deltas, then persist the event and update the session document.
Happy to discuss any design decisions before starting.
The motor will no longer be maintained in a few months, and you can use the official import from Pymongo to Asynchronous MongoClient
Hi! I just came across this issue and wanted to check in. Is there still interest in getting an official MongoDBSessionService into the codebase? @JesserHamdaoui mentioned being willing to contribute, has there been any movement on that? I'm also interested in helping out.
Thanks everyone for the interest and discussion here! Quick update: we currently have an official MongoDB session integration ongoing and support for it will be landing soon. Stay tuned!
hi @Vasanthan88, thanks for asking for this, and thanks to everyone who weighed in on the thread. mongodb session storage landed in 9833835 (#7511, with thanks to @theshanbhag for building it) and shipped in 2.13.0. you can install it with pip install 'google-adk[mongodb]' and use MongoDbSessionService from google.adk.integrations.mongodb to store sessions, events, and app, user, and session state in mongodb. it's experimental for now, and there's a runner example in docs/guides/integrations/mongodb/session_service to get you started. if anything's missing for your setup, please open a new issue so we can take a look.
Activity
klateefa commentedon Mar 16, 2026
@Vasanthan88 Thanks for opening this request. Could you please share more information about your use case? It will help us understand your request better.
Thank you
Vasanthan88 commentedon Mar 16, 2026
@klateefa : I have a mongo DB and I need to store the session using DatabaseSessionService. I need to use mongo DB instead of regular relational database
Something like DatabaseSessionService(Mongo_DB_URL) so that all the sessions, events,app are stored in the Mongo DB and it can be retrieved, created, deleted using default goolge adk api's.
JesserHamdaoui commentedon Mar 17, 2026
@klateefa
I believe this feature is not implemented yet, from what I can see
DatabaseSessionServicecurrently supports SQLite, PostgreSQL and MySQL via SQLAlchemy. Please correct me if I'm wrong.If adding a
MongoDBSessionServicealigns with your vision I would be happy to contribute, if so please assign the issue to me and I will start working on it.Based on what I noticed from the source code, this is the approach I would take:
BaseSessionServiceand implement all 5 required methods (create_session,get_session,list_sessions,delete_session,append_event) using motor, the official async MongoDB Python driver.sessionsfor metadata and state, andeventsfor event JSON indexed byapp_name,user_id,session_idandtimestamp.append_event, call the existing base helpers_trim_temp_delta_stateand_update_session_stateto stay consistent with how other session services handle state deltas, then persist the event and update the session document.Happy to discuss any design decisions before starting.
InfernalAzazel commentedon Mar 23, 2026
The motor will no longer be maintained in a few months, and you can use the official import from Pymongo to Asynchronous MongoClient
InfernalAzazel commentedon Mar 23, 2026
Temporary use, waiting for official implementation
use
@Vasanthan88 This is a temporary solution in my project
atandon2024 commentedon Jun 28, 2026
Hi! I just came across this issue and wanted to check in. Is there still interest in getting an official MongoDBSessionService into the codebase? @JesserHamdaoui mentioned being willing to contribute, has there been any movement on that? I'm also interested in helping out.
JesserHamdaoui commentedon Jul 1, 2026
Hi @atandon2024
Go ahead! I'd be happy to review and help if needed.
adk-bot commentedon Jul 21, 2026
🚨 Automated Spam Detection Alert 🚨
@maintainers, a suspected spam comment was detected in this thread.
Reason:
DeanChensj commentedon Oct 14, 2026
Thanks everyone for the interest and discussion here! Quick update: we currently have an official MongoDB session integration ongoing and support for it will be landing soon. Stay tuned!
GWeale commentedon Oct 26, 2026
hi @Vasanthan88, thanks for asking for this, and thanks to everyone who weighed in on the thread. mongodb session storage landed in 9833835 (#7511, with thanks to @theshanbhag for building it) and shipped in 2.13.0. you can install it with
pip install 'google-adk[mongodb]'and use MongoDbSessionService from google.adk.integrations.mongodb to store sessions, events, and app, user, and session state in mongodb. it's experimental for now, and there's a runner example in docs/guides/integrations/mongodb/session_service to get you started. if anything's missing for your setup, please open a new issue so we can take a look.github-actions commentedon Oct 26, 2026
Are you satisfied with the resolution of your issue?
Yes
No