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
check ao version and warn for update (#326)
Braelyn Boynton4fe5b3759634
diff --git a/agentops/__init__.py b/agentops/__init__.pyindex 54ca039b..24fd1cc3 100755--- a/agentops/__init__.py+++ b/agentops/__init__.py@@ -5,6 +5,7 @@ from typing import Optional, List, Unionfrom .client import Clientfrom .event import Event, ActionEvent, LLMEvent, ToolEvent, ErrorEventfrom .decorators import record_function, track_agent+from .helpers import check_agentops_updatefrom .log_config import loggerfrom .session import Session@@ -61,6 +62,8 @@ def init(Attributes:"""Client().unsuppress_logs()+ check_agentops_update()+if Client().is_initialized:return logger.warning("AgentOps has already been initialized")diff --git a/agentops/helpers.py b/agentops/helpers.pyindex 22eece62..bd95e868 100644--- a/agentops/helpers.py+++ b/agentops/helpers.py@@ -8,6 +8,7 @@ from typing import Unionfrom .log_config import loggerfrom uuid import UUIDfrom importlib.metadata import version+import subprocessao_instances = {}@@ -148,6 +149,19 @@ def get_agentops_version():return None+def check_agentops_update():+ result = subprocess.run(+ ["pip", "list", "--outdated"], capture_output=True, text=True+ )+ lines = result.stdout.splitlines()[2:] # Skip the header lines+ for line in lines:+ parts = line.split()+ if len(parts) > 0 and parts[0] == "agentops":+ logger.warning(+ f" WARNING: {parts[0]} is out of date. Please update with the command: 'pip install --upgrade agentops'"+ )++# Function decorator that prints function name and its arguments to the console for debug purposes# Example output:# <AGENTOPS_DEBUG_OUTPUT>