Skip to content

Commit

Permalink
init on start session
Browse files Browse the repository at this point in the history
  • Loading branch information
bboynton97 committed Jun 13, 2024
1 parent 35ca376 commit ec4a695
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 10 additions & 2 deletions agentops/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ def end_session(
)


@check_init
def start_session(
tags: Optional[List[str]] = None,
config: Optional[Configuration] = None,
Expand All @@ -140,7 +139,16 @@ def start_session(
e.g. ["test_run"].
config: (Configuration, optional): Client configuration object
"""
return Client().start_session(tags, config, inherited_session_id)

try:
sess_result = Client().start_session(tags, config, inherited_session_id)

global is_initialized
is_initialized = True

return sess_result
except Exception:
pass


@check_init
Expand Down
1 change: 0 additions & 1 deletion tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def setup_method(self):
self.api_key = "random_api_key"
self.event_type = "test_event_type"
self.config = agentops.Configuration(api_key=self.api_key, max_wait_time=50)
agentops.init(api_key=self.api_key)

def test_session(self, mock_req):
agentops.start_session(config=self.config)
Expand Down

0 comments on commit ec4a695

Please sign in to comment.