Skip to content

Python SDK for AI agent monitoring, LLM cost tracking, benchmarking, and more. Integrates with most LLMs and agent frameworks including CrewAI, Agno, OpenAI Agents SDK, Langchain, Autogen, AG2, and CamelAI

feature: Increase max wait time (#125)

Shawn Qiu262481ebe660
diff --git a/agentops/__init__.py b/agentops/__init__.py
index b233a531..09efb23f 100755
--- a/agentops/__init__.py
+++ b/agentops/__init__.py
@@ -15,8 +15,8 @@ def init(api_key: Optional[str] = None,
parent_key: Optional[str] = None,
tags: Optional[List[str]] = None,
endpoint: Optional[str] = None,
- max_wait_time: Optional[int] = 1000,
- max_queue_size: Optional[int] = 100,
+ max_wait_time: Optional[int] = None,
+ max_queue_size: Optional[int] = None,
override=True,
auto_start_session=True):
diff --git a/agentops/client.py b/agentops/client.py
index 6808d037..92ba1844 100644
--- a/agentops/client.py
+++ b/agentops/client.py
@@ -49,8 +49,8 @@ class Client(metaclass=MetaClient):
parent_key: Optional[str] = None,
tags: Optional[List[str]] = None,
endpoint: Optional[str] = None,
- max_wait_time: Optional[int] = 1000,
- max_queue_size: Optional[int] = 100,
+ max_wait_time: Optional[int] = None,
+ max_queue_size: Optional[int] = None,
override=True,
auto_start_session=True
):
diff --git a/agentops/config.py b/agentops/config.py
index 19cc2aa4..9779cfbb 100644
--- a/agentops/config.py
+++ b/agentops/config.py
@@ -16,18 +16,19 @@ class Configuration:
Args:
api_key (str): API Key for AgentOps services
endpoint (str, optional): The endpoint for the AgentOps service. Defaults to 'https://api.agentops.ai'.
- max_wait_time (int, optional): The maximum time to wait in milliseconds before flushing the queue. Defaults to 1000.
+ max_wait_time (int, optional): The maximum time to wait in milliseconds before flushing the queue. Defaults to 30000.
max_queue_size (int, optional): The maximum size of the event queue. Defaults to 100.
"""
def __init__(self, api_key: str,
parent_key: Optional[str],
endpoint: Optional[str] = environ.get('AGENTOPS_API_ENDPOINT', 'https://api.agentops.ai'),
- max_wait_time: Optional[int] = 1000, max_queue_size: Optional[int] = 100):
+ max_wait_time: Optional[int] = None,
+ max_queue_size: Optional[int] = None):
self._api_key: str = api_key
self._endpoint = endpoint
- self._max_wait_time = max_wait_time
- self._max_queue_size = max_queue_size
+ self._max_wait_time = max_wait_time or 30000
+ self._max_queue_size = max_queue_size or 100
self._parent_key: Optional[str] = parent_key
@property
diff --git a/agentops/worker.py b/agentops/worker.py
index 127a502b..d4410c24 100644
--- a/agentops/worker.py
+++ b/agentops/worker.py
@@ -56,7 +56,7 @@ class Worker:
def end_session(self, session: Session) -> None:
self.stop_flag.set()
- self.thread.join()
+ self.thread.join(timeout=1)
self.flush_queue()
self._session = None