Skip to main content

A project to integrate together Agent Development Kit (ADK) with MongoDB session management as backend storage.

Project description

ADK MongoDB Session Service

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adk_mongodb_session-1.0.6.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adk_mongodb_session-1.0.6-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file adk_mongodb_session-1.0.6.tar.gz.

File metadata

  • Download URL: adk_mongodb_session-1.0.6.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for adk_mongodb_session-1.0.6.tar.gz
Algorithm Hash digest
SHA256 d58dea271a70e7e1d6aea22a64e3bff27d9ef316916a42b47ad641a0a94e19a3
MD5 6b301359e91cc07c8f844496a9169a9c
BLAKE2b-256 5685ad65774a94d1a2061c73f84f8381bb375a6761fe6e92db7264a4c3afc3f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for adk_mongodb_session-1.0.6.tar.gz:

Publisher: publish-to-pypi.yml on SergeySetti/adk-mongodb-session

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file adk_mongodb_session-1.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for adk_mongodb_session-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 01904a7a6f3ee4d8c34694136f776f7aaf722808e65c0f499928c19158cf7fc6
MD5 f1c56348f5f83e451c03e8c3a51ab8d7
BLAKE2b-256 90ce105aac1e154396319a932540547918eaf0affd2493d32516be28fdfdba95

See more details on using hashes here.

Provenance

The following attestation bundles were made for adk_mongodb_session-1.0.6-py3-none-any.whl:

Publisher: publish-to-pypi.yml on SergeySetti/adk-mongodb-session

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page