Skip to content

Updating cosmos db topology to use 3 containers#16

Merged
aayush3011 merged 7 commits into
AzureCosmosDB:mainfrom
aayush3011:users/akataria/ContainerSplit
May 31, 2026
Merged

Updating cosmos db topology to use 3 containers#16
aayush3011 merged 7 commits into
AzureCosmosDB:mainfrom
aayush3011:users/akataria/ContainerSplit

Conversation

@aayush3011
Copy link
Copy Markdown
Contributor

@aayush3011 aayush3011 commented May 30, 2026

Cosmos DB topology: 3-container split

Splits the data plane into three typed containers and locks every public API method to a single container with explicit routing.

Container Holds
turns turn docs (TTL)
memories fact, episodic, procedural
summaries thread_summary, user_summary

@aayush3011 aayush3011 marked this pull request as ready for review May 30, 2026 06:48
Copilot AI review requested due to automatic review settings May 30, 2026 06:48
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the toolkit and Function App around a hard 3-container Cosmos DB topology, routing turns, durable memories, and summaries to separate containers while updating public APIs, infrastructure, samples, docs, and tests.

Changes:

  • Adds typed container routing and updates sync/async clients, stores, processors, and pipeline wiring for turns/memories/summaries.
  • Updates Bicep, Function App config, change-feed binding, and topology validation for split containers.
  • Refreshes tests, samples, notebooks, and API docs for thread_summary, direct routing kwargs, and container-specific read paths.

Reviewed changes

