Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Azure Cosmos DB integrations for AI applications
Azure Cosmos DB for NoSQL integrates with the most widely used AI and LLM orchestration frameworks. These integrations provide a single persistence layer for vector search, chat history, semantic caching, agent state, and long-term memory. This article summarizes the available integrations and points to the official connector for each language.
All Azure Cosmos DB connectors support both account-key and Microsoft Entra ID (Managed Identity) authentication unless otherwise noted.
Integration support at a glance
| Framework | Python | .NET / C# | Java | JavaScript / TypeScript |
|---|---|---|---|---|
| Semantic Kernel | ✅ Vector store | ✅ Vector store | - | - |
| LangChain | ✅ Vector store, semantic cache, chat history | - | ✅ Embedding store | ✅ Vector store, semantic cache |
| LangGraph | ✅ Checkpointer, node cache, long-term memory | - | - | - |
| Agent Framework | ✅ Workflow checkpoint, history provider | ✅ Checkpoint store, chat history | - | - |
| LlamaIndex | ✅ Vector store, document store, index store, chat store, KV store | - | - | - |
| Spring AI | - | - | ✅ Vector store | - |
Semantic Kernel
Semantic Kernel is Microsoft's open-source SDK for building AI agents and multi-agent systems in Python, .NET, and Java.
Python
The CosmosNoSqlStore and CosmosNoSqlCollection classes provide vector store access. See the Semantic Kernel Python connector documentation.
.NET / C#
The Microsoft.SemanticKernel.Connectors.CosmosNoSql NuGet package provides a vector store connector implementing Microsoft.Extensions.VectorData. See the .NET connector documentation. Currently in preview.
Java
A native Azure Cosmos DB for NoSQL vector store connector isn't currently available in Semantic Kernel for Java. Java users can integrate via LangChain4j or Spring AI.
LangChain
LangChain is a framework for building LLM-powered applications, with implementations across Python, JavaScript, and Java.
Python
Use the langchain-azure-cosmosdb package as the Python connector. It provides six integrations across LangChain and LangGraph (see the LangGraph section for graph-specific components), each with synchronous and asynchronous variants.
| Functionality | Sync | Async |
|---|---|---|
| Vector store | AzureCosmosDBNoSqlVectorSearch |
AsyncAzureCosmosDBNoSqlVectorSearch |
| Semantic cache | AzureCosmosDBNoSqlSemanticCache |
AsyncAzureCosmosDBNoSqlSemanticCache |
| Chat message history | CosmosDBChatMessageHistory |
AsyncCosmosDBChatMessageHistory |
Capabilities include vector search (DiskANN, Quantized Flat, Flat indexes), full-text (BM25) search, hybrid search, weighted hybrid search, LLM response caching, and persistent chat message history.
JavaScript / TypeScript
The @langchain/azure-cosmosdb package provides AzureCosmosDBNoSQLVectorStore, AzureCosmosDBNoSQLSemanticCache, and AzureCosmosDBNoSQLChatMessageHistory. See the JS vector store documentation or follow the Get started with LangChain JS/TS tutorial for a step-by-step walkthrough.
Java
LangChain4j provides an Azure Cosmos DB for NoSQL embedding store. See the LangChain4j integration documentation.
LangGraph
LangGraph extends LangChain with stateful, multi-actor agent workflows.
Python
LangGraph integration ships in the same langchain-azure-cosmosdb package as the LangChain integration.
| Functionality | Sync | Async |
|---|---|---|
| Graph state persistence (checkpointer) | CosmosDBSaverSync |
CosmosDBSaver |
| Node-level result caching | CosmosDBCacheSync |
CosmosDBCache |
| Long-term memory store | CosmosDBStore |
AsyncCosmosDBStore |
The long-term memory store optionally uses vector search for semantic recall.
Agent Framework
Agent Framework is Microsoft's framework for building AI agents and multi-agent workflows, succeeding AutoGen and consolidating capabilities from Semantic Kernel agents.
Python
The Azure Cosmos DB package for Agent Framework Python provides:
CosmosDBWorkflowCheckpointStorage- workflow checkpoint storageCosmosDBHistoryProvider- chat history provider- Database and container setup utilities
.NET / C#
The Microsoft.Agents.AI.CosmosNoSql package provides:
CheckpointStore- workflow checkpoint storageChatHistoryProvider- chat history managementWorkflowExtensionsandChatExtensions- DI and integration helpers
Note
AutoGen users: AutoGen is now part of the Agent Framework. New projects should target Agent Framework directly. The legacy AutoGen 0.2 Azure Cosmos DB notes remain available for reference.
LlamaIndex
LlamaIndex is a framework for building context-augmented and RAG applications.
Python
LlamaIndex provides four Azure Cosmos DB for NoSQL integrations across its storage abstractions, allowing Cosmos DB to back the full LlamaIndex storage layer:
| Functionality | Class | Package |
|---|---|---|
| Vector store | AzureCosmosDBNoSqlVectorSearch |
llama-index-vector-stores-azurecosmosnosql |
| Document store | AzureCosmosNoSqlDocumentStore |
llama-index-storage-docstore-azurecosmosnosql |
| Index store | AzureCosmosNoSqlIndexStore |
llama-index-storage-index-store-azurecosmosnosql |
| Chat store | AzureCosmosNoSqlChatStore |
llama-index-storage-chat-store-azurecosmosnosql |
| Key-value store | AzureCosmosNoSqlKVStore |
llama-index-storage-kvstore-azurecosmosnosql |
The chat store, document store, index store, and key-value store all support authentication through connection string, account endpoint and key, or Microsoft Entra ID (for example, AzureCliCredential). For an end-to-end RAG walkthrough, see the LlamaIndex vector store example.
A native Azure Cosmos DB for NoSQL integration isn't currently available in LlamaIndex.TS, LlamaIndex.NET, or LlamaIndex Java.
Spring AI
Spring AI brings Spring's programming model to AI engineering in Java.
Java
Spring AI provides a vector store implementation backed by Azure Cosmos DB for NoSQL. See the Spring AI vector store documentation.
Related content
Feedback
Was this page helpful?
