diff --git a/agentops/__init__.py b/agentops/__init__.py index 54ca039b4..24fd1cc32 100755 --- a/agentops/__init__.py +++ b/agentops/__init__.py @@ -5,6 +5,7 @@ from .client import Client from .event import Event, ActionEvent, LLMEvent, ToolEvent, ErrorEvent from .decorators import record_function, track_agent +from .helpers import check_agentops_update from .log_config import logger from .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.py index 22eece626..385defe3c 100644 --- a/agentops/helpers.py +++ b/agentops/helpers.py @@ -8,6 +8,7 @@ from .log_config import logger from uuid import UUID from importlib.metadata import version +import subprocess ao_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 {parts[0]}'" + ) + + # Function decorator that prints function name and its arguments to the console for debug purposes # Example output: #