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

Crew Integration Changes (#133)

Braelyn Boyntonc71f8af3c4e3
diff --git a/agentops/__init__.py b/agentops/__init__.py
index 635112b4..0de18b03 100755
--- a/agentops/__init__.py
+++ b/agentops/__init__.py
@@ -7,7 +7,6 @@ from .config import Configuration
from .event import Event, ActionEvent, LLMEvent, ToolEvent, ErrorEvent
from .enums import Models
from .decorators import record_function
-from os import environ
def init(api_key: Optional[str] = None,
diff --git a/agentops/client.py b/agentops/client.py
index 315bc13e..3422dc33 100644
--- a/agentops/client.py
+++ b/agentops/client.py
@@ -110,6 +110,9 @@ class Client(metaclass=MetaClient):
"""
if self._session is not None and not self._session.has_ended:
+ agent_id = check_call_stack_for_agent_id()
+ if agent_id:
+ event.agent_id = agent_id
self._worker.add_event(event.__dict__)
else:
logging.warning(
diff --git a/agentops/http_client.py b/agentops/http_client.py
index d538fc93..bf404d9e 100644
--- a/agentops/http_client.py
+++ b/agentops/http_client.py
@@ -97,7 +97,7 @@ class HttpClient:
if result.code == 401:
logging.warning(
- 'AgentOps: Could not post data - API server rejected your API key')
+ f'AgentOps: Could not post data - API server rejected your API key: {api_key}')
if result.code == 400:
logging.warning(f'AgentOps: Could not post data - {result.body}')
if result.code == 500: