Skip to content

Commit 0511759

Browse files
authored
Add project premium status check in V3Client authentication response and Warn for free plan (#1152)
* Add project premium status check in V3Client authentication response * Refactor logging levels in instrumentation module to use debug instead of info for detailed internal state messages
1 parent f358194 commit 0511759

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

agentops/client/api/versions/v3.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from agentops.client.api.types import AuthTokenResponse
99
from agentops.exceptions import ApiServerException
1010
from agentops.logging import logger
11+
from termcolor import colored
1112

1213

1314
class V3Client(BaseApiClient):
@@ -47,6 +48,15 @@ def fetch_auth_token(self, api_key: str) -> AuthTokenResponse:
4748
if not token:
4849
raise ApiServerException("No token in authentication response")
4950

51+
# Check project premium status
52+
if jr.get("project_prem_status") != "pro":
53+
logger.info(
54+
colored(
55+
"\x1b[34mYou're on the agentops free plan 🤔\x1b[0m",
56+
"blue",
57+
)
58+
)
59+
5060
return jr
5161
except Exception as e:
5262
logger.error(f"Failed to process authentication response: {str(e)}")

agentops/instrumentation/__init__.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def _uninstrument_providers():
206206
if instrumented_key and instrumented_key in PROVIDERS:
207207
try:
208208
instrumentor.uninstrument()
209-
logger.info(
209+
logger.debug(
210210
f"AgentOps: Uninstrumented provider: {instrumentor.__class__.__name__} (for package '{instrumented_key}') due to agentic library activation."
211211
)
212212
uninstrumented_any = True
@@ -247,19 +247,19 @@ def _should_instrument_package(package_name: str) -> bool:
247247
if _has_agentic_library:
248248
# An agentic library is already active.
249249
if is_target_agentic:
250-
logger.info(
250+
logger.debug(
251251
f"AgentOps: An agentic library is active. Skipping instrumentation for subsequent agentic library '{package_name}'."
252252
)
253253
return False
254254
if is_target_provider:
255-
logger.info(
255+
logger.debug(
256256
f"AgentOps: An agentic library is active. Skipping instrumentation for provider '{package_name}'."
257257
)
258258
return False
259259
else:
260260
# No agentic library is active yet.
261261
if is_target_agentic:
262-
logger.info(
262+
logger.debug(
263263
f"AgentOps: '{package_name}' is the first-targeted agentic library. Will uninstrument providers if any are/become active."
264264
)
265265
_uninstrument_providers()
@@ -351,7 +351,7 @@ def _perform_instrumentation(package_name: str):
351351
if concurrent_instrumentor is not None:
352352
concurrent_instrumentor._agentops_instrumented_package_key = "concurrent.futures"
353353
_active_instrumentors.append(concurrent_instrumentor)
354-
logger.info("AgentOps: Instrumented concurrent.futures as a dependency of mem0.")
354+
logger.debug("AgentOps: Instrumented concurrent.futures as a dependency of mem0.")
355355
except Exception as e:
356356
logger.debug(f"Could not instrument concurrent.futures for mem0: {e}")
357357
else:
@@ -413,7 +413,7 @@ def _import_monitor(name: str, globals_dict=None, locals_dict=None, fromlist=(),
413413
if target_module_obj:
414414
is_sdk = _is_installed_package(target_module_obj, package_to_check)
415415
if not is_sdk:
416-
logger.info(
416+
logger.debug(
417417
f"AgentOps: Target '{package_to_check}' appears to be a local module/directory. Skipping AgentOps SDK instrumentation for it."
418418
)
419419
continue
@@ -488,7 +488,7 @@ def instrument_one(loader: InstrumentorLoader) -> Optional[BaseInstrumentor]:
488488
"""
489489
if not loader.should_activate:
490490
# This log is important for users to know why something wasn't instrumented.
491-
logger.info(
491+
logger.debug(
492492
f"AgentOps: Package '{loader.package_name or loader.module_name}' not found or version is less than minimum required ('{loader.min_version}'). Skipping instrumentation."
493493
)
494494
return None
@@ -497,7 +497,7 @@ def instrument_one(loader: InstrumentorLoader) -> Optional[BaseInstrumentor]:
497497
try:
498498
# Use the provider directly from the global tracer instance
499499
instrumentor.instrument(tracer_provider=tracer.provider)
500-
logger.info(
500+
logger.debug(
501501
f"AgentOps: Successfully instrumented '{loader.class_name}' for package '{loader.package_name or loader.module_name}'."
502502
)
503503
except Exception as e:

0 commit comments

Comments
 (0)