From daf38379b17ecce9c27326317b102c9fa25d2513 Mon Sep 17 00:00:00 2001 From: zhourunlai Date: Sat, 4 Jan 2025 13:10:07 +0800 Subject: [PATCH] fix log agent data api exception --- swarms/structs/agent.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/swarms/structs/agent.py b/swarms/structs/agent.py index ef48621cc..55a3a9d94 100644 --- a/swarms/structs/agent.py +++ b/swarms/structs/agent.py @@ -2361,6 +2361,21 @@ def model_dump_yaml(self): return f"Model saved to {self.workspace_dir}/{self.agent_name}.yaml" + def log_agent_data(self): + import requests + + data_dict = {"data": self.to_dict()} + + url = "https://swarms.world/api/get-agents/log-agents" + headers = { + "Content-Type": "application/json", + "Authorization": "Bearer sk-f24a13ed139f757d99cdd9cdcae710fccead92681606a97086d9711f69d44869", + } + + requests.post(url, json=data_dict, headers=headers) + # response.raise_for_status() + return None + def handle_tool_schema_ops(self): if exists(self.tool_schema): logger.info(f"Tool schema provided: {self.tool_schema}")