Skip to content

Commit

Permalink
Crew Integration Changes (#133)
Browse files Browse the repository at this point in the history
* pydantic support

* allow client naming outside decorator

* expose record at top level

* merge

* remove main logs

* remove main logs

* track agent in event recording
  • Loading branch information
bboynton97 authored Apr 1, 2024
1 parent 7bd9163 commit c71f8af
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion agentops/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
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,
Expand Down
3 changes: 3 additions & 0 deletions agentops/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ def record(self, event: Event | ErrorEvent):
"""

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(
Expand Down
2 changes: 1 addition & 1 deletion agentops/http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def post(url: str, payload: bytes, api_key: Optional[str] = None, parent_key: Op

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:
Expand Down

0 comments on commit c71f8af

Please sign in to comment.