AgentOps-AI / agentops

Python SDK for agent monitoring, LLM cost tracking, benchmarking, and more. Integrates with most LLMs and agent frameworks like CrewAI, Langchain, and Autogen
https://agentops.ai
MIT License
1.18k stars 93 forks source link

Initialize Client.llm_tracker on all codepaths. #257

Open mbarnathan opened 2 weeks ago

mbarnathan commented 2 weeks ago

Prevents an issue with the check in stop_instrumenting(). To properly test this, I also needed to add a parameter to override the behavior of singleton.

๐Ÿ“ฅ Pull Request

๐Ÿ“˜ Description Initialize llm_tracker to None when instrument_llm_calls is False. Add "allow_multiple_instances" kwargs to suppress singleton decorator so the client may be tested.

๐Ÿ”„ Related Issue (if applicable)

256

๐ŸŽฏ Goal Fix an issue that may occur when Crew and Autogen packages exist but you aren't using them. (In my case, it popped up in a secondary file's main section)

๐Ÿงช Testing Added a unit test; passed on tox.

areibman commented 2 weeks ago

This is awesome-- Adding @bboynton97 as a reviewer, as there might be some conflicts with the new session management strategy