
The maintainer has not written a description at the source.
Repo AzureCosmosDB/AgentMemoryToolkit, read from GitHub 15 h ago. AzureCosmosDB has not joined Take My Repo.
AzureCosmosDB/AgentMemoryToolkit is a public repo on GitHub by AzureCosmosDB. It declares the MIT license on GitHub. It is written mainly in Python, has 16 stars and last changed on 2026-11-18. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-24.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.

Agent Memory Toolkit is a Python SDK for storing, retrieving, and transforming agent memories on Azure Cosmos DB. It gives your agent both raw conversation history and higher-value derived memory - thread summaries, extracted facts, episodes, procedures learned from what the user teaches and corrects, and cross-thread user profiles - all searchable semantically. The processing pipeline can run in-process (zero infra) or in a sibling Azure Durable Function app that watches the Cosmos DB change feed. Sync (CosmosMemoryClient) and async (AsyncCosmosMemoryClient) APIs are mirror-images of each other.
pip install azure-cosmos-agent-memory python-dotenv # python-dotenv loads .env in the snippet and samples below
# With dev/test dependencies (from a checkout; includes python-dotenv)
pip install ".[dev]"
The toolkit needs a Cosmos DB account, an Azure OpenAI / AI Foundry deployment, and (optionally for the remote processor) an Azure Function app. Pick whichever path matches your situation:
Option A - One-command provision (azd up). Creates everything from scratch - Cosmos + AI Foundry + Function app (Flex Consumption, idle cost ≈ $0) + UAMI + RBAC - and writes a working .env to .azure/<env>/.env:
# Prereqs: az + azd installed; subscription with quota for gpt-4o-mini
# and text-embedding-3-large in your chosen region (default: eastus2,
# also supported: eastus, swedencentral, westus3).
az login
azd auth login
azd env new memorytoolkit-dev
# Optional: pin a region other than eastus2
# azd env set AZURE_LOCATION swedencentral
azd up
# ~10 min later: Cosmos account + AI Foundry account + 2 model deployments
# (gpt-4o-mini, text-embedding-3-large) + UAMI + RBAC + Function app
# are provisioned. Outputs are written to .azure/memorytoolkit-dev/.env
The Function app is provisioned by default and is deployed with MEMORY_PROCESSOR_OWNER=durable: it processes new turns from the change feed, and SDK clients that load the generated .env skip their in-process auto-trigger. To process in your own process instead, run azd env set MEMORY_PROCESSOR_OWNER inprocess before azd up (see Backend exclusivity).
Load the generated env vars and you're ready to use the SDK:
set -a && . ./.azure/memorytoolkit-dev/.env && set +a
To tear everything down later: azd down --purge (the --purge flag skips the AI Foundry / Log Analytics soft-delete window so names are immediately reusable).
Option B - Bring your own resources. If you already have a Cosmos DB account and an AI Foundry / Azure OpenAI deployment, copy the env template and fill in the endpoints:
cp .env.template .env
# edit COSMOS_DB_ENDPOINT, AI_FOUNDRY_ENDPOINT, AI_FOUNDRY_EMBEDDING_DEPLOYMENT_NAME, AI_FOUNDRY_CHAT_DEPLOYMENT_NAME
For the Durable Function app counter-trigger settings, Bicep module reference, RBAC scopes, and the SDK-only escape hatch (
DEPLOY_FUNCTION_APP=false) - seeinfra/README.md.
import os, uuid
from dotenv import load_dotenv
from azure.cosmos.agent_memory import CosmosMemoryClient
load_dotenv()
memory = CosmosMemoryClient(
cosmos_endpoint=os.environ["COSMOS_DB_ENDPOINT"],
cosmos_database=os.getenv("COSMOS_DB_DATABASE", "ai_memory"),
cosmos_container=os.getenv("COSMOS_DB_MEMORIES_CONTAINER", "memories"),
ai_foundry_endpoint=os.environ["AI_FOUNDRY_ENDPOINT"],
embedding_deployment_name=os.getenv("AI_FOUNDRY_EMBEDDING_DEPLOYMENT_NAME", "text-embedding-3-large"),
chat_deployment_name=os.getenv("AI_FOUNDRY_CHAT_DEPLOYMENT_NAME", "gpt-4o-mini"),
use_default_credential=True,
# processor=InProcessProcessor() # implicit default
)
memory.connect_cosmos() # checks the containers; create_memory_store() creates any that are missing
USER, THREAD = "user-001", str(uuid.uuid4())
# Add raw turns to a conversation (role is "user", "agent", "tool" or "system")
memory.upsert_memory(user_id=USER, thread_id=THREAD, role="user", content="I love Cosmos DB.")
memory.upsert_memory(user_id=USER, thread_id=THREAD, role="agent", content="It is fantastic.")
# Run the processing pipeline (thread summary, facts, reconcile, procedures, user summary)
memory.process_now(user_id=USER, thread_id=THREAD)
# Search semantically across the stored facts
hits = memory.search_cosmos("Cosmos DB preferences", user_id=USER, top_k=5)
for h in hits:
print(h["type"], "-", h["content"][:80])
# Retrieve the cross-thread user profile
print(memory.get_user_summary(user_id=USER))
Async API is identical - just
awaiteach call (the local-buffer methodsadd_local,get_local,update_localanddelete_localstay synchronous):from azure.cosmos.agent_memory.aio import AsyncCosmosMemoryClientThe async constructor does no I/O, so connect with
await memory.connect_cosmos()orawait memory.create_memory_store(). The sync constructor already callscreate_memory_store()when it is given an endpoint.
python Samples/Quickstarts/quickstart_cosmos.py
See Samples/ for end-to-end scenarios (chat memory, RAG, multi-agent, customer support, remote processor).
| Concept | What it is | API |
|---|---|---|
| Turn | One message (role user, agent or tool) - the raw conversation atom |
upsert_memory(...), add_local(...) |
| Thread summary | LLM-generated, incrementally updated rollup of a single thread | generate_thread_summary(...) |
| Fact | Discrete, independently searchable assertion extracted from turns | extract_memories(...) |
| Episodic | Bounded experience: situation → action → outcome, with lessons (90-day TTL) | extract_episodes(...) |
| Procedural | Instruction, habit or skill learned from what the user teaches, corrects and practices | synthesize_procedural(...), retrieve_procedures(...) |
| Standing instructions | The user's active, always-applicable procedures, compiled for a system prompt | build_procedural_context(...) |
| User summary | Cross-thread profile of what's known about a user | generate_user_summary(...), get_user_summary(...) |
| Search | Vector + full-text + filter over fact / episodic / procedural; optional slots |
search_cosmos(...) |
| Reconcile | Fold duplicate facts, combine facts about one thing, link conflicting facts | reconcile(...) |
| Process now | Run the full pipeline (summary → facts → reconcile → procedures → user profile) | process_now(...) |
AgentMemoryToolkit uses 3-container Cosmos topology, all partitioned by the hierarchical key [tenant_id, user_id]:
| Container | Holds | Notes |
|---|---|---|
memories_turns |
raw turn documents |
append-only conversation timeline |
memories |
fact, episodic, procedural documents |
vector + full-text retrieval path |
memories_summaries |
thread and user summaries | latest-summary point reads; vector + full-text for search_summaries |
tenant_id says whose memories these are (an app, a customer, an environment); a client is bound to one tenant through its tenant_id argument, "default" unless you set it. It keeps data apart inside the same containers but is not an access-control boundary: anyone who can read the account's data can read every tenant, so use separate databases or accounts and Azure RBAC for hard isolation. user_id is the owner of a memory, a user or an agent. thread_id is a plain field, so everything one owner knows sits in one partition. See Tenants and Owners.
create_memory_store() also creates a counter container (the turn counters behind the auto-trigger, with the same key) and a leases container (change feed checkpoints, keyed /id).
Each pipeline step writes one kind of derived memory. Every extracted fact carries a top-level confidence (0.0–1.0) so retrieval can suppress weakly-grounded extractions.
| Type | Meaning | Written by | Storage type | TTL |
|---|---|---|---|---|
| Fact | Declarative knowledge ("user prefers dark mode") | extract_memories |
type="fact" |
none |
| Episodic | Past experience: situation → action → outcome, with lessons | extract_episodes |
type="episodic" |
90 days |
| Procedural | How the assistant should act for this user ("always confirm before deleting") | synthesize_procedural |
type="procedural" |
none |
| Range | Meaning |
|---|---|
| 0.9–1.0 | Directly stated and unambiguous |
| 0.7–0.9 | Clearly implied, no contradicting evidence |
| 0.5–0.7 | Inferred from context - plausible but not explicit |
| < 0.5 | Speculative - likely should not be extracted |
Filter at retrieval time:
results = memory.search_cosmos("user preferences", user_id="u1", min_confidence=0.7)
high_conf_facts = memory.get_memories(user_id="u1", memory_types=["fact"], min_confidence=0.7)
extract_memories runs extract_memories-v3.prompty by default. Besides content, salience, confidence and metadata.category (preference, requirement, biographical or other), each fact records:
assertion - how the conversation put the fact forward: stated, decided, suggested, observed, directive (the user told the assistant how to act in future) or correction (the user corrected how the assistant did something). Only the user can direct or correct: a fact that does not cite a turn a user wrote is recorded as stated.subject, attribute, entities - what the fact is about, the single-valued property it gives a value of (home city), and the names it mentions (at most 12).source_turn_ids - the turns it came from.The prompt also reads, as context only, up to 6 earlier turns of the thread, the thread summary (when it is older than the new turns) and the user's 15 nearest stored facts, so a reply such as "yes, do that" is written out in full and what is already stored is not restated. Facts still come only from the new turns. Set AMT_EXTRACT_MEMORIES_PROMPT=extract_memories-v2.prompty (or extract_memories.prompty for v1) to select an earlier prompt, which reads no context and records no assertion, subject, attribute or entities.
Procedures are learned from evidence, not copied from one message. synthesize_procedural reads the behavioral facts and episode lessons written since its last run, and a procedure's status follows from the evidence it has gathered:
procedure_kind |
Learned from | Becomes active when |
|---|---|---|
instruction |
The user taught the assistant how to act in future ("always ...", "never ...") | the user taught or corrected it |
habit |
The user corrected the assistant, or chose the same way repeatedly | the user corrected the assistant, or the user's own facts or successful episodes support it on two different dates |
skill |
A method of two or more steps that worked in practice | it succeeded in episodes on two different dates, or the user endorsed it |
A habit's two dates count only facts the user stated and episodes with a successful or partially successful outcome: facts the assistant stated, and failed episodes, do not. A skill's two successes are episodes with a successful or partially successful outcome. Anything else stays a candidate, which search and prompt injection do not show. A procedure applies either always (nearly every interaction: language, tone, format) or when its activation conditions match, and may carry a valid_until date. build_procedural_context(user_id) returns the active, unexpired always rules (at most 10 rules and 2,048 bytes) as a system-prompt block, and task= adds the nearest situational rule:
print(memory.build_procedural_context(USER, task="Review this pull request"))
# # Standing instructions from the user
# - Reply in Spanish.
# - Keep answers under 150 words.
#
# ## Apply only when the situation matches
# - When reviewing code for the user: Include a suggested fix with every review comment.
The pass runs after each reconcile (PROCEDURAL_SYNTHESIS_AUTO) or, with the in-process backend, on demand with synthesize_procedural(user_id)
AzureCosmosDB/AgentMemoryToolkit is a public repo on GitHub by AzureCosmosDB. Its maker has not written a description.
It declares the MIT license on GitHub.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-11-18. GitHub counts 2 open issues and pull requests. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Take My Repo cannot say: it does not audit code and has not run AgentMemoryToolkit. What is known comes from GitHub. It declares the MIT license on GitHub. Its last change was on 2026-11-18. It has 16 stars, which measure popularity, not safety. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read the source before you run it. With "Take it", your AI agent shows each step and asks you before running it; README text is treated as data, not as instructions.