microsoft-agents-a365-observability-extensions-agent-framework 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,2 @@
1
+ # Copyright (c) Microsoft Corporation.
2
+ # Licensed under the MIT License.
@@ -0,0 +1,35 @@
1
+ # Copyright (c) Microsoft Corporation.
2
+ # Licensed under the MIT License.
3
+
4
+ # Custom Span Processor
5
+
6
+ from opentelemetry.sdk.trace.export import SpanProcessor
7
+
8
+ from microsoft_agents_a365.observability.core.constants import (
9
+ GEN_AI_OPERATION_NAME_KEY,
10
+ EXECUTE_TOOL_OPERATION_NAME,
11
+ GEN_AI_EVENT_CONTENT,
12
+ )
13
+
14
+
15
+ class AgentFrameworkSpanProcessor(SpanProcessor):
16
+ """
17
+ SpanProcessor for Agent Framework.
18
+ """
19
+
20
+ TOOL_CALL_RESULT_TAG = "gen_ai.tool.call.result"
21
+
22
+ def __init__(self, service_name: str | None = None):
23
+ self.service_name = service_name
24
+ super().__init__()
25
+
26
+ def on_start(self, span, parent_context):
27
+ if hasattr(span, "attributes"):
28
+ operation_name = span.attributes.get(GEN_AI_OPERATION_NAME_KEY)
29
+ if isinstance(operation_name, str) and operation_name == EXECUTE_TOOL_OPERATION_NAME:
30
+ tool_call_result = span.attributes.get(self.TOOL_CALL_RESULT_TAG)
31
+ if tool_call_result is not None:
32
+ span.set_attribute(GEN_AI_EVENT_CONTENT, tool_call_result)
33
+
34
+ def on_end(self, span):
35
+ pass
@@ -0,0 +1,49 @@
1
+ # Copyright (c) Microsoft Corporation.
2
+ # Licensed under the MIT License.
3
+
4
+ from __future__ import annotations
5
+
6
+ from collections.abc import Collection
7
+ from typing import Any
8
+
9
+ from microsoft_agents_a365.observability.core.config import get_tracer_provider, is_configured
10
+ from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
11
+
12
+ from microsoft_agents_a365.observability.extensions.agentframework.span_processor import (
13
+ AgentFrameworkSpanProcessor,
14
+ )
15
+
16
+ # -----------------------------
17
+ # 3) The Instrumentor class
18
+ # -----------------------------
19
+ _instruments = ("agent-framework-azure-ai >= 1.0.0b251114",)
20
+
21
+
22
+ class AgentFrameworkInstrumentor(BaseInstrumentor):
23
+ """
24
+ Instruments Agent Framework:
25
+ • Installs your custom OTel SpanProcessor
26
+ """
27
+
28
+ def __init__(self):
29
+ if not is_configured():
30
+ raise RuntimeError(
31
+ "Microsoft Agent 365 (or your telemetry config) is not initialized. Configure it before instrumenting."
32
+ )
33
+ super().__init__()
34
+
35
+ def instrumentation_dependencies(self) -> Collection[str]:
36
+ return _instruments
37
+
38
+ def _instrument(self, **kwargs: Any) -> None:
39
+ """
40
+ kwargs (all optional):
41
+ """
42
+
43
+ # Ensure we have an SDK TracerProvider
44
+ provider = get_tracer_provider()
45
+ self._processor = AgentFrameworkSpanProcessor()
46
+ provider.add_span_processor(self._processor)
47
+
48
+ def _uninstrument(self, **kwargs: Any) -> None:
49
+ pass
@@ -0,0 +1,69 @@
1
+ Metadata-Version: 2.4
2
+ Name: microsoft-agents-a365-observability-extensions-agent-framework
3
+ Version: 0.1.0
4
+ Summary: Agent Framework observability and tracing extensions for Microsoft Agent 365
5
+ Author-email: Microsoft <support@microsoft.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/microsoft/Agent365-python
8
+ Project-URL: Repository, https://github.com/microsoft/Agent365-python
9
+ Project-URL: Issues, https://github.com/microsoft/Agent365-python/issues
10
+ Project-URL: Documentation, https://github.com/microsoft/Agent365-python/tree/main/libraries/microsoft-agents-a365-observability-extensions-agentframework
11
+ Keywords: observability,telemetry,tracing,opentelemetry,agent-framework,agents,ai
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Classifier: Topic :: System :: Monitoring
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ Requires-Dist: microsoft-agents-a365-observability-core>=0.0.0
24
+ Requires-Dist: opentelemetry-api>=1.36.0
25
+ Requires-Dist: opentelemetry-sdk>=1.36.0
26
+ Requires-Dist: opentelemetry-instrumentation>=0.47b0
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
29
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
30
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
31
+ Requires-Dist: black>=23.0.0; extra == "dev"
32
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
33
+ Provides-Extra: test
34
+ Requires-Dist: pytest>=7.0.0; extra == "test"
35
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
36
+
37
+ # microsoft-agents-a365-observability-extensions-agentframework
38
+
39
+ [![PyPI](https://img.shields.io/pypi/v/microsoft-agents-a365-observability-extensions-agentframework?label=PyPI&logo=pypi)](https://pypi.org/project/microsoft-agents-a365-observability-extensions-agentframework)
40
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/microsoft-agents-a365-observability-extensions-agentframework?label=Downloads&logo=pypi)](https://pypi.org/project/microsoft-agents-a365-observability-extensions-agentframework)
41
+
42
+ Observability extensions for Microsoft Agent Framework. This package provides OpenTelemetry tracing integration specifically for Agent Framework-based applications.
43
+
44
+ ## Installation
45
+
46
+ ```bash
47
+ pip install microsoft-agents-a365-observability-extensions-agentframework
48
+ ```
49
+
50
+ ## Usage
51
+
52
+ For usage examples and detailed documentation, see the [Observability documentation](https://learn.microsoft.com/microsoft-agent-365/developer/observability?tabs=python) on Microsoft Learn.
53
+
54
+ ## Support
55
+
56
+ For issues, questions, or feedback:
57
+
58
+ - File issues in the [GitHub Issues](https://github.com/microsoft/Agent365-python/issues) section
59
+ - See the [main documentation](../../../README.md) for more information
60
+
61
+ ## Trademarks
62
+
63
+ *Microsoft, Windows, Microsoft Azure and/or other Microsoft products and services referenced in the documentation may be either trademarks or registered trademarks of Microsoft in the United States and/or other countries. The licenses for this project do not grant you rights to use any Microsoft names, logos, or trademarks. Microsoft's general trademark guidelines can be found at http://go.microsoft.com/fwlink/?LinkID=254653.*
64
+
65
+ ## License
66
+
67
+ Copyright (c) Microsoft Corporation. All rights reserved.
68
+
69
+ Licensed under the MIT License - see the [LICENSE](../../../LICENSE.md) file for details.
@@ -0,0 +1,7 @@
1
+ microsoft_agents_a365/observability/extensions/agentframework/__init__.py,sha256=HIog-luBqQnLkza1Q8b34Rr1QVu6tuiAy5sOry0vIPg,73
2
+ microsoft_agents_a365/observability/extensions/agentframework/span_processor.py,sha256=hJmgRSUpdH35NwTs281B7MIhGhTosdCnONxzUigJCAg,1114
3
+ microsoft_agents_a365/observability/extensions/agentframework/trace_instrumentor.py,sha256=WO1pGk9NHwIt4AwyDFDE4-tkDsLr_AUk3vZRCzbdgC0,1486
4
+ microsoft_agents_a365_observability_extensions_agent_framework-0.1.0.dist-info/METADATA,sha256=Eh1I_mICE2aQojWPdhM2hvCAQe27-J_egZr5GWSDKvc,3625
5
+ microsoft_agents_a365_observability_extensions_agent_framework-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ microsoft_agents_a365_observability_extensions_agent_framework-0.1.0.dist-info/top_level.txt,sha256=G3c2_4sy5_EM_BWO67SbK2tKj4G8XFn-QXRbh8g9Lgk,22
7
+ microsoft_agents_a365_observability_extensions_agent_framework-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+