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
Python agentagentopsagents-sdkaianthropicautogencost-estimationcrewaievalsevaluation-metricsgroqlangchainllmmistralollamaopenaiopenai-agents
Fix: Rounding error showing cost (#293)
AndinAvdiu5c7cb7f267fc
diff --git a/agentops/client.py b/agentops/client.pyindex a760c67a..5e9bd773 100644--- a/agentops/client.py+++ b/agentops/client.py@@ -13,7 +13,7 @@ import sysimport threadingimport tracebackimport logging-from decimal import Decimal+from decimal import Decimal, ROUND_HALF_UPfrom uuid import UUID, uuid4from typing import Optional, List, Union@@ -424,7 +424,7 @@ class Client(metaclass=MetaClient):"This run's cost ${}".format("{:.2f}".format(token_cost_d)if token_cost_d == 0- else "{:.6f}".format(token_cost_d)+ else "{:.6f}".format(token_cost_d.quantize(Decimal('0.000001'), rounding=ROUND_HALF_UP))))