Python: Add Azure Cosmos DB NoSQL vector store connector - #8186
Python: Add Azure Cosmos DB NoSQL vector store connector#8186Eduard van Valkenburg (eavanvalkenburg) wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Dependency compatibility, identifier validation, policy normalization, service limits, and vector paging need correction.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds the Azure Cosmos DB for NoSQL vector-store connector as part of the Phase 6 roadmap.
Changes:
- Implements vector CRUD, filtering, search, policy validation, and lifecycle management.
- Exposes Cosmos vector APIs through the Azure namespace.
- Adds documentation plus unit and integration coverage.
File summaries
| File | Description |
|---|---|
python/uv.lock |
Updates the Cosmos SDK dependency. |
python/packages/core/tests/core/test_azure_namespace.py |
Tests lazy Cosmos exports. |
python/packages/core/agent_framework/azure/__init__.pyi |
Types the new exports. |
python/packages/core/agent_framework/azure/__init__.py |
Adds lazy namespace mappings. |
python/packages/azure-cosmos/tests/azure_cosmos/test_vector_store.py |
Adds comprehensive unit tests. |
python/packages/azure-cosmos/tests/azure_cosmos/test_vector_store_integration.py |
Adds live-service coverage. |
python/packages/azure-cosmos/README.md |
Documents connector usage and constraints. |
python/packages/azure-cosmos/pyproject.toml |
Updates metadata and dependencies. |
python/packages/azure-cosmos/AGENTS.md |
Documents package capabilities. |
python/packages/azure-cosmos/agent_framework_azure_cosmos/py.typed |
Marks the package as typed. |
python/packages/azure-cosmos/agent_framework_azure_cosmos/_vector_store.py |
Implements the connector. |
python/packages/azure-cosmos/agent_framework_azure_cosmos/__init__.py |
Exports the public APIs. |
python/AGENTS.md |
Updates the package catalog. |
Review details
Suppressed comments (1)
python/packages/azure-cosmos/agent_framework_azure_cosmos/_vector_store.py:383
- This accepts values 10–24, but the current Cosmos container schema requires
indexingSearchListSizeto be at least 25. These values therefore fail only when the service creates the DiskANN container instead of failing fast.
if type(indexing_list_size) is not int or not 10 <= indexing_list_size <= 500:
raise ValueError("indexing_search_list_size must be an integer between 10 and 500.")
- Files reviewed: 11/13 changed files
- Comments generated: 6
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: Findings reported
Scope: full PR (1 commit(s)): 60dba97cb472
Model: gpt-5.6-sol-fast
Overview
The review found 3 verified inline finding(s).
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
3 verified findings remained after source verification (2 high, 1 medium) across 2 files. Details are attached to the affected lines below.
Affected areas: python/packages/azure-cosmos/agent_framework_azure_cosmos/__init__.py, python/packages/azure-cosmos/agent_framework_azure_cosmos/_vector_store.py
|
Addressed the suppressed vector-index limit finding in |
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
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 52e1edc1-384b-4163-b8bd-f659a510ad1f
786f4a2 to
6aab9f5
Compare
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 52e1edc1-384b-4163-b8bd-f659a510ad1f
Motivation & Context
Azure Cosmos DB for NoSQL provides native vector indexing and
VectorDistancequeries, but Agent Framework does not yet expose it through the shared Python vector-store abstractions. This adds the Cosmos DB for NoSQL portion of the Phase 6 connector roadmap so applications can keep vectors and JSON records together while using Agent Framework's common CRUD, filtering, and search APIs.This contribution is intentionally limited to Azure Cosmos DB for NoSQL. It does not add Azure DocumentDB, Cosmos DB for MongoDB, MongoDB query dialects, server-side embedding, full-text search, or hybrid search.
Description & Review Guide
agent-framework-azure-cosmospackage withCosmosCollection,CosmosStore, andAzureCosmosSettings; adds lazyagent_framework.azureexports; derives immutable container vector/index policies from vector-store definitions; and implements batch CRUD, portable filter translation, and native vector search. Records require an application-provided string key stored asid, with the container partitioned by/id, so key get/delete operations remain unambiguous point operations. Supported vector element types are float32, int8, and uint8, with flat, quantizedFlat, and DiskANN indexes and cosine, dot-product, and Euclidean metrics. Float16 is rejected before service I/O, and Euclidean search is supported without score thresholds because directVectorDistancepredicates do not reliably enforce Euclidean cutoffs./idpartition-key contract, immutable policy reconciliation, JSON/filter semantic preservation, SQL identifier/value safety, cross-partition partial-write behavior, client ownership, and the fail-fast float16 and Euclidean-threshold boundaries.Related Issue
Related to #4168 and #1188.
This is the Azure Cosmos DB for NoSQL-only partial contribution. It intentionally does not close either umbrella issue because the remaining Phase 6 connectors, including the separate Mongo-compatible surfaces, are still outstanding. No open pull request uses this head branch.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.