diff --git a/agentops/agent.py b/agentops/agent.py index b0611681..0e070b62 100644 --- a/agentops/agent.py +++ b/agentops/agent.py @@ -18,17 +18,17 @@ def new_init(self, *args, **kwargs): try: original_init(self, *args, **kwargs) self.agent_ops_agent_id = str(uuid4()) - Client().create_agent(self.agent_ops_agent_id, self.agent_ops_agent_name) + Client().create_agent(name=self.agent_ops_agent_name, agent_id=self.agent_ops_agent_id) except AttributeError as e: logger.warning("AgentOps failed to track an agent. This often happens if agentops.init() was not " - "called before initializing an agent with the @track_agent decorator.") + "called before initializing an agent with the @track_agent decorator.") raise e obj.__init__ = new_init elif isfunction(obj): obj.agent_ops_agent_id = str(uuid4()) - Client().create_agent(obj.agent_ops_agent_id, obj.agent_ops_agent_name) + Client().create_agent(name=obj.agent_ops_agent_name, agent_id=obj.agent_ops_agent_id) else: raise Exception("Invalid input, 'obj' must be a class or a function") diff --git a/agentops/client.py b/agentops/client.py index 049b49db..2d8abd96 100644 --- a/agentops/client.py +++ b/agentops/client.py @@ -333,7 +333,7 @@ def create_agent(self, name: str, agent_id: Optional[str] = None) -> str: if agent_id is None: agent_id = str(uuid.uuid4()) if self._worker: - self._worker.create_agent(agent_id, name) + self._worker.create_agent(name=name, agent_id=agent_id) return agent_id def _handle_unclean_exits(self):