microsoft-agents-storage-cosmos 0.7.0__tar.gz → 0.7.0.dev1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) hide show
  1. {microsoft_agents_storage_cosmos-0.7.0 → microsoft_agents_storage_cosmos-0.7.0.dev1}/PKG-INFO +3 -22
  2. {microsoft_agents_storage_cosmos-0.7.0 → microsoft_agents_storage_cosmos-0.7.0.dev1}/microsoft_agents/storage/cosmos/cosmos_db_storage.py +24 -25
  3. {microsoft_agents_storage_cosmos-0.7.0 → microsoft_agents_storage_cosmos-0.7.0.dev1}/microsoft_agents/storage/cosmos/cosmos_db_storage_config.py +9 -5
  4. {microsoft_agents_storage_cosmos-0.7.0 → microsoft_agents_storage_cosmos-0.7.0.dev1}/microsoft_agents_storage_cosmos.egg-info/PKG-INFO +3 -22
  5. {microsoft_agents_storage_cosmos-0.7.0 → microsoft_agents_storage_cosmos-0.7.0.dev1}/microsoft_agents_storage_cosmos.egg-info/SOURCES.txt +0 -2
  6. microsoft_agents_storage_cosmos-0.7.0.dev1/microsoft_agents_storage_cosmos.egg-info/requires.txt +3 -0
  7. {microsoft_agents_storage_cosmos-0.7.0 → microsoft_agents_storage_cosmos-0.7.0.dev1}/readme.md +1 -19
  8. microsoft_agents_storage_cosmos-0.7.0.dev1/setup.py +13 -0
  9. microsoft_agents_storage_cosmos-0.7.0/MANIFEST.in +0 -1
  10. microsoft_agents_storage_cosmos-0.7.0/VERSION.txt +0 -1
  11. microsoft_agents_storage_cosmos-0.7.0/microsoft_agents_storage_cosmos.egg-info/requires.txt +0 -4
  12. microsoft_agents_storage_cosmos-0.7.0/setup.py +0 -20
  13. {microsoft_agents_storage_cosmos-0.7.0 → microsoft_agents_storage_cosmos-0.7.0.dev1}/LICENSE +0 -0
  14. {microsoft_agents_storage_cosmos-0.7.0 → microsoft_agents_storage_cosmos-0.7.0.dev1}/microsoft_agents/storage/cosmos/__init__.py +0 -0
  15. {microsoft_agents_storage_cosmos-0.7.0 → microsoft_agents_storage_cosmos-0.7.0.dev1}/microsoft_agents/storage/cosmos/errors/__init__.py +0 -0
  16. {microsoft_agents_storage_cosmos-0.7.0 → microsoft_agents_storage_cosmos-0.7.0.dev1}/microsoft_agents/storage/cosmos/errors/error_resources.py +0 -0
  17. {microsoft_agents_storage_cosmos-0.7.0 → microsoft_agents_storage_cosmos-0.7.0.dev1}/microsoft_agents/storage/cosmos/key_ops.py +0 -0
  18. {microsoft_agents_storage_cosmos-0.7.0 → microsoft_agents_storage_cosmos-0.7.0.dev1}/microsoft_agents_storage_cosmos.egg-info/dependency_links.txt +0 -0
  19. {microsoft_agents_storage_cosmos-0.7.0 → microsoft_agents_storage_cosmos-0.7.0.dev1}/microsoft_agents_storage_cosmos.egg-info/top_level.txt +0 -0
  20. {microsoft_agents_storage_cosmos-0.7.0 → microsoft_agents_storage_cosmos-0.7.0.dev1}/pyproject.toml +0 -0
  21. {microsoft_agents_storage_cosmos-0.7.0 → microsoft_agents_storage_cosmos-0.7.0.dev1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: microsoft-agents-storage-cosmos
3
- Version: 0.7.0
3
+ Version: 0.7.0.dev1
4
4
  Summary: A Cosmos DB storage library for Microsoft Agents
5
5
  Author: Microsoft Corporation
6
6
  License-Expression: MIT
@@ -15,10 +15,9 @@ Classifier: Operating System :: OS Independent
15
15
  Requires-Python: >=3.10
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
- Requires-Dist: microsoft-agents-hosting-core==0.7.0
18
+ Requires-Dist: microsoft-agents-hosting-core==0.7.0.dev1
19
19
  Requires-Dist: azure-core
20
20
  Requires-Dist: azure-cosmos
21
- Requires-Dist: azure-identity
22
21
  Dynamic: license-file
23
22
  Dynamic: requires-dist
24
23
 
@@ -40,29 +39,11 @@ This library is part of the **Microsoft 365 Agents SDK for Python** - a comprehe
40
39
  <th style="width:20%">Date</th>
41
40
  <th style="width:60%">Release Notes</th>
42
41
  </tr>
43
- <tr>
44
- <td>0.6.1</td>
45
- <td>2025-12-01</td>
46
- <td>
47
- <a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md#microsoft-365-agents-sdk-for-python---release-notes-v061">
48
- 0.6.1 Release Notes
49
- </a>
50
- </td>
51
- </tr>
52
- <tr>
53
- <td>0.6.0</td>
54
- <td>2025-11-18</td>
55
- <td>
56
- <a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md#microsoft-365-agents-sdk-for-python---release-notes-v060">
57
- 0.6.0 Release Notes
58
- </a>
59
- </td>
60
- </tr>
61
42
  <tr>
62
43
  <td>0.5.0</td>
63
44
  <td>2025-10-22</td>
64
45
  <td>
65
- <a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md#microsoft-365-agents-sdk-for-python---release-notes-v050">
46
+ <a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md">
66
47
  0.5.0 Release Notes
67
48
  </a>
68
49
  </td>
@@ -61,7 +61,7 @@ class CosmosDBStorage(AsyncStorageBase):
61
61
  )
