Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow host env opt out #174

Merged
merged 5 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion agentops/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Classes:
Client: Provides methods to interact with the AgentOps service.
"""
import os

from .event import ActionEvent, ErrorEvent, Event
from .enums import EndState
Expand Down Expand Up @@ -77,6 +78,8 @@ def __init__(self,
self._worker = None
self._tags = tags

self._env_data_opt_out = os.getenv('AGENTOPS_ENV_DATA_OPT_OUT') and os.getenv('AGENTOPS_ENV_DATA_OPT_OUT').lower() == 'true'

try:
self.config = Configuration(api_key=api_key,
parent_key=parent_key,
Expand Down Expand Up @@ -234,7 +237,7 @@ def start_session(self, tags: Optional[List[str]] = None, config: Optional[Confi
if not config and not self.config:
return logger.warning("🖇 AgentOps: Cannot start session - missing configuration")

self._session = Session(inherited_session_id or uuid4(), tags or self._tags, host_env=get_host_env())
self._session = Session(inherited_session_id or uuid4(), tags or self._tags, host_env=get_host_env(self._env_data_opt_out))
self._worker = Worker(config or self.config)
start_session_result = self._worker.start_session(self._session)
if not start_session_result:
Expand Down
22 changes: 14 additions & 8 deletions agentops/host_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,17 @@ def get_disk_details():
return disk_info


def get_host_env():
return {
"SDK": get_sdk_details(),
"OS": get_os_details(),
"CPU": get_cpu_details(),
"RAM": get_ram_details(),
"Disk": get_disk_details(),
}
def get_host_env(opt_out: bool = False):
HowieG marked this conversation as resolved.
Show resolved Hide resolved
if opt_out:
return {
"SDK": get_sdk_details(),
"OS": get_os_details()
}
else:
return {
"SDK": get_sdk_details(),
"OS": get_os_details(),
"CPU": get_cpu_details(),
"RAM": get_ram_details(),
"Disk": get_disk_details(),
}
Loading