microsoft-agents-a365-runtime 0.1.0.dev30__tar.gz → 0.2.1.dev0__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 (17) hide show
  1. {microsoft_agents_a365_runtime-0.1.0.dev30 → microsoft_agents_a365_runtime-0.2.1.dev0}/PKG-INFO +5 -3
  2. {microsoft_agents_a365_runtime-0.1.0.dev30 → microsoft_agents_a365_runtime-0.2.1.dev0}/README.md +2 -2
  3. {microsoft_agents_a365_runtime-0.1.0.dev30 → microsoft_agents_a365_runtime-0.2.1.dev0}/microsoft_agents_a365/runtime/__init__.py +6 -1
  4. {microsoft_agents_a365_runtime-0.1.0.dev30 → microsoft_agents_a365_runtime-0.2.1.dev0}/microsoft_agents_a365/runtime/environment_utils.py +7 -2
  5. microsoft_agents_a365_runtime-0.2.1.dev0/microsoft_agents_a365/runtime/operation_error.py +58 -0
  6. microsoft_agents_a365_runtime-0.2.1.dev0/microsoft_agents_a365/runtime/operation_result.py +98 -0
  7. {microsoft_agents_a365_runtime-0.1.0.dev30 → microsoft_agents_a365_runtime-0.2.1.dev0}/microsoft_agents_a365/runtime/power_platform_api_discovery.py +2 -1
  8. {microsoft_agents_a365_runtime-0.1.0.dev30 → microsoft_agents_a365_runtime-0.2.1.dev0}/microsoft_agents_a365/runtime/utility.py +30 -1
  9. {microsoft_agents_a365_runtime-0.1.0.dev30 → microsoft_agents_a365_runtime-0.2.1.dev0}/microsoft_agents_a365_runtime.egg-info/PKG-INFO +5 -3
  10. {microsoft_agents_a365_runtime-0.1.0.dev30 → microsoft_agents_a365_runtime-0.2.1.dev0}/microsoft_agents_a365_runtime.egg-info/SOURCES.txt +5 -0
  11. {microsoft_agents_a365_runtime-0.1.0.dev30 → microsoft_agents_a365_runtime-0.2.1.dev0}/microsoft_agents_a365_runtime.egg-info/top_level.txt +1 -0
  12. {microsoft_agents_a365_runtime-0.1.0.dev30 → microsoft_agents_a365_runtime-0.2.1.dev0}/pyproject.toml +4 -0
  13. {microsoft_agents_a365_runtime-0.1.0.dev30 → microsoft_agents_a365_runtime-0.2.1.dev0}/setup.py +1 -1
  14. {microsoft_agents_a365_runtime-0.1.0.dev30 → microsoft_agents_a365_runtime-0.2.1.dev0}/microsoft_agents_a365/runtime/version_utils.py +0 -0
  15. {microsoft_agents_a365_runtime-0.1.0.dev30 → microsoft_agents_a365_runtime-0.2.1.dev0}/microsoft_agents_a365_runtime.egg-info/dependency_links.txt +0 -0
  16. {microsoft_agents_a365_runtime-0.1.0.dev30 → microsoft_agents_a365_runtime-0.2.1.dev0}/microsoft_agents_a365_runtime.egg-info/requires.txt +0 -0
  17. {microsoft_agents_a365_runtime-0.1.0.dev30 → microsoft_agents_a365_runtime-0.2.1.dev0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: microsoft-agents-a365-runtime
3
- Version: 0.1.0.dev30
3
+ Version: 0.2.1.dev0
4
4
  Summary: Telemetry, tracing, and monitoring components for AI agents
5
5
  Author-email: Microsoft <support@microsoft.com>
6
6
  License: MIT
@@ -20,6 +20,7 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
20
  Classifier: Topic :: System :: Monitoring
21
21
  Requires-Python: >=3.11
22
22
  Description-Content-Type: text/markdown
23
+ License-File: LICENSE
23
24
  Requires-Dist: PyJWT>=2.8.0
24
25
  Provides-Extra: dev
25
26
  Requires-Dist: pytest>=7.0.0; extra == "dev"
@@ -30,6 +31,7 @@ Requires-Dist: mypy>=1.0.0; extra == "dev"
30
31
  Provides-Extra: test
31
32
  Requires-Dist: pytest>=7.0.0; extra == "test"
32
33
  Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
34
+ Dynamic: license-file
33
35
 
34
36
  # microsoft-agents-a365-runtime
35
37
 
@@ -53,7 +55,7 @@ For usage examples and detailed documentation, see the [Microsoft Agent 365 Deve
53
55
  For issues, questions, or feedback:
54
56
 
55
57
  - File issues in the [GitHub Issues](https://github.com/microsoft/Agent365-python/issues) section
56
- - See the [main documentation](../../../README.md) for more information
58
+ - See the [main documentation](../../README.md) for more information
57
59
 
58
60
  ## Trademarks
59
61
 
@@ -63,4 +65,4 @@ For issues, questions, or feedback:
63
65
 
64
66
  Copyright (c) Microsoft Corporation. All rights reserved.
65
67
 
66
- Licensed under the MIT License - see the [LICENSE](../../../LICENSE.md) file for details.
68
+ Licensed under the MIT License - see the [LICENSE](../../LICENSE.md) file for details.
@@ -20,7 +20,7 @@ For usage examples and detailed documentation, see the [Microsoft Agent 365 Deve
20
20
  For issues, questions, or feedback:
21
21
 
22
22
  - File issues in the [GitHub Issues](https://github.com/microsoft/Agent365-python/issues) section
23
- - See the [main documentation](../../../README.md) for more information
23
+ - See the [main documentation](../../README.md) for more information
24
24
 
25
25
  ## Trademarks
26
26
 
@@ -30,4 +30,4 @@ For issues, questions, or feedback:
30
30
 
31
31
  Copyright (c) Microsoft Corporation. All rights reserved.
32
32
 
33
- Licensed under the MIT License - see the [LICENSE](../../../LICENSE.md) file for details.
33
+ Licensed under the MIT License - see the [LICENSE](../../LICENSE.md) file for details.
@@ -1,6 +1,9 @@
1
- # Copyright (c) Microsoft. All rights reserved.
1
+ # Copyright (c) Microsoft Corporation.
2
+ # Licensed under the MIT License.
2
3
 
3
4
  from .environment_utils import get_observability_authentication_scope
5
+ from .operation_error import OperationError
6
+ from .operation_result import OperationResult
4
7
  from .power_platform_api_discovery import ClusterCategory, PowerPlatformApiDiscovery
5
8
  from .utility import Utility
6
9
 
@@ -9,6 +12,8 @@ __all__ = [
9
12
  "PowerPlatformApiDiscovery",
10
13
  "ClusterCategory",
11
14
  "Utility",
15
+ "OperationError",
16
+ "OperationResult",
12
17
  ]
13
18
 
14
19
  __path__ = __import__("pkgutil").extend_path(__path__, __name__)
@@ -1,4 +1,5 @@
1
- # Copyright (c) Microsoft. All rights reserved.
1
+ # Copyright (c) Microsoft Corporation.
2
+ # Licensed under the MIT License.
2
3
 
3
4
  """
4
5
  Utility logic for environment-related operations.
@@ -21,10 +22,14 @@ def get_observability_authentication_scope() -> list[str]:
21
22
  """
22
23
  Returns the scope for authenticating to the observability service based on the current environment.
23
24
 
25
+ The scope can be overridden via the A365_OBSERVABILITY_SCOPE_OVERRIDE environment variable
26
+ to enable testing against pre-production environments.
27
+
24
28
  Returns:
25
29
  list[str]: The authentication scope for the current environment.
26
30
  """
27
- return [PROD_OBSERVABILITY_SCOPE]
31
+ override_scope = os.getenv("A365_OBSERVABILITY_SCOPE_OVERRIDE", "").strip()
32
+ return [override_scope] if override_scope else [PROD_OBSERVABILITY_SCOPE]
28
33
 
29
34
 
30
35
  def is_development_environment() -> bool:
@@ -0,0 +1,58 @@
1
+ # Copyright (c) Microsoft Corporation.
2
+ # Licensed under the MIT License.
3
+
4
+ """
5
+ Encapsulates an error from an operation.
6
+ """
7
+
8
+
9
+ class OperationError:
10
+ """
11
+ Represents an error that occurred during an operation.
12
+
13
+ This class wraps an exception and provides a consistent interface for
14
+ accessing error information.
15
+ """
16
+
17
+ def __init__(self, exception: Exception):
18
+ """
19
+ Initialize a new instance of the OperationError class.
20
+
21
+ Args:
22
+ exception: The exception associated with the error.
23
+
24
+ Raises:
25
+ ValueError: If exception is None.
26
+ """
27
+ if exception is None:
28
+ raise ValueError("exception cannot be None")
29
+ self._exception = exception
30
+
31
+ @property
32
+ def exception(self) -> Exception:
33
+ """
34
+ Get the exception associated with the error.
35
+
36
+ Returns:
37
+ Exception: The exception associated with the error.
38
+ """
39
+ return self._exception
40
+
41
+ @property
42
+ def message(self) -> str:
43
+ """
44
+ Get the message associated with the error.
45
+
46
+ Returns:
47
+ str: The error message from the exception.
48
+ """
49
+ return str(self._exception)
50
+
51
+ def __str__(self) -> str:
52
+ """
53
+ Return a string representation of the error.
54
+
55
+ Returns:
56
+ str: A string representation of the error.
57
+ """
58
+ return str(self._exception)
@@ -0,0 +1,98 @@
1
+ # Copyright (c) Microsoft Corporation.
2
+ # Licensed under the MIT License.
3
+
4
+ """
5
+ Represents the result of an operation.
6
+ """
7
+
8
+ from typing import List, Optional
9
+
10
+ from .operation_error import OperationError
11
+
12
+
13
+ class OperationResult:
14
+ """
15
+ Represents the result of an operation.
16
+
17
+ This class encapsulates the success or failure state of an operation along
18
+ with any associated errors.
19
+ """
20
+
21
+ _success_instance: Optional["OperationResult"] = None
22
+
23
+ def __init__(self, succeeded: bool, errors: Optional[List[OperationError]] = None):
24
+ """
25
+ Initialize a new instance of the OperationResult class.
26
+
27
+ Args:
28
+ succeeded: Flag indicating whether the operation succeeded.
29
+ errors: Optional list of errors that occurred during the operation.
30
+ """
31
+ self._succeeded = succeeded
32
+ self._errors = errors if errors is not None else []
33
+
34
+ @property
35
+ def succeeded(self) -> bool:
36
+ """
37
+ Get a flag indicating whether the operation succeeded.
38
+
39
+ Returns:
40
+ bool: True if the operation succeeded, otherwise False.
41
+ """
42
+ return self._succeeded
43
+
44
+ @property
45
+ def errors(self) -> List[OperationError]:
46
+ """
47
+ Get the list of errors that occurred during the operation.
48
+
49
+ Note:
50
+ This property returns a defensive copy of the internal error list
51
+ to prevent external modifications, which is especially important for
52
+ protecting the singleton instance returned by success().
53
+
54
+ Returns:
55
+ List[OperationError]: A copy of the list of operation errors.
56
+ """
57
+ return list(self._errors)
58
+
59
+ @staticmethod
60
+ def success() -> "OperationResult":
61
+ """
62
+ Return an OperationResult indicating a successful operation.
63
+
64
+ Returns:
65
+ OperationResult: An OperationResult indicating a successful operation.
66
+ """
67
+ return OperationResult._success_instance
68
+
69
+ @staticmethod
70
+ def failed(*errors: OperationError) -> "OperationResult":
71
+ """
72
+ Create an OperationResult indicating a failed operation.
73
+
74
+ Args:
75
+ *errors: Variable number of OperationError instances.
76
+
77
+ Returns:
78
+ OperationResult: An OperationResult indicating a failed operation.
79
+ """
80
+ error_list = list(errors) if errors else []
81
+ return OperationResult(succeeded=False, errors=error_list)
82
+
83
+ def __str__(self) -> str:
84
+ """
85
+ Convert the value of the current OperationResult object to its string representation.
86
+
87
+ Returns:
88
+ str: A string representation of the current OperationResult object.
89
+ """
90
+ if self._succeeded:
91
+ return "Succeeded"
92
+ else:
93
+ error_messages = ", ".join(str(error.message) for error in self._errors)
94
+ return f"Failed: {error_messages}" if error_messages else "Failed"
95
+
96
+
97
+ # Module-level eager initialization (thread-safe by Python's import lock)
98
+ OperationResult._success_instance = OperationResult(succeeded=True)
@@ -1,4 +1,5 @@
1
- # Copyright (c) Microsoft. All rights reserved.
1
+ # Copyright (c) Microsoft Corporation.
2
+ # Licensed under the MIT License.
2
3
 
3
4
  import re
4
5
  from typing import Literal
@@ -1,4 +1,5 @@
1
- # Copyright (c) Microsoft. All rights reserved.
1
+ # Copyright (c) Microsoft Corporation.
2
+ # Licensed under the MIT License.
2
3
 
3
4
  """
4
5
  Utility functions for Microsoft Agent 365 runtime operations.
@@ -9,7 +10,9 @@ and other common runtime operations.
9
10
 
10
11
  from __future__ import annotations
11
12
 
13
+ import platform
12
14
  import uuid
15
+ from importlib.metadata import PackageNotFoundError, version
13
16
  from typing import Any, Optional
14
17
 
15
18
  import jwt
@@ -23,6 +26,8 @@ class Utility:
23
26
  and other utility functions used across the Agent 365 runtime.
24
27
  """
25
28
 
29
+ _cached_version = None
30
+
26
31
  @staticmethod
27
32
  def get_app_id_from_token(token: Optional[str]) -> str:
28
33
  """
@@ -80,3 +85,27 @@ class Utility:
80
85
 
81
86
  # Fallback to extracting App ID from the auth token
82
87
  return Utility.get_app_id_from_token(auth_token)
88
+
89
+ @staticmethod
90
+ def get_user_agent_header(orchestrator: Optional[str] = None) -> str:
91
+ """
92
+ Generates a User-Agent header string for SDK requests.
93
+
94
+ Args:
95
+ orchestrator: Optional orchestrator name to include in the User-Agent header.
96
+ Defaults to empty string if not provided.
97
+
98
+ Returns:
99
+ str: A formatted User-Agent header string containing SDK version, OS type,
100
+ Python version, and optional orchestrator information.
101
+ """
102
+ if Utility._cached_version is None:
103
+ try:
104
+ Utility._cached_version = version("microsoft-agents-a365-runtime")
105
+ except PackageNotFoundError:
106
+ Utility._cached_version = "unknown"
107
+
108
+ orchestrator_part = f"; {orchestrator}" if orchestrator else ""
109
+ os_type = platform.system()
110
+ python_version = platform.python_version()
111
+ return f"Agent365SDK/{Utility._cached_version} ({os_type}; Python {python_version}{orchestrator_part})"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: microsoft-agents-a365-runtime
3
- Version: 0.1.0.dev30
3
+ Version: 0.2.1.dev0
4
4
  Summary: Telemetry, tracing, and monitoring components for AI agents
5
5
  Author-email: Microsoft <support@microsoft.com>
6
6
  License: MIT
@@ -20,6 +20,7 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
20
  Classifier: Topic :: System :: Monitoring
21
21
  Requires-Python: >=3.11
22
22
  Description-Content-Type: text/markdown
23
+ License-File: LICENSE
23
24
  Requires-Dist: PyJWT>=2.8.0
24
25
  Provides-Extra: dev
25
26
  Requires-Dist: pytest>=7.0.0; extra == "dev"
@@ -30,6 +31,7 @@ Requires-Dist: mypy>=1.0.0; extra == "dev"
30
31
  Provides-Extra: test
31
32
  Requires-Dist: pytest>=7.0.0; extra == "test"
32
33
  Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
34
+ Dynamic: license-file
33
35
 
34
36
  # microsoft-agents-a365-runtime
35
37
 
@@ -53,7 +55,7 @@ For usage examples and detailed documentation, see the [Microsoft Agent 365 Deve
53
55
  For issues, questions, or feedback:
54
56
 
55
57
  - File issues in the [GitHub Issues](https://github.com/microsoft/Agent365-python/issues) section
56
- - See the [main documentation](../../../README.md) for more information
58
+ - See the [main documentation](../../README.md) for more information
57
59
 
58
60
  ## Trademarks
59
61
 
@@ -63,4 +65,4 @@ For issues, questions, or feedback:
63
65
 
64
66
  Copyright (c) Microsoft Corporation. All rights reserved.
65
67
 
66
- Licensed under the MIT License - see the [LICENSE](../../../LICENSE.md) file for details.
68
+ Licensed under the MIT License - see the [LICENSE](../../LICENSE.md) file for details.
@@ -1,8 +1,13 @@
1
1
  README.md
2
2
  pyproject.toml
3
3
  setup.py
4
+ ../../LICENSE
5
+ docs/../../LICENSE
6
+ microsoft_agents_a365/../../LICENSE
4
7
  microsoft_agents_a365/runtime/__init__.py
5
8
  microsoft_agents_a365/runtime/environment_utils.py
9
+ microsoft_agents_a365/runtime/operation_error.py
10
+ microsoft_agents_a365/runtime/operation_result.py
6
11
  microsoft_agents_a365/runtime/power_platform_api_discovery.py
7
12
  microsoft_agents_a365/runtime/utility.py
8
13
  microsoft_agents_a365/runtime/version_utils.py
@@ -65,6 +65,10 @@ target-version = ['py311']
65
65
  line-length = 100
66
66
  target-version = "py311"
67
67
 
68
+ [tool.ruff.lint.flake8-copyright]
69
+ notice-rgx = "# Copyright \\(c\\) Microsoft Corporation\\.\\r?\\n# Licensed under the MIT License\\."
70
+ min-file-size = 1
71
+
68
72
  [tool.mypy]
69
73
  python_version = "3.11"
70
74
  strict = true
@@ -13,7 +13,7 @@ package_version = environ.get("AGENT365_PYTHON_SDK_PACKAGE_VERSION", "0.0.0")
13
13
  helper_path = Path(__file__).parent.parent.parent / "versioning" / "helper"
14
14
  sys.path.insert(0, str(helper_path))
15
15
 
16
- from setup_utils import get_dynamic_dependencies
16
+ from setup_utils import get_dynamic_dependencies # noqa: E402
17
17
 
18
18
  # Use minimum version strategy:
19
19
  # - Internal packages get: >= current_base_version (e.g., >= 0.1.0)