62
62
  )
63
63
  return CosmosClient(
64
- url=self._config.url, credential=self._config.credential
64
+ account_url=self._config.url, credential=self._config.credential
65
65
  )
66
66
 
67
67
  connection_policy = self._config.cosmos_client_options.get(
@@ -139,30 +139,32 @@ class CosmosDBStorage(AsyncStorageBase):
139
139
  "kind": documents.PartitionKind.Hash,
140
140
  }
141
141
  try:
142
- kwargs = {}
143
- if self._config.container_throughput:
144
- kwargs["offer_throughput"] = self._config.container_throughput
145
142
  self._container = await self._database.create_container(
146
- self._config.container_id, partition_key, **kwargs
143
+ self._config.container_id,
144
+ partition_key,
145
+ offer_throughput=self._config.container_throughput,
147
146
  )
148
- except Exception as err:
149
- self._container = self._database.get_container_client(
150
- self._config.container_id
151
- )
152
- properties = await self._container.read()
153
- # if "partitionKey" not in properties:
154
- # self._compatability_mode_partition_key = True
155
- # else:
156
- # containers created had no partition key, so the default was "/_partitionKey"
157
- paths = properties["partitionKey"]["paths"]
158
- if "/_partitionKey" in paths:
159
- self._compatability_mode_partition_key = True
160
- elif "/id" not in paths:
161
- raise Exception(
162
- storage_errors.InvalidConfiguration.format(
163
- f"Custom Partition Key Paths are not supported. {self._config.container_id} has a custom Partition Key Path of {paths[0]}."
164
- )
147
+ except cosmos_exceptions.CosmosHttpResponseError as err:
148
+ if err.status_code == http_constants.StatusCodes.CONFLICT:
149
+ self._container = self._database.get_container_client(
150
+ self._config.container_id
165
151
  )
152
+ properties = await self._container.read()
153
+ # if "partitionKey" not in properties:
154
+ # self._compatability_mode_partition_key = True
155
+ # else:
156
+ # containers created had no partition key, so the default was "/_partitionKey"
157
+ paths = properties["partitionKey"]["paths"]
158
+ if "/_partitionKey" in paths:
159
+ self._compatability_mode_partition_key = True
160
+ elif "/id" not in paths:
161
+ raise Exception(
162
+ storage_errors.InvalidConfiguration.format(
163
+ f"Custom Partition Key Paths are not supported. {self._config.container_id} has a custom Partition Key Path of {paths[0]}."
164
+ )
165
+ )
166
+ else:
167
+ raise err
166
168
 
167
169
  async def initialize(self) -> None:
168
170
  if not self._container:
@@ -180,6 +182,3 @@ class CosmosDBStorage(AsyncStorageBase):
180
182
 
181
183
  def _get_partition_key(self, key: str):
182
184
  return NonePartitionKeyValue if self._compatability_mode_partition_key else key
183
-
184
- async def _close(self) -> None:
185
- await self._client.close()
@@ -1,7 +1,7 @@
1
1
  import json
2
2
  from typing import Union
3
3
 
4
- from azure.core.credentials_async import AsyncTokenCredential
4
+ from azure.core.credentials import TokenCredential
5
5
  from microsoft_agents.storage.cosmos.errors import storage_errors
6
6
 
7
7
  from .key_ops import sanitize_key
@@ -17,11 +17,11 @@ class CosmosDBStorageConfig:
17
17
  database_id: str = "",
18
18
  container_id: str = "",
19
19
  cosmos_client_options: dict = None,
20
- container_throughput: int | None = None,
20
+ container_throughput: int = 0,
21
21
  key_suffix: str = "",
22
22
  compatibility_mode: bool = False,
23
23
  url: str = "",
24
- credential: Union[AsyncTokenCredential, None] = None,
24
+ credential: Union[TokenCredential, None] = None,
25
25
  **kwargs,
26
26
  ):
