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

Parent key (#121)

Braelyn Boyntonbef9f9282db6
diff --git a/agentops/client.py b/agentops/client.py
index bccadab3..1d1a8858 100644
--- a/agentops/client.py
+++ b/agentops/client.py
@@ -62,8 +62,10 @@ class Client(metaclass=MetaClient):
# These handle the case where .init() is used with optionals, and one of these
# params are None, which is does not trigger the Optional default in the constructor
- if not api_key and not environ.get('AGENTOPS_API_KEY'):
- logging.warning("AgentOps: No API key provided - no data will be recorded.")
+ if not api_key:
+ api_key = environ.get("AGENTOPS_API_KEY")
+ if not api_key:
+ logging.warning("AgentOps: No API key provided - no data will be recorded.")
return
if not parent_key: