diff --git a/agentops/__init__.py b/agentops/__init__.py index 260330ab..909cedd2 100755 --- a/agentops/__init__.py +++ b/agentops/__init__.py @@ -69,3 +69,11 @@ def add_tags(tags: List[str]): def set_tags(tags: List[str]): Client().set_tags(tags) + + +def get_api_key() -> str: + return Client().api_key + + +def set_parent_key(parent_key): + Client().set_parent_key(parent_key) diff --git a/agentops/client.py b/agentops/client.py index 8c2fa188..a124a2d4 100644 --- a/agentops/client.py +++ b/agentops/client.py @@ -241,7 +241,8 @@ def end_session(self, self._worker = None def create_agent(self, agent_id: str, name: str): - self._worker.create_agent(agent_id, name) + if self._worker: + self._worker.create_agent(agent_id, name) def _handle_unclean_exits(self): def cleanup(end_state: Optional[str] = 'Fail', end_state_reason: Optional[str] = None): @@ -293,3 +294,15 @@ def handle_exception(exc_type, exc_value, exc_traceback): @property def current_session_id(self): return self._session.session_id + + @property + def api_key(self): + return self.config.api_key + + def set_parent_key(self, parent_key): + if self._worker: + self._worker.config.parent_key = parent_key + + @property + def parent_key(self): + return self.config.parent_key diff --git a/pyproject.toml b/pyproject.toml index f3afbe60..c502b7f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "agentops" -version = "0.1.0" +version = "0.1.1" authors = [ { name="Alex Reibman", email="areibman@gmail.com" }, { name="Shawn Qiu", email="siyangqiu@gmail.com" },