27
27
  """Create the Config object.
@@ -55,14 +55,14 @@ class CosmosDBStorageConfig:
55
55
  "cosmos_client_options", {}
56
56
  )
57
57
  self.container_throughput: int = container_throughput or kwargs.get(
58
- "container_throughput"
58
+ "container_throughput", 400
59
59
  )
60
60
  self.key_suffix: str = key_suffix or kwargs.get("key_suffix", "")
61
61
  self.compatibility_mode: bool = compatibility_mode or kwargs.get(
62
62
  "compatibility_mode", False
63
63
  )
64
64
  self.url = url or kwargs.get("url", "")
65
- self.credential: Union[AsyncTokenCredential, None] = credential
65
+ self.credential: Union[TokenCredential, None] = credential
66
66
 
67
67
  @staticmethod
68
68
  def validate_cosmos_db_config(config: "CosmosDBStorageConfig") -> None:
@@ -71,6 +71,10 @@ class CosmosDBStorageConfig:
71
71
  This is used prior to the creation of the CosmosDBStorage object."""
72
72
  if not config:
73
73
  raise ValueError(str(storage_errors.CosmosDbConfigRequired))
74
+ if not config.cosmos_db_endpoint:
75
+ raise ValueError(str(storage_errors.CosmosDbEndpointRequired))
76
+ if not config.auth_key:
77
+ raise ValueError(str(storage_errors.CosmosDbAuthKeyRequired))
74
78
  if not config.database_id:
75
79
  raise ValueError(str(storage_errors.CosmosDbDatabaseIdRequired))
76
80
  if not config.container_id:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: microsoft-agents-storage-cosmos
3
- Version: 0.7.0
3
+ Version: 0.7.0.dev1
4
4
  Summary: A Cosmos DB storage library for Microsoft Agents
5
5
  Author: Microsoft Corporation
6
6
  License-Expression: MIT
@@ -15,10 +15,9 @@ Classifier: Operating System :: OS Independent
15
15
  Requires-Python: >=3.10
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
- Requires-Dist: microsoft-agents-hosting-core==0.7.0
18
+ Requires-Dist: microsoft-agents-hosting-core==0.7.0.dev1
19
19
  Requires-Dist: azure-core
20
20
  Requires-Dist: azure-cosmos
21
- Requires-Dist: azure-identity
22
21
  Dynamic: license-file
