Skip to content

feat(memory): Add QdrantMemoryService backed by Qdrant vector search #193

Open

Description

@Goodnight77

Summary

Add a QdrantMemoryService to google.adk_community.memory: a BaseMemoryService backed by Qdrant vector search, scoped per app_name and user_id.

Motivation

Core ADK ships InMemoryMemoryService (keyword match, not persistent) and the Vertex AI services (GCP only). Self-hosted and non-GCP users need a persistent, semantic memory backend. Qdrant is a widely used open-source vector DB that runs as Docker, Qdrant Cloud, or in-process (AsyncQdrantClient(":memory:")), so one service covers local dev, CI and production. There is no Qdrant integration in adk-python or in this repo today.

Proposed API

from qdrant_client import AsyncQdrantClient
from google.adk_community.memory import QdrantMemoryService, QdrantMemoryServiceConfig

memory_service = QdrantMemoryService(
    client=AsyncQdrantClient(url="http://localhost:6333"),
    embedding_function=my_embed,  # async (list[str]) -> list[list[float]]
    config=QdrantMemoryServiceConfig(collection_name="adk_memory"),
)
  • The caller owns the client and the embedding function, so the package doesn't depend on any embedding provider (same signature as the Valkey PR feat: add ValkeyMemoryService with vector similarity search (Valkey Search module) #156).
  • Implements add_session_to_memory, add_events_to_memory, add_memory, search_memory and delete_memory.
  • Point ids are deterministic (app/user/event id), so re-adding a session upserts instead of duplicating.
  • Every search and delete is filtered by app_name and user_id, so one user can't read or delete another user's memories.
  • The collection and payload indexes are created on first write (opt-out).
  • New optional extra qdrant = ["qdrant-client>=1.12.0"], imported lazily, so the base install doesn't change.

Testing plan

  • Unit tests with a mocked AsyncQdrantClient (collection creation, payloads, scoping, ids, error paths).
  • One test against qdrant-client's in-process mode with a fake embedding. It needs no server, so it runs in CI.
  • Manual E2E with a Runner and a Qdrant Docker container; logs will be in the PR.

I have the implementation and tests ready and will open a PR linked to this issue, followed by a docs page in google/adk-docs.

I will work on this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions