Python SDK for AI agent monitoring, LLM cost tracking, benchmarking, and more. Integrates with most LLMs and agent frameworks including CrewAI, Agno, OpenAI Agents SDK, Langchain, Autogen, AG2, and CamelAI
Python agentagentopsagents-sdkaianthropicautogencost-estimationcrewaievalsevaluation-metricsgroqlangchainllmmistralollamaopenaiopenai-agents
fix: `AG2` minor refactor for `LIBRARY_NAME` & `LIBRARY_VERSION` (#1010)
Pratyush Shukla0267c6f3b776
diff --git a/agentops/instrumentation/ag2/__init__.py b/agentops/instrumentation/ag2/__init__.pyindex ae1fbffb..87655005 100644--- a/agentops/instrumentation/ag2/__init__.py+++ b/agentops/instrumentation/ag2/__init__.py@@ -5,7 +5,24 @@ interactions, conversation flows, and tool usage while focusing on summary-levelthan individual message exchanges."""-from agentops.instrumentation.ag2.instrumentor import AG2Instrumentor-from agentops.instrumentation.ag2.version import LIBRARY_NAME, LIBRARY_VERSION+from agentops.logging import logger+++def get_version() -> str:+ """Get the version of the AG2 package, or 'unknown' if not found"""+ try:+ from importlib.metadata import version++ return version("ag2")+ except ImportError:+ logger.debug("Could not find AG2 version")+ return "unknown"+++LIBRARY_NAME = "ag2"+LIBRARY_VERSION: str = get_version()++# Import after defining constants to avoid circular imports+from agentops.instrumentation.ag2.instrumentor import AG2Instrumentor # noqa: E402__all__ = ["AG2Instrumentor", "LIBRARY_NAME", "LIBRARY_VERSION"]diff --git a/agentops/instrumentation/ag2/instrumentor.py b/agentops/instrumentation/ag2/instrumentor.pyindex 302c0c7c..9818d3a3 100644--- a/agentops/instrumentation/ag2/instrumentor.py+++ b/agentops/instrumentation/ag2/instrumentor.py@@ -13,7 +13,7 @@ from opentelemetry.metrics import get_meterfrom wrapt import wrap_function_wrapperfrom agentops.logging import logger-from agentops.instrumentation.ag2.version import LIBRARY_NAME, LIBRARY_VERSION+from agentops.instrumentation.ag2 import LIBRARY_NAME, LIBRARY_VERSIONfrom agentops.semconv import Metersfrom agentops.semconv.message import MessageAttributesfrom agentops.semconv.span_attributes import SpanAttributesdiff --git a/agentops/instrumentation/ag2/version.py b/agentops/instrumentation/ag2/version.pydeleted file mode 100644index 3aab496e..00000000--- a/agentops/instrumentation/ag2/version.py+++ /dev/null@@ -1,4 +0,0 @@-"""Version information for AG2 instrumentation."""--LIBRARY_NAME = "ag2"-LIBRARY_VERSION = "0.3.2"