Copilot reviewed 83 out of 85 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
agent_memory_toolkit/_base/base_client.py Tracks split container clients and exposes container map.
agent_memory_toolkit/_container_routing.py Adds memory-type-to-container routing primitive.
agent_memory_toolkit/_utils.py Renames summary type helpers to thread_summary.
agent_memory_toolkit/aio/cosmos_memory_client.py Updates async client container creation/routing/topology behavior.
agent_memory_toolkit/aio/processors/inprocess.py Requires and wires all split containers for async in-process pipeline.
agent_memory_toolkit/cosmos_memory_client.py Updates sync client container creation/routing/topology behavior.
agent_memory_toolkit/models.py Replaces summary enum/model type with thread_summary.
agent_memory_toolkit/processors/inprocess.py Requires and wires all split containers for sync in-process pipeline.
function_app/shared/config.py Defines split container environment settings.
function_app/shared/cosmos_clients.py Adds sync summaries container and async database helpers.
function_app/shared/pipeline_factory.py Builds pipeline/store with all three containers.
function_app/triggers/change_feed.py Binds change feed to turns container and adds topology validation.
function_app/requirements.txt Raises dependency minimums for Cosmos/OpenAI stack.
function_app/local.settings.json.template Updates local Function App settings for split containers.
infra/main.bicep Adds memories/summaries container parameters and outputs.
infra/main.parameters.json Wires new container parameters to azd env vars.
infra/modules/cosmos.bicep Provisions memories, turns, summaries, counter, and lease containers.
infra/modules/functions.bicep Emits split-container app settings for the Function App.
infra/README.md Documents 5-container infra topology and defaults.
pyproject.toml Updates dependency minimums and Ruff notebook ignore config.
README.md Documents split Cosmos topology in the main overview.
.env.template Adds split-container and processor-owner environment variables.
Docs/public_api.md Rewrites public API signatures for routed container operations.
Docs/local_testing.md Updates local testing docs for renamed clients and env vars.
Docs/azure_testing.md Updates Azure testing examples for new summary/memory APIs.
Docs/troubleshooting.md Updates troubleshooting env var references.
Samples/Quickstarts/quickstart_cosmos.py Updates quickstart CRUD calls for routed APIs.
Samples/Advanced/advanced_memory_lifecycle.py Uses get_thread and routed delete for raw turns.
Samples/Advanced/advanced_search_patterns.py Updates env var loading/container name usage.
Samples/Processing/processing_fact_extraction.py Updates container env var name.
Samples/Processing/processing_thread_summary.py Uses get_thread_summary and updated env vars.
Samples/Processing/processing_user_profile.py Updates container env var name.
Samples/Scenarios/scenario_chat_memory.py Updates env loading and thread reads with user routing.
Samples/Scenarios/scenario_counter_tuning.py Uses split-container env and get_thread_summary.
Samples/Scenarios/scenario_customer_support.py Updates env var and formatting.
Samples/Scenarios/scenario_memory_reconciliation.py Uses routed delete kwargs and new env var.
Samples/Scenarios/scenario_multi_agent.py Removes dropped memory_types arg from get_thread.
Samples/Scenarios/scenario_rag_with_memory.py Updates cleanup for turns and routed deletes.
Samples/Scenarios/scenario_remote_processor.py Loads .env and updates memories container env var.
Samples/Scenarios/scenario_remote_processor_async.py Loads .env and updates memories container env var.
Samples/Scenarios/scenario_tagging_and_filtering.py Reorders dotenv loading/imports.
Samples/Notebooks/Demo.ipynb Updates notebook examples for split read/update/delete APIs.
Samples/Notebooks/Demo_async.ipynb Updates async notebook examples for split APIs.
Samples/Notebooks/Demo_function_app.ipynb Updates remote processor notebook for split summaries/memories.
Samples/Notebooks/Demo_function_app_async.ipynb Updates async remote processor notebook for split summaries/memories.
tests/conftest.py Updates integration fixture env var for memories container.
tests/integration/test_changefeed_integration.py Points live change-feed test at turns container.
tests/integration/test_full_pipeline.py Updates integration assertions and cleanup for split APIs.
tests/integration/test_processor_integration.py Updates sync processor integration expectations.
tests/integration/test_processor_integration_async.py Updates async processor integration expectations.
tests/integration/test_ttl_lifecycle.py Separates turn and durable memory lookup/delete helpers.
tests/unit/_base/test_base_client.py Updates Cosmos connected guard test for split client field.
tests/unit/aio/processors/test_inprocess.py Updates async in-process result type expectations.
tests/unit/aio/services/__init__.py Adds async services test package marker.
tests/unit/aio/store/test_memory_store.py Updates async store tests for split containers/routed CRUD.
tests/unit/aio/test_auto_trigger.py Updates async auto-trigger mocked container setup.
tests/unit/aio/test_cosmos_memory_client.py Updates async client tests for split containers/topology.
tests/unit/aio/test_process_now.py Updates async process-now polling to thread summaries.
tests/unit/aio/test_procedural_synthesis.py Updates async procedural tests to memories container.
tests/unit/aio/test_reconcile_telemetry.py Adds split container aliases to async pipeline fixture.
tests/unit/function_app/test_change_feed.py Adds topology validation tests and type rename updates.
tests/unit/function_app/test_pipeline_factory.py Verifies Function App pipeline receives all containers.
tests/unit/processors/test_inprocess.py Verifies split-container constructor requirements.
tests/unit/services/test_chaos_extract_persist.py Wires split containers into chaos persistence tests.
tests/unit/services/test_extract_dry.py Wires dry extraction tests through turns container.
tests/unit/services/test_persist_extracted.py Verifies extracted memories route to memories container.
tests/unit/services/test_pipeline_service.py Updates fake pipeline/store tests for split routing.
tests/unit/services/test_user_summary_topic_tags.py Verifies user summaries persist through summary upsert path.
tests/unit/store/test_list_tags.py Restricts tag listing tests to memories container.
tests/unit/store/test_memory_store.py Updates sync store tests for routed CRUD/query behavior.
tests/unit/store/test_tag_mutation.py Updates tag mutation tests for memory type routing.
tests/unit/test_auto_trigger.py Updates sync auto-trigger mocked container setup.
tests/unit/test_container_routing.py Adds routing primitive unit tests.
tests/unit/test_memory_type_multi.py Updates memory type filter tests for new public API.
tests/unit/test_models.py Updates model tests for thread_summary.
tests/unit/test_pipeline_confidence.py Updates confidence/user-summary tests for split containers.
tests/unit/test_process_now.py Updates sync process-now polling to thread summaries.
tests/unit/test_procedural_synthesis.py Updates procedural synthesis tests for memories container.
tests/unit/test_reconcile.py Adds split container aliases and create path assertions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread function_app/triggers/change_feed.py Outdated
Comment thread agent_memory_toolkit/cosmos_memory_client.py Outdated
Comment thread agent_memory_toolkit/aio/cosmos_memory_client.py Outdated
Comment thread agent_memory_toolkit/cosmos_memory_client.py Outdated
Comment thread pyproject.toml Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 83 out of 85 changed files in this pull request and generated 3 comments.

Comment thread README.md Outdated
Comment thread tests/integration/test_full_pipeline.py Outdated
Comment thread Docs/troubleshooting.md
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 86 out of 88 changed files in this pull request and generated 2 comments.

Comment thread agent_memory_toolkit/store/memory_store.py
Comment thread agent_memory_toolkit/aio/store/memory_store.py
@aayush3011 aayush3011 merged commit df4ff5e into AzureCosmosDB:main May 31, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants