mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 15:48:29 +00:00
fix: Improve agentops initialization with better validation and logging
Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
@@ -253,10 +253,15 @@ class Crew(BaseModel):
|
||||
# Initialize agentops if available and API key is present
|
||||
if agentops:
|
||||
api_key = os.getenv("AGENTOPS_API_KEY")
|
||||
if api_key:
|
||||
if api_key and api_key.strip(): # Validate API key
|
||||
try:
|
||||
agentops.init(api_key)
|
||||
except Exception as e:
|
||||
self._logger.log(
|
||||
"info",
|
||||
"Successfully initialized agentops",
|
||||
color="green"
|
||||
)
|
||||
except (ConnectionError, ValueError) as e:
|
||||
self._logger.log(
|
||||
"warning",
|
||||
f"Failed to initialize agentops: {e}",
|
||||
|
||||
Reference in New Issue
Block a user