<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/native-agent-memory-with-azure-cosmos-db-8flymz4pd" -->

---
title: Native agent memory with Azure Cosmos DB | daily.dev
description: Microsoft has released a preview Python package, agent-framework-azure-cosmos-memory, that gives Microsoft Agent Framework agents durable, cross-session memory...
canonical: https://daily.dev/posts/native-agent-memory-with-azure-cosmos-db-8flymz4pd
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Native agent memory with Azure Cosmos DB | daily.dev
og:description: Microsoft has released a preview Python package, agent-framework-azure-cosmos-memory, that gives Microsoft Agent Framework agents durable, cross-session memory...
og:url: https://daily.dev/posts/native-agent-memory-with-azure-cosmos-db-8flymz4pd
og:image: https://api.daily.dev/og/posts/8flymZ4Pd.png
og:image:alt: Native agent memory with Azure Cosmos DB
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Native agent memory with Azure Cosmos DB

**[DevBlogs](https://daily.dev/sources/devblogs)** · 5 min read · 1 upvotes · 0 comments

## Summary

Microsoft has released a preview Python package, agent-framework-azure-cosmos-memory, that gives Microsoft Agent Framework agents durable, cross-session memory backed by Azure Cosmos DB. The CosmosMemoryContextProvider attaches to an agent's context-provider lifecycle: before a run it retrieves relevant memories, and after a run it stores conversation turns while the Azure Cosmos DB Agent Memory Toolkit extracts facts, generates summaries, and updates user profiles in the background. Memory is scoped to a stable user_id and supports vector, full-text, and hybrid retrieval, with domain-specific extraction via custom Prompty templates. The integration is Python-only and its APIs may change before general availability.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://devblogs.microsoft.com/agent-framework/native-memory-for-microsoft-agent-framework-with-azure-cosmos-db>

## Questions this post answers

### How do I add persistent cross-session memory to a Microsoft Agent Framework agent using Azure Cosmos DB?

Install the preview package agent-framework-azure-cosmos-memory along with agent-framework-foundry, then instantiate CosmosMemoryContextProvider with your Cosmos endpoint, database name, Foundry endpoint, embedding model, and chat model, and add it to the agent's context_providers list. Assign a stable user_id per session so memories carry across sessions; without one, memory falls back to session scope only.

_Building agents with durable memory in Cosmos DB gets easier to track on daily.dev as the tooling evolves._

### What happens if I don't set a stable user_id when using CosmosMemoryContextProvider?

The provider falls back to session-scoped memory instead of carrying knowledge across sessions. A stable user_id, ideally derived from the authenticated user rather than an arbitrary request value, is what allows a new session to recall memories learned in an earlier one.

_Developers wiring up agent memory correctly can follow Cosmos DB and Agent Framework updates on daily.dev._

### What retrieval capabilities does the Azure Cosmos DB Agent Memory Toolkit provide for agent memory?

It supports hybrid retrieval combining vector and full-text search from the same Cosmos DB for NoSQL database, alongside derived memory types like facts, procedural and episodic memories, thread summaries, and user profiles. Background extraction processes conversation turns without blocking the agent's response path, and custom Prompty templates allow domain-specific extraction rubrics.

_daily.dev helps developers evaluating hybrid vector and full-text retrieval options stay current on Cosmos DB capabilities._

## Similar posts on daily.dev

- [Native Agent Memory for Microsoft Agent Framework, Powered by Azure Cosmos DB](https://daily.dev/posts/native-agent-memory-for-microsoft-agent-framework-powered-by-azure-cosmos-db-ackctklaz) · DevBlogs · 0 upvotes · 0 comments
- [Microsoft Foundry Agent Service Simplifies State Management with Long-Term Memory Preview](https://daily.dev/posts/microsoft-foundry-agent-service-simplifies-state-management-with-long-term-memory-preview-3mbnmb6c2) · InfoQ · 0 upvotes · 0 comments

---

Tags: [#python](https://daily.dev/tags/python), [#ai-agents](https://daily.dev/tags/ai-agents), [#vector-search](https://daily.dev/tags/vector-search), [#azure-cosmos-db](https://daily.dev/tags/azure-cosmos-db)

[View this post on daily.dev](https://daily.dev/posts/native-agent-memory-with-azure-cosmos-db-8flymz4pd)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Native agent memory with Azure Cosmos DB","url":"https://daily.dev/posts/native-agent-memory-with-azure-cosmos-db-8flymz4pd","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/native-agent-memory-with-azure-cosmos-db-8flymz4pd"},"datePublished":"2026-09-09T15:58:01.849Z","dateModified":"2026-09-13T20:49:47.703Z","description":"Microsoft has released a preview Python package, agent-framework-azure-cosmos-memory, that gives Microsoft Agent Framework agents durable, cross-session memory...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/26f63f9141f1f702c79003d6d9088497?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/26f63f9141f1f702c79003d6d9088497?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"DevBlogs","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"DevBlogs","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/8f68b453325f482ebeb73fb780092713","url":"https://daily.dev/sources/devblogs"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/native-agent-memory-with-azure-cosmos-db-8flymz4pd","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"python,ai-agents,vector-search,azure-cosmos-db","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"DevBlogs","item":"https://daily.dev/sources/devblogs"},{"@type":"ListItem","position":3,"name":"Native agent memory with Azure Cosmos DB"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/native-agent-memory-with-azure-cosmos-db-8flymz4pd#faq","mainEntity":[{"@type":"Question","name":"How do I add persistent cross-session memory to a Microsoft Agent Framework agent using Azure Cosmos DB?","acceptedAnswer":{"@type":"Answer","text":"Install the preview package agent-framework-azure-cosmos-memory along with agent-framework-foundry, then instantiate CosmosMemoryContextProvider with your Cosmos endpoint, database name, Foundry endpoint, embedding model, and chat model, and add it to the agent's context_providers list. Assign a stable user_id per session so memories carry across sessions; without one, memory falls back to session scope only. Building agents with durable memory in Cosmos DB gets easier to track on daily.dev as the tooling evolves."}},{"@type":"Question","name":"What happens if I don't set a stable user_id when using CosmosMemoryContextProvider?","acceptedAnswer":{"@type":"Answer","text":"The provider falls back to session-scoped memory instead of carrying knowledge across sessions. A stable user_id, ideally derived from the authenticated user rather than an arbitrary request value, is what allows a new session to recall memories learned in an earlier one. Developers wiring up agent memory correctly can follow Cosmos DB and Agent Framework updates on daily.dev."}},{"@type":"Question","name":"What retrieval capabilities does the Azure Cosmos DB Agent Memory Toolkit provide for agent memory?","acceptedAnswer":{"@type":"Answer","text":"It supports hybrid retrieval combining vector and full-text search from the same Cosmos DB for NoSQL database, alongside derived memory types like facts, procedural and episodic memories, thread summaries, and user profiles. Background extraction processes conversation turns without blocking the agent's response path, and custom Prompty templates allow domain-specific extraction rubrics. daily.dev helps developers evaluating hybrid vector and full-text retrieval options stay current on Cosmos DB capabilities."}}]}
```

