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

handle unknown cost (#148)

Braelyn Boynton3d1b80c917b3
diff --git a/agentops/client.py b/agentops/client.py
index 48255a75..5c1cd4eb 100644
--- a/agentops/client.py
+++ b/agentops/client.py
@@ -240,8 +240,11 @@ class Client(metaclass=MetaClient):
self._session.video = video
self._session.end_session(end_state, end_state_reason)
- token_cost = float(self._worker.end_session(self._session))
- print('🖇 AgentOps: This run cost ${:.6f}'.format(token_cost))
+ token_cost = self._worker.end_session(self._session)
+ if token_cost is 'unknown':
+ print('🖇 AgentOps: Could not determine cost of run.')
+ else:
+ print('🖇 AgentOps: This run cost ${:.6f}'.format(float(token_cost)))
self._session = None
self._worker = None
diff --git a/pyproject.toml b/pyproject.toml
index 1171f57e..5b7a34b6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "agentops"
-version = "0.1.2"
+version = "0.1.3"
authors = [
{ name="Alex Reibman", email="[email protected]" },
{ name="Shawn Qiu", email="[email protected]" },