Skip to content

Release prep: rename to azure-cosmos-agent-memory + transcript metadata allow-list#18

Merged
aayush3011 merged 5 commits into
AzureCosmosDB:mainfrom
aayush3011:users/akataria/releaseFix
Jun 2, 2026
Merged

Release prep: rename to azure-cosmos-agent-memory + transcript metadata allow-list#18
aayush3011 merged 5 commits into
AzureCosmosDB:mainfrom
aayush3011:users/akataria/releaseFix

Conversation

@aayush3011
Copy link
Copy Markdown
Contributor

@aayush3011 aayush3011 commented Jun 1, 2026

Namespace rename + PyPI release metadata

PyPI package will publish as azure-cosmos-agent-memory, importable as azure.cosmos.agent_memory, joining the official azure.cosmos.* namespace. Pre-release breaking change — no compatibility shim.

pyproject.toml

  • name: agent-memory-toolkit → azure-cosmos-agent-memory
  • version: 0.1.0 → 0.1.0b1
  • Namespace package layout (namespaces = true, include = ["azure.cosmos.agent_memory*"])
  • package-data repointed to azure.cosmos.agent_memory for the .prompty templates
  • Full PyPI metadata: authors, maintainers, keywords, trove classifiers (Beta/AsyncIO/Database/AI/Library), [project.urls] (Homepage, Repository, Issues, Documentation, Changelog)
  • azure-cosmos>=4.16.0 floor (needed by index-policy vectorIndexes shape)

Code surface

  • agent_memory_toolkit/ → azure/cosmos/agent_memory/ (47 git renames; all relative imports already worked)
  • All 6 prompty templates moved with the package
  • Every test + sample + notebook updated to the new import path
  • function_app/_vendor/ wheel refreshed

Docs

  • New CHANGELOG.md with 0.1.0b1 entry
  • New Docs/RELEASING.md maintainer runbook (build, twine check, TestPyPI smoke, PyPI publish, tag)
  • README.md updated to new package name + install command
  • Docs/concepts.md, Docs/public_api.md, Docs/azure_testing.md, Docs/change_feed_processing.md, Docs/configuration.md, Docs/local_testing.md updated

Transcript metadata allow-list

Problem: Coding-agent sessions (VS Code / Copilot / Claude extension) store full-fidelity raw tool calls, IDE schema, theme tokens, etc. in TurnRecord.metadata. The old build_transcript() dumped all of it into every extraction prompt — one reporter measured ~39K tokens of IDE noise vs ~1.6K tokens of actual dialog for a 24-turn session. The LLM drowned and produced 2–5 generic facts instead of the 10–15 architectural decisions the conversation contained.

Fix: build_transcript() no longer serializes metadata into prompts by default. Opt in to specific keys via a new client kwarg:

client = CosmosMemoryClient(
...,
transcript_metadata_keys=["agent_id", "timestamp"],
)

Allow-list semantics

  • None (default) or [] → no [metadata: ...] segment, ever
  • ["a", "b"] → only those keys serialize, in iteration order; absent keys silently skipped; segment dropped entirely when none of the listed keys is present on a turn
  • Applies to all 6 prompts: extract / summarize-thread / summarize-thread-update / user-summary / user-summary-update / synthesize-procedural / dedup
  • Storage is unchanged: TurnRecord.metadata still persists as-is; only the LLM-facing projection changed

Copilot AI review requested due to automatic review settings June 1, 2026 20:44
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 prepares a pre-release rename of the SDK into the official azure.cosmos.* Python namespace (azure-cosmos-agent-memory / azure.cosmos.agent_memory) and changes transcript construction so LLM prompts no longer include TurnRecord.metadata by default, with an opt-in allow-list for specific metadata keys.

Changes:

  • Renames the distribution/package layout to azure-cosmos-agent-memory and migrates imports/tests/samples/docs to azure.cosmos.agent_memory.
  • Adds transcript metadata allow-list plumbing (transcript_metadata_keys) from clients → pipeline → build_transcript(), plus dedicated unit tests.
  • Adds/updates release collateral (CHANGELOG, RELEASING runbook) and refreshes CI/config for the new package path.

Reviewed changes

