Skip to content

Python: Integrate azure-cosmos into core, lazy loading, and root samples - #5044

Closed
Giles Odigwe (giles17) wants to merge 1 commit into
microsoft:mainfrom
giles17:integrate-azure-cosmos
Closed

Python: Integrate azure-cosmos into core, lazy loading, and root samples#5044
Giles Odigwe (giles17) wants to merge 1 commit into
microsoft:mainfrom
giles17:integrate-azure-cosmos

Conversation

@giles17

Copy link
Copy Markdown
Contributor

Motivation and Context

Addresses #5003 - the azure-cosmos package was registered in the workspace but not fully integrated into the standard monorepo patterns. The DevUI package also had a leftover empty samples directory.

Description

azure-cosmos integration (all 3 promotion steps):

  • Added agent-framework-azure-cosmos to the [all] extra in packages/core/pyproject.toml
  • Created lazy-loading namespace at agent_framework.azure_cosmos exporting CosmosHistoryProvider
  • Added CosmosHistoryProvider to the agent_framework.azure umbrella namespace
  • Moved the sample from packages/azure-cosmos/samples/ to samples/02-agents/context_providers/azure_cosmos/
  • Updated AGENTS.md to document all import paths (lazy-loading, Azure umbrella, and direct)
  • Updated README.md to point to the new sample location

Housekeeping:

  • Sorted the [all] dependency list alphabetically
  • Removed the empty packages/devui/samples/ folder (samples were already relocated to samples/02-agents/devui/)

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? Not a breaking change.

- Add agent-framework-azure-cosmos to core[all] optional dependencies
- Sort the [all] dependency list alphabetically
- Create lazy-loading namespace at agent_framework.azure_cosmos
- Add CosmosHistoryProvider to agent_framework.azure umbrella namespace
- Move sample from packages/azure-cosmos/samples/ to samples/02-agents/context_providers/azure_cosmos/
- Update azure-cosmos README.md and AGENTS.md with new paths and import options
- Remove empty devui package-local samples folder (already relocated)

Closes microsoft#5003

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 1, 2026 22:39
@markwallace-microsoft Mark Wallace (markwallace-microsoft) added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python labels Apr 1, 2026
@markwallace-microsoft

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
TOTAL26994318788% 
report-only-changed-files is enabled. No files were changed during this commit :)

Python Unit Test Overview

Tests Skipped Failures Errors Time
5341 20 💤 0 ❌ 0 🔥 1m 24s ⏱️

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Integrates the agent-framework-azure-cosmos package into the Python monorepo’s standard “core extras + lazy import namespaces + root samples” patterns, and cleans up leftover DevUI samples scaffolding.

Changes:

  • Adds agent-framework-azure-cosmos to agent-framework-core[all] and updates the lockfile.
  • Introduces agent_framework.azure_cosmos lazy-loading namespace and re-exports CosmosHistoryProvider via agent_framework.azure.
  • Moves/links Cosmos samples into the root python/samples/ structure and updates package docs to point to the new location; removes the empty DevUI samples package folder.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
python/uv.lock Adds agent-framework-azure-cosmos to the resolved all extra set.
python/samples/02-agents/context_providers/azure_cosmos/README.md New root sample README for Cosmos context provider.
python/samples/02-agents/context_providers/azure_cosmos/cosmos_history_provider.py Updates sample to import via the new lazy namespace.
python/packages/devui/samples/README.md Removes now-obsolete DevUI samples README (samples live in root).
python/packages/devui/samples/init.py Removes empty/unused DevUI samples package marker.
python/packages/core/pyproject.toml Adds agent-framework-azure-cosmos to core[all] and re-sorts entries.
python/packages/core/agent_framework/azure/init.py Adds CosmosHistoryProvider to Azure umbrella lazy exports.
python/packages/core/agent_framework/azure_cosmos/init.py New lazy-loading namespace for Cosmos connector exports.
python/packages/azure-cosmos/samples/README.md Replaces package-local sample docs with a pointer to root samples.
python/packages/azure-cosmos/README.md Updates sample link to the new root samples location.
python/packages/azure-cosmos/AGENTS.md Documents the new recommended lazy import path and umbrella import path.
Comments suppressed due to low confidence (1)

python/samples/02-agents/context_providers/azure_cosmos/cosmos_history_provider.py:11

  • This sample contains standalone triple-quoted string literals later in the file (the large description block and the sample output block). Because Ruff enables bugbear (B) rules for samples/**, these will be flagged as B018 (useless expression) since they are not the module docstring. Convert them into a proper module docstring at the top of the file and/or regular comments so linting passes.

Comment thread python/samples/02-agents/context_providers/azure_cosmos/README.md
Comment thread python/samples/02-agents/context_providers/azure_cosmos/README.md
Comment thread python/packages/core/agent_framework/azure/__init__.py
Comment thread python/packages/core/agent_framework/azure_cosmos/__init__.py
Lazy-loading namespace (recommended):

```python
from agent_framework.azure_cosmos import CosmosHistoryProvider

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be in the azure namespace

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This shouldn't exist

"AgentResponseCallbackProtocol": ("agent_framework_durabletask", "agent-framework-durabletask"),
"AzureAISearchContextProvider": ("agent_framework_azure_ai_search", "agent-framework-azure-ai-search"),
"AzureAISearchSettings": ("agent_framework_azure_ai_search", "agent-framework-azure-ai-search"),
"CosmosHistoryProvider": ("agent_framework_azure_cosmos", "agent-framework-azure-cosmos"),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is missing from the accompanying init.pyi

import asyncio
import os

from agent_framework.azure_cosmos import CosmosHistoryProvider

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should be .azure

@eavanvalkenburg

Copy link
Copy Markdown
Member

Copilot could you address the open comments?

@eavanvalkenburg

Copy link
Copy Markdown
Member

superceded by #5056

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants