Files
Eduard van Valkenburg 95fd5ec658 Python: [BREAKING] Python: move Azure AI embeddings to Foundry (#5056)
* renamed AzureAIINferenceEmbeddings and lazy load azure-cosmos and env var rename

* updated coverage

* fix readme
2026-04-02 11:26:35 +00:00

48 lines
1.4 KiB
Markdown

# Get Started with Microsoft Agent Framework Azure Cosmos DB
Please install this package via pip:
```bash
pip install agent-framework-azure-cosmos --pre
```
## Azure Cosmos DB History Provider
The Azure Cosmos DB integration provides `CosmosHistoryProvider` for persistent conversation history storage.
### Basic Usage Example
```python
from azure.identity.aio import DefaultAzureCredential
from agent_framework.azure import CosmosHistoryProvider
provider = CosmosHistoryProvider(
endpoint="https://<account>.documents.azure.com:443/",
credential=DefaultAzureCredential(),
database_name="agent-framework",
container_name="chat-history",
)
```
Credentials follow the same pattern used by other Azure connectors in the repository:
- Pass a credential object (for example `DefaultAzureCredential`)
- Or pass a key string directly
- Or set `AZURE_COSMOS_KEY` in the environment
Container naming behavior:
- Container name is configured on the provider (`container_name` or `AZURE_COSMOS_CONTAINER_NAME`)
- `session_id` is used as the Cosmos partition key for reads/writes
See the [conversation samples](../../samples/02-agents/conversations/) for runnable examples, including
[`cosmos_history_provider.py`](../../samples/02-agents/conversations/cosmos_history_provider.py).
## Import Paths
```python
from agent_framework.azure import CosmosHistoryProvider
# or directly:
from agent_framework_azure_cosmos import CosmosHistoryProvider
```