23
22
  Dynamic: requires-dist
24
23
 
@@ -40,29 +39,11 @@ This library is part of the **Microsoft 365 Agents SDK for Python** - a comprehe
40
39
  <th style="width:20%">Date</th>
41
40
  <th style="width:60%">Release Notes</th>
42
41
  </tr>
43
- <tr>
44
- <td>0.6.1</td>
45
- <td>2025-12-01</td>
46
- <td>
47
- <a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md#microsoft-365-agents-sdk-for-python---release-notes-v061">
48
- 0.6.1 Release Notes
49
- </a>
50
- </td>
51
- </tr>
52
- <tr>
53
- <td>0.6.0</td>
54
- <td>2025-11-18</td>
55
- <td>
56
- <a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md#microsoft-365-agents-sdk-for-python---release-notes-v060">
57
- 0.6.0 Release Notes
58
- </a>
59
- </td>
60
- </tr>
61
42
  <tr>
62
43
  <td>0.5.0</td>
63
44
  <td>2025-10-22</td>
64
45
  <td>
65
- <a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md#microsoft-365-agents-sdk-for-python---release-notes-v050">
46
+ <a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md">
66
47
  0.5.0 Release Notes
67
48
  </a>
68
49
  </td>
@@ -0,0 +1,3 @@
1
+ microsoft-agents-hosting-core==0.7.0.dev1
2
+ azure-core
3
+ azure-cosmos
@@ -16,29 +16,11 @@ This library is part of the **Microsoft 365 Agents SDK for Python** - a comprehe
16
16
  <th style="width:20%">Date</th>
17
17
  <th style="width:60%">Release Notes</th>
18
18
  </tr>
19
- <tr>
20
- <td>0.6.1</td>
21
- <td>2025-12-01</td>
22
- <td>
23
- <a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md#microsoft-365-agents-sdk-for-python---release-notes-v061">
24
- 0.6.1 Release Notes
25
- </a>
26
- </td>
27
- </tr>
28
- <tr>
29
- <td>0.6.0</td>
30
- <td>2025-11-18</td>
31
- <td>
32
- <a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md#microsoft-365-agents-sdk-for-python---release-notes-v060">
33
- 0.6.0 Release Notes
34
- </a>
35
- </td>
36
- </tr>
37
19
  <tr>
38
20
  <td>0.5.0</td>
39
21
  <td>2025-10-22</td>
40
22
  <td>
41
- <a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md#microsoft-365-agents-sdk-for-python---release-notes-v050">
23
+ <a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md">
42
24
  0.5.0 Release Notes
43
25
  </a>
44
26
  </td>
@@ -0,0 +1,13 @@
1
+ from os import environ
2
+ from setuptools import setup
3
+
4
+ package_version = environ.get("PackageVersion", "0.0.0")
5
+
6
+ setup(
7
+ version=package_version,
8
+ install_requires=[
9
+ f"microsoft-agents-hosting-core=={package_version}",
10
+ "azure-core",
11
+ "azure-cosmos",
12
+ ],
13
+ )
@@ -1 +0,0 @@
1
- include VERSION.txt
@@ -1 +0,0 @@
1
- 0.7.0
@@ -1,4 +0,0 @@
1
- microsoft-agents-hosting-core==0.7.0
2
- azure-core
3
- azure-cosmos
4
- azure-identity
@@ -1,20 +0,0 @@
1
- from os import environ, path
2
- from setuptools import setup
3
-
4
- # Try to read from VERSION.txt file first, fall back to environment variable
5
- version_file = path.join(path.dirname(__file__), "VERSION.txt")
6
- if path.exists(version_file):
7
- with open(version_file, "r", encoding="utf-8") as f:
8
- package_version = f.read().strip()
9
- else:
10
- package_version = environ.get("PackageVersion", "0.0.0")
11
-
12
- setup(
13
- version=package_version,
14
- install_requires=[
15
- f"microsoft-agents-hosting-core=={package_version}",
16
- "azure-core",
17
- "azure-cosmos",
18
- "azure-identity",
19
- ],
20
- )