Copilot reviewed 126 out of 142 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/unit/test_utils.py Updates imports/docstring to new azure.cosmos.agent_memory path.
tests/unit/test_thresholds.py Updates imports to new package path.
tests/unit/test_reconcile.py Updates imports and logger names to new package path.
tests/unit/test_query_builder.py Updates imports/docstring to new package path.
tests/unit/test_process_now.py Updates imports to new package path.
tests/unit/test_procedural_synthesis.py Updates imports to new package path.
tests/unit/test_pipeline_confidence.py Updates imports and logger names to new package path.
tests/unit/test_models.py Updates imports/docstring to new package path.
tests/unit/test_min_confidence.py Updates imports to new package path.
tests/unit/test_memory_type_multi.py Updates imports to new package path.
tests/unit/test_logging.py Updates imports/logger root names to new package path.
tests/unit/test_exceptions.py Updates imports/docstring to new package path.
tests/unit/test_embeddings.py Updates imports to new package path.
tests/unit/test_counters.py Updates imports/docstring to new package path.
tests/unit/test_cosmos_memory_client.py Updates imports to new package path.
tests/unit/test_container_routing.py Updates imports to new package path.
tests/unit/test_chat.py Updates imports to new package path.
tests/unit/test_auto_trigger.py Updates patch paths to new package path.
tests/unit/test_async_hygiene.py Updates async package import and assertion messages to new path.
tests/unit/store/test_tag_mutation.py Updates store imports to new package path.
tests/unit/store/test_memory_store.py Updates store imports to new package path.
tests/unit/store/test_list_tags.py Updates store imports to new package path.
tests/unit/services/test_user_summary_topic_tags.py Updates pipeline imports to new package path.
tests/unit/services/test_transcript_metadata.py Adds new tests covering transcript metadata allow-list behavior and pipeline plumbing.
tests/unit/services/test_prompty_loader.py Updates helper imports to new package path.
tests/unit/services/test_pipeline_service.py Updates imports to new package path.
tests/unit/services/test_persist_extracted.py Updates imports to new package path.
tests/unit/services/test_extract_dry.py Updates imports to new package path.
tests/unit/services/test_chaos_extract_persist.py Updates imports to new package path.
tests/unit/prompts/test_schema_prompty_conformance.py Updates schema + prompts directory paths to new layout.
tests/unit/processors/test_protocol_satisfaction.py Updates processor imports to new package path.
tests/unit/processors/test_inprocess.py Updates processor imports to new package path.
tests/unit/processors/test_durable.py Updates processor imports to new package path.
tests/unit/processors/test_base.py Updates processor imports to new package path.
tests/unit/function_app/test_pipeline_factory.py Updates patch/import paths to new package path.
tests/unit/function_app/conftest.py Updates bootstrap docstring to new package path.
tests/unit/aio/test_reconcile_telemetry.py Updates async pipeline import + logger constant.
tests/unit/aio/test_process_now.py Updates async client/processor imports to new package path.
tests/unit/aio/test_procedural_synthesis.py Updates async imports to new package path.
tests/unit/aio/test_embeddings.py Updates async embeddings imports to new package path.
tests/unit/aio/test_cosmos_memory_client.py Updates async client imports to new package path.
tests/unit/aio/test_chat.py Updates async chat imports/docstring to new package path.
tests/unit/aio/test_auto_trigger.py Updates patch path to new package path.
tests/unit/aio/store/test_memory_store.py Updates async store imports to new package path.
tests/unit/aio/processors/test_protocol_satisfaction.py Updates async processor imports to new package path.
tests/unit/aio/processors/test_inprocess.py Updates async processor imports to new package path.
tests/unit/aio/processors/test_durable.py Updates async processor imports to new package path.
tests/unit/aio/processors/test_base.py Updates async processor imports to new package path.
tests/unit/_base/test_base_client.py Updates base client imports to new package path.
tests/integration/test_ttl_lifecycle.py Updates integration import to new package path.
tests/integration/test_processor_integration.py Updates integration imports + logger name to new package path.
tests/integration/test_processor_integration_async.py Updates integration imports + logger name to new package path.
Samples/Scenarios/scenario_tagging_and_filtering.py Updates sample imports to new package path.
Samples/Scenarios/scenario_remote_processor.py Updates sample imports to new package path.
Samples/Scenarios/scenario_remote_processor_async.py Updates sample imports to new package path.
Samples/Scenarios/scenario_rag_with_memory.py Updates sample imports to new package path.
Samples/Scenarios/scenario_multi_agent.py Updates sample imports to new package path.
Samples/Scenarios/scenario_memory_reconciliation.py Updates sample imports to new package path.
Samples/Scenarios/scenario_customer_support.py Updates sample imports to new package path.
Samples/Scenarios/scenario_counter_tuning.py Updates sample imports to new package path.
Samples/Scenarios/scenario_chat_memory.py Updates sample imports to new package path.
Samples/Quickstarts/quickstart_local.py Updates quickstart imports to new package path.
Samples/Quickstarts/quickstart_cosmos.py Updates quickstart imports to new package path.
Samples/Processing/processing_user_profile.py Updates sample imports to new package path.
Samples/Processing/processing_thread_summary.py Updates sample imports to new package path.
Samples/Processing/processing_fact_extraction.py Updates sample imports to new package path.
Samples/Notebooks/Demo.ipynb Updates notebook import cell to new package path.
Samples/Notebooks/Demo_function_app.ipynb Updates notebook import cell to new package path.
Samples/Notebooks/Demo_function_app_async.ipynb Updates notebook import cell to new package path.
Samples/Notebooks/Demo_async.ipynb Updates notebook import cell to new package path.
Samples/Advanced/advanced_search_patterns.py Updates sample imports to new package path.
Samples/Advanced/advanced_memory_lifecycle.py Updates sample imports to new package path.
README.md Updates install/import docs to new distribution + namespace.
pyproject.toml Renames distribution, sets namespace packaging, updates metadata, ruff/coverage paths.
infra/main.bicep Updates workload tag to new name.
function_app/triggers/change_feed.py Updates thresholds import to new package path.
function_app/shared/pipeline_factory.py Updates SDK imports referenced by the Function app to new package path.
function_app/shared/counters.py Updates comments to new package path.
function_app/shared/config.py Updates thresholds import to new package path.
function_app/requirements.txt Updates vendored wheel filename to new distribution name/version.
function_app/orchestrators/extract_memories.py Updates thresholds import to new package path.
function_app/orchestrators/init.py Updates pipeline class reference to new package path.
Docs/troubleshooting.md Updates public import examples to new package path.
Docs/RELEASING.md Adds maintainer release runbook and namespace-package guardrails.
Docs/public_api.md Updates module references to new package path.
Docs/local_testing.md Updates import examples to new package path.
Docs/design_patterns.md Updates import examples to new package path.
Docs/azure_testing.md Updates import examples to new package path.
CHANGELOG.md Adds initial 0.1.0b1 changelog entry for the renamed package.
azure/cosmos/agent_memory/thresholds.py Updates logger import to new local logging module.
azure/cosmos/agent_memory/store/memory_store.py Updates internal imports to new package path.
azure/cosmos/agent_memory/store/_search_helpers.py Updates internal imports/docstring to new package path.
azure/cosmos/agent_memory/store/init.py Updates re-export import to new package path.
azure/cosmos/agent_memory/services/pipeline.py Adds transcript_metadata_keys support and updates imports/logger name.
azure/cosmos/agent_memory/services/_pipeline_helpers.py Implements metadata allow-list for transcript rendering and updates docs.
azure/cosmos/agent_memory/services/init.py Introduces MemoryStoreProtocol contract module.
azure/cosmos/agent_memory/prompts/user_summary.prompty Adds/moves prompty template under new package path.
azure/cosmos/agent_memory/prompts/user_summary_update.prompty Adds/moves prompty template under new package path.
azure/cosmos/agent_memory/prompts/synthesize_procedural.prompty Adds/moves prompty template under new package path.
azure/cosmos/agent_memory/prompts/summarize.prompty Adds/moves prompty template under new package path.
azure/cosmos/agent_memory/prompts/summarize_update.prompty Adds/moves prompty template under new package path.
azure/cosmos/agent_memory/prompts/extract_memories.prompty Adds/moves prompty template under new package path.
azure/cosmos/agent_memory/prompts/dedup.prompty Adds/moves prompty template under new package path.
azure/cosmos/agent_memory/prompts/_schemas.py Adds strict JSON schemas and response_format registry for prompt outputs.
azure/cosmos/agent_memory/prompts/init.py Adds prompts package marker docstring.
azure/cosmos/agent_memory/processors/inprocess.py Updates pipeline class reference to new package path.
azure/cosmos/agent_memory/processors/durable.py Updates logger import to new package path.
azure/cosmos/agent_memory/processors/base.py Updates docstrings/references to new package path.
azure/cosmos/agent_memory/processors/init.py Adds processor re-export module under new package path.
azure/cosmos/agent_memory/models.py Updates logger import to new package path.
azure/cosmos/agent_memory/logging.py Updates root logger name + exception import to new package path.
azure/cosmos/agent_memory/exceptions.py Adds exception hierarchy under new package path.
azure/cosmos/agent_memory/embeddings.py Updates internal imports to new package path.
azure/cosmos/agent_memory/cosmos_memory_client.py Adds transcript_metadata_keys kwarg and threads it into pipeline creation.
azure/cosmos/agent_memory/chat.py Updates internal imports/docstring to new package path.
azure/cosmos/agent_memory/auto_trigger.py Updates internal imports/docstrings to new package path.
azure/cosmos/agent_memory/aio/store/memory_store.py Updates internal imports to new package path.
azure/cosmos/agent_memory/aio/store/init.py Updates re-export import to new package path.
azure/cosmos/agent_memory/aio/services/pipeline.py Adds transcript_metadata_keys support and updates imports/logger name.
azure/cosmos/agent_memory/aio/services/init.py Adds async services re-export module under new package path.
azure/cosmos/agent_memory/aio/processors/inprocess.py Updates internal imports/docstrings to new package path.
azure/cosmos/agent_memory/aio/processors/durable.py Updates logger + base imports to new package path.
azure/cosmos/agent_memory/aio/processors/base.py Updates protocol docstring imports to new package path.
azure/cosmos/agent_memory/aio/processors/init.py Updates re-exports to new package path.
azure/cosmos/agent_memory/aio/embeddings.py Updates internal imports to new package path.
azure/cosmos/agent_memory/aio/cosmos_memory_client.py Adds transcript_metadata_keys kwarg and threads it into pipeline creation.
azure/cosmos/agent_memory/aio/chat.py Updates internal imports/docstrings to new package path.
azure/cosmos/agent_memory/aio/auto_trigger.py Updates internal imports/docstrings to new package path.
azure/cosmos/agent_memory/aio/init.py Updates re-export imports/docstring to new package path.
azure/cosmos/agent_memory/_utils.py Adds/moves shared utilities under new package path.
azure/cosmos/agent_memory/_query_builder.py Adds/moves query builder under new package path.
azure/cosmos/agent_memory/_counters.py Updates logger import to new package path.
azure/cosmos/agent_memory/_container_routing.py Adds/moves container routing under new package path.
azure/cosmos/agent_memory/_base/base_client.py Updates imports to new package path.
azure/cosmos/agent_memory/_base/init.py Adds base mixin re-export under new package path.
azure/cosmos/agent_memory/init.py Updates public re-exports to new namespace and dependency modules.
azure.yaml Updates azd template name/version metadata for the renamed package.
agent_memory_toolkit/aio/services/init.py Removes old package-path async services re-export.
agent_memory_toolkit/_base/init.py Removes old package-path base re-export.
.github/workflows/ci.yml Updates CI lint/test paths and coverage target to new package path.
Comments suppressed due to low confidence (2)

azure/cosmos/agent_memory/services/_pipeline_helpers.py:200

  • build_transcript() now emits allow-listed metadata via json.dumps(filtered) using the default separators, which adds spaces and needlessly increases prompt/token size (the main motivation for the allow-list). Consider using compact separators (and optionally ensure_ascii=False) so metadata projection stays as small as possible while preserving key order.
    azure/cosmos/agent_memory/services/_pipeline_helpers.py:200
  • build_transcript() now emits allow-listed metadata via json.dumps(filtered) using the default separators, which adds spaces and needlessly increases prompt/token size (the main motivation for the allow-list). Consider using compact separators (and optionally ensure_ascii=False) so metadata projection stays as small as possible while preserving key order.

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

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 126 out of 142 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

azure/cosmos/agent_memory/services/_pipeline_helpers.py:202

  • _normalize_metadata_keys() currently preserves leading/trailing whitespace in keys. If a caller passes something like [" agent_id "], it will never match real metadata dict keys ("agent_id"), silently dropping allowed metadata. Since this function is the shared normalization point for both client constructors and build_transcript(), it should strip whitespace and drop whitespace-only entries.

@aayush3011 aayush3011 merged commit 199ce46 into AzureCosmosDB:main Jun 2, 2026
7 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