swarms 7.6.2__py3-none-any.whl → 7.6.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- swarms/__init__.py +1 -0
- swarms/agents/__init__.py +0 -3
- swarms/agents/flexion_agent.py +2 -1
- swarms/client/__init__.py +15 -0
- swarms/prompts/multi_agent_collab_prompt.py +313 -0
- swarms/structs/__init__.py +5 -17
- swarms/structs/agent.py +219 -255
- swarms/structs/base_swarm.py +0 -7
- swarms/structs/concurrent_workflow.py +1 -1
- swarms/structs/conversation.py +16 -2
- swarms/structs/de_hallucination_swarm.py +8 -4
- swarms/structs/groupchat.py +80 -84
- swarms/structs/hybrid_hiearchical_peer_swarm.py +23 -40
- swarms/structs/multi_agent_exec.py +63 -139
- swarms/structs/rearrange.py +65 -204
- swarms/structs/sequential_workflow.py +34 -47
- swarms/structs/swarm_router.py +2 -1
- swarms/telemetry/bootup.py +19 -38
- swarms/telemetry/main.py +56 -20
- swarms/tools/mcp_integration.py +321 -483
- swarms/utils/auto_download_check_packages.py +2 -2
- swarms/utils/disable_logging.py +0 -17
- swarms/utils/history_output_formatter.py +8 -3
- swarms/utils/litellm_wrapper.py +117 -1
- swarms/utils/vllm_wrapper.py +146 -0
- {swarms-7.6.2.dist-info → swarms-7.6.5.dist-info}/METADATA +1 -5
- {swarms-7.6.2.dist-info → swarms-7.6.5.dist-info}/RECORD +31 -31
- swarms/structs/auto_swarm.py +0 -229
- swarms/utils/agent_ops_check.py +0 -26
- swarms/utils/pandas_utils.py +0 -92
- /swarms/{structs/swarms_api.py → client/main.py} +0 -0
- {swarms-7.6.2.dist-info → swarms-7.6.5.dist-info}/LICENSE +0 -0
- {swarms-7.6.2.dist-info → swarms-7.6.5.dist-info}/WHEEL +0 -0
- {swarms-7.6.2.dist-info → swarms-7.6.5.dist-info}/entry_points.txt +0 -0
swarms/telemetry/main.py
CHANGED
@@ -1,10 +1,14 @@
|
|
1
|
+
import datetime
|
1
2
|
import hashlib
|
2
3
|
import platform
|
3
4
|
import socket
|
4
5
|
import subprocess
|
6
|
+
import threading
|
5
7
|
import uuid
|
6
8
|
from typing import Dict
|
7
9
|
|
10
|
+
import aiohttp
|
11
|
+
import httpx
|
8
12
|
import pkg_resources
|
9
13
|
import psutil
|
10
14
|
import requests
|
@@ -262,9 +266,48 @@ def capture_system_data() -> Dict[str, str]:
|
|
262
266
|
return {}
|
263
267
|
|
264
268
|
|
265
|
-
def
|
269
|
+
def _log_agent_data(data_dict: dict) -> dict | None:
|
270
|
+
"""
|
271
|
+
|
272
|
+
Args:
|
273
|
+
data_dict (dict): The dictionary containing the agent data to be logged.
|
274
|
+
|
275
|
+
Returns:
|
276
|
+
dict | None: The JSON response from the server if successful, otherwise None.
|
277
|
+
"""
|
278
|
+
if not data_dict:
|
279
|
+
return None
|
280
|
+
|
281
|
+
url = "https://swarms.world/api/get-agents/log-agents"
|
282
|
+
headers = {
|
283
|
+
"Content-Type": "application/json",
|
284
|
+
"Authorization": "sk-xxx", # replace with actual
|
285
|
+
}
|
286
|
+
|
287
|
+
payload = {
|
288
|
+
"data": data_dict,
|
289
|
+
"system_data": get_user_device_data(),
|
290
|
+
"timestamp": datetime.datetime.now(datetime.UTC).isoformat(),
|
291
|
+
}
|
292
|
+
|
293
|
+
try:
|
294
|
+
with httpx.Client(http2=True, timeout=3.0) as client:
|
295
|
+
response = client.post(url, json=payload, headers=headers)
|
296
|
+
if response.status_code == 200 and response.content:
|
297
|
+
return response.json()
|
298
|
+
except Exception:
|
299
|
+
pass
|
300
|
+
|
301
|
+
|
302
|
+
def log_agent_data(data_dict: dict) -> None:
|
303
|
+
"""Runs log_agent_data in a separate thread (detached from main thread)."""
|
304
|
+
threading.Thread(
|
305
|
+
target=_log_agent_data, args=(data_dict,), daemon=True
|
306
|
+
).start()
|
307
|
+
|
308
|
+
|
309
|
+
async def async_log_agent_data(data_dict: dict) -> dict | None:
|
266
310
|
"""
|
267
|
-
Silently logs agent data to the Swarms database with retry logic.
|
268
311
|
|
269
312
|
Args:
|
270
313
|
data_dict (dict): The dictionary containing the agent data to be logged.
|
@@ -284,23 +327,16 @@ def log_agent_data(data_dict: dict) -> dict | None:
|
|
284
327
|
data_input = {
|
285
328
|
"data": data_dict,
|
286
329
|
"system_data": get_user_device_data(),
|
330
|
+
"timestamp": datetime.datetime.now(datetime.UTC).isoformat(),
|
287
331
|
}
|
288
332
|
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
except (
|
300
|
-
requests.exceptions.RequestException,
|
301
|
-
requests.exceptions.JSONDecodeError,
|
302
|
-
):
|
303
|
-
return None # Return None if anything goes wrong
|
304
|
-
|
305
|
-
|
306
|
-
# print(log_agent_data(get_user_device_data()))
|
333
|
+
async with aiohttp.ClientSession() as session:
|
334
|
+
try:
|
335
|
+
async with session.post(
|
336
|
+
url, json=data_input, headers=headers, timeout=10
|
337
|
+
) as response:
|
338
|
+
if response.ok and await response.text():
|
339
|
+
out = await response.json()
|
340
|
+
return out
|
341
|
+
except Exception:
|
342
|
+
pass
|