Skip to content

Python: Add Azure DocumentDB vector store connector - #8185

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 4 commits into
microsoft:mainfrom
eavanvalkenburg:azure-documentdb-vector-connector
Sep 14, 2026
Merged

Eduard van Valkenburg (eavanvalkenburg) merged 4 commits into
microsoft:mainfrom
eavanvalkenburg:azure-documentdb-vector-connector

Conversation

@eavanvalkenburg

Copy link
Copy Markdown
Member

Motivation & Context

Agent Framework needs a first-class Azure DocumentDB vector-store connector so Python applications can keep embeddings and source documents together while using the service's Mongo-compatible transport and DocumentDB-specific vector-search dialect. This contributes typed CRUD, metadata filtering, and dense retrieval for RAG and agent-memory scenarios without treating Azure DocumentDB as MongoDB Atlas or Azure Cosmos DB for NoSQL.

Description & Review Guide

  • What are the major changes? Adds the alpha agent-framework-azure-documentdb package with direct imports, PyMongo's stable AsyncMongoClient transport, createIndexes/cosmosSearchOptions lifecycle support for IVF, HNSW, and DiskANN, and $search.cosmosSearch query pipelines. The collection supports explicit BSON string/integer keys, multiple vector paths, storage aliases, type-aware BSON metadata filters, native score thresholds before server-side paging, bounded/chunked batch operations, settings precedence, and caller-owned client/database/collection injection. The package also includes a concise consumer README, a package-local sample, workspace/package-status/lock registration, unit and command-capture coverage, and a credential-gated managed integration scenario.
  • What is the impact of these changes? Python users can opt into Azure DocumentDB vector storage without changing the stable core install surface; the alpha package is intentionally excluded from core[all] and lazy namespaces. Existing applications are unaffected. The connector rejects unsupported key coercion, hybrid/full-text search, nested filter paths, compressed vectors, and incompatible existing indexes rather than silently changing semantics. It uses the existing Python package syntax, unit, typing, and build CI paths; no fake-green managed-service job is added.
  • What do you want reviewers to focus on? Please focus on the DocumentDB-specific index reconciliation and $search.cosmosSearch pipeline, portable filter missing/null/bool-number semantics, native threshold/paging behavior, batch preflight/partial-write reporting, and created-versus-injected client ownership. Managed ARM provisioning was exercised successfully on disposable M10/server-8.0 resources, but the restricted data-plane TLS handshake could not be established; all resources were deleted, and this PR does not claim managed query execution validation.

Related Issue

Related to #4168 and #1188.

This is the Azure DocumentDB-only partial contribution and intentionally does not close either umbrella because other Phase 6 connectors remain. The open #8184 covers the separate MongoDB connector and does not overlap this package or service contract. The issue-exclusivity checklist item remains unchecked because these umbrella issues intentionally have parallel independent connector PRs.

Contribution Checklist

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAF Automated Review — Iteration 1

Result: Findings reported
Scope: full PR (1 commit(s)): fb8faddc5a41
Model: gpt-5.6-sol-fast

Overview

The PR adds a carefully validated Azure DocumentDB vector-store package with strong BSON/type preflight, explicit client ownership, bounded batch calls, index reconciliation, and broad unit coverage. One compatibility gap remains: the connector reuses Mongo query operators inside DocumentDB's distinct cosmosSearch filter dialect, causing negative filtered vector searches to fail.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
1 verified finding remained after source verification (1 medium) across 1 file. Details are attached to the affected lines below.

Affected areas: python/packages/azure-documentdb/agent_framework_azure_documentdb/_vector_store.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The vector prefilter emits the wrong inequality dialect, and the sample command bypasses the local workspace package.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds an alpha Azure DocumentDB vector-store connector for Python, supporting typed CRUD, metadata filtering, index management, and vector search.

Changes:

  • Implements the DocumentDB collection/store and configuration APIs.
  • Adds documentation, packaging, and a runnable sample.
  • Adds unit and credential-gated integration coverage.
File summaries
File Description
python/uv.lock Locks the connector and PyMongo.
python/pyproject.toml Registers the workspace package.
python/PACKAGE_STATUS.md Marks the package alpha.
python/packages/azure-documentdb/pyproject.toml Defines package metadata and tooling.
python/packages/azure-documentdb/LICENSE Adds the MIT license.
python/packages/azure-documentdb/README.md Documents setup, usage, and limits.
python/packages/azure-documentdb/agent_framework_azure_documentdb/__init__.py Exposes the public API.
python/packages/azure-documentdb/agent_framework_azure_documentdb/_vector_store.py Implements connector behavior.
python/packages/azure-documentdb/agent_framework_azure_documentdb/py.typed Marks the package typed.
python/packages/azure-documentdb/samples/README.md Documents sample execution.
python/packages/azure-documentdb/samples/azure_documentdb_vectors.py Demonstrates vector operations.
python/packages/azure-documentdb/tests/azure_documentdb/conftest.py Provides test fixtures.
python/packages/azure-documentdb/tests/azure_documentdb/test_vector_store.py Covers CRUD, filters, indexes, and search.
python/packages/azure-documentdb/tests/azure_documentdb/test_settings.py Covers settings and ownership.
python/packages/azure-documentdb/tests/azure_documentdb/test_integration.py Adds managed-service integration coverage.
Review details
  • Files reviewed: 13/15 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread python/packages/azure-documentdb/samples/azure_documentdb_vectors.py Outdated
Add an alpha Azure DocumentDB vector-store package using PyMongo async APIs and the DocumentDB cosmosSearch dialect.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 52e1edc1-384b-4163-b8bd-f659a510ad1f
Run the package-local sample through the workspace package and add managed negative-filter coverage while retaining the standard Mongo $ne wire operator.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 52e1edc1-384b-4163-b8bd-f659a510ad1f
Apply maximum score thresholds for raw Euclidean distance while retaining minimum thresholds for cosine and inner product scores.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 52e1edc1-384b-4163-b8bd-f659a510ad1f
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 52e1edc1-384b-4163-b8bd-f659a510ad1f
Merged via the queue into microsoft:main with commit 7abe2ff Sep 14, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants