Skip to main content

MongoDB Session Service for Google ADK (Agent Development Kit)

PyPI version Python Package CI

A session management library for the Google ADK framework that uses MongoDB as a backend.

This package provides a MongodbSessionService that implements the google.adk.sessions.base_session_service.BaseSessionService abstract base class. It allows you to store and manage session state in a MongoDB database, fully replicating the three-tiered state management (app, user, and session) found in the core ADK session services.

Installation

You can install the package from PyPI:

pip install adk-mongodb-session

Usage

First, instantiate the MongodbSessionService with your MongoDB connection details.

import asyncio
from adk_mongodb_session.mongodb.sessions import MongodbSessionService

# Initialize the service
session_service = MongodbSessionService(
    db_url="mongodb://localhost:27017/",
    database="my_adk_agent_db",
    collection_prefix="sessions"  # This will create sessions_sessions, sessions_app_states, etc.
)

# ... and then use it in your async context

example_session = await session_service.create_session(
    app_name="my_app",
    user_id="example_user",
    state={"initial_key": "initial_value"} # State can be initialized
)

Running Tests

For development, clone the repository and install it in editable mode with the testing dependencies:

git clone https://github.com/your-username/adk-mongodb-session.git
cd adk-mongodb-session
pip install -e ".[test]"

Then, run the tests using unittest:

python -m unittest discover tests

Contributing

Contributions are welcome! Please see the CONTRIBUTING.md file for details on how to report bugs, suggest enhancements, and submit pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for adk-mongodb-session 1.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adk-mongodb-session 1.0.9
File Size Uploaded Provenance Actions
adk_mongodb_session-1.0.9.tar.gz 6.9 kB With provenance Details for adk_mongodb_session-1.0.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for adk-mongodb-session 1.0.9
File Interpreter ABI Platform Actions
adk_mongodb_session-1.0.9-py3-none-any.whl Python 3 none any Details for adk_mongodb_session-1.0.9-py3-none-any.whl

Total release size: 13.6 kB

Release files / adk_mongodb_session-1.0.9.tar.gz

Download URL adk_mongodb_session-1.0.9.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
305a3686b26a38f4f0ed1d593059c39984f8435d5362e768b615a48ade6af215
BLAKE2b-256 checksum
How to use checksums
cab176b21e3d6a8396a3eb95f14037317ebc094805f4c42c034c4cb979a51184
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2025.

Transparency log

Release files / adk_mongodb_session-1.0.9-py3-none-any.whl

Download URL adk_mongodb_session-1.0.9-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c591d75b990e87b12acecec86e5c4fc209fd1e4996370d3e63c97ec4f9160a39
BLAKE2b-256 checksum
How to use checksums
6f03dc49526d58dc34029e7b0286750a917bcc9cab4874810fe7a8d91c455bde
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2025.

Transparency log

Security for adk-mongodb-session 1.0.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for adk_mongodb_session-1.0.9.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page