swarms 7.9.1__py3-none-any.whl → 7.9.3__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/structs/agent.py CHANGED
@@ -161,7 +161,6 @@ class AgentToolExecutionError(AgentError):
161
161
  pass
162
162
 
163
163
 
164
- # [FEAT][AGENT]
165
164
  class Agent:
166
165
  """
167
166
  Agent is the backbone to connect LLMs with tools and long term memory. Agent also provides the ability to
@@ -1152,12 +1151,7 @@ class Agent:
1152
1151
  self.save()
1153
1152
 
1154
1153
  logger.error(
1155
- f"Attempt {attempt+1}/{self.max_retries}: Error generating response in loop {loop_count} for agent '{self.agent_name}': {str(e)} | "
1156
- f"Error type: {type(e).__name__}, Error details: {e.__dict__ if hasattr(e, '__dict__') else 'No additional details'} | "
1157
- f"Current task: '{task}', Agent state: max_loops={self.max_loops}, "
1158
- f"model={getattr(self.llm, 'model_name', 'unknown')}, "
1159
- f"temperature={getattr(self.llm, 'temperature', 'unknown')}"
1160
- f"{f' | Traceback: {e.__traceback__}' if hasattr(e, '__traceback__') else ''}"
1154
+ f"Attempt {attempt+1}/{self.retry_attempts}: Error generating response in loop {loop_count} for agent '{self.agent_name}': {str(e)} | "
1161
1155
  )
1162
1156
  attempt += 1
1163
1157
 
@@ -2534,6 +2528,10 @@ class Agent:
2534
2528
  ValueError: If task is empty.
2535
2529
  """
2536
2530
 
2531
+ # Filter out is_last from kwargs if present
2532
+ if "is_last" in kwargs:
2533
+ del kwargs["is_last"]
2534
+
2537
2535
  try:
2538
2536
  # Set streaming parameter in LLM if streaming is enabled
2539
2537
  if self.streaming_on and hasattr(self.llm, "stream"):
@@ -164,7 +164,7 @@ class ConcurrentWorkflow(BaseSwarm):
164
164
 
165
165
  return history_output_formatter(
166
166
  conversation=self.conversation,
167
- output_type=self.output_type,
167
+ type=self.output_type,
168
168
  )
169
169
 
170
170
  def batch_run(
@@ -1,4 +1,3 @@
1
- import asyncio
2
1
  import json
3
2
  import uuid
4
3
  from concurrent.futures import ThreadPoolExecutor
@@ -282,7 +281,6 @@ class AgentRearrange(BaseSwarm):
282
281
  )
283
282
 
284
283
  for task_idx, task in enumerate(tasks):
285
- is_last = task == tasks[-1]
286
284
  agent_names = [
287
285
  name.strip() for name in task.split(",")
288
286
  ]
@@ -298,7 +296,6 @@ class AgentRearrange(BaseSwarm):
298
296
  result = agent.run(
299
297
  task=self.conversation.get_str(),
300
298
  img=img,
301
- is_last=is_last,
302
299
  *args,
303
300
  **kwargs,
304
301
  )
@@ -327,7 +324,6 @@ class AgentRearrange(BaseSwarm):
327
324
  current_task = agent.run(
328
325
  task=self.conversation.get_str(),
329
326
  img=img,
330
- is_last=is_last,
331
327
  *args,
332
328
  **kwargs,
333
329
  )
@@ -344,7 +340,8 @@ class AgentRearrange(BaseSwarm):
344
340
  logger.info("Task execution completed")
345
341
 
346
342
  return history_output_formatter(
347
- self.conversation, self.output_type
343
+ conversation=self.conversation,
344
+ type=self.output_type,
348
345
  )
349
346
 
350
347
  except Exception as e:
@@ -364,11 +361,6 @@ class AgentRearrange(BaseSwarm):
364
361
  self,
365
362
  task: str = None,
366
363
  img: str = None,
367
- device: str = "cpu",
368
- device_id: int = 2,
369
- all_cores: bool = True,
370
- all_gpus: bool = False,
371
- no_use_clusterops: bool = True,
372
364
  *args,
373
365
  **kwargs,
374
366
  ):
@@ -481,58 +473,11 @@ class AgentRearrange(BaseSwarm):
481
473
  except Exception as e:
482
474
  self._catch_error(e)
483
475
 
484
- async def abatch_run(
485
- self,
486
- tasks: List[str],
487
- img: Optional[List[str]] = None,
488
- batch_size: int = 10,
489
- *args,
490
- **kwargs,
491
- ) -> List[str]:
492
- """
493
- Asynchronously process multiple tasks in batches.
494
-
495
- Args:
496
- tasks: List of tasks to process
497
- img: Optional list of images corresponding to tasks
498
- batch_size: Number of tasks to process simultaneously
499
-
500
- Returns:
501
- List of results corresponding to input tasks
502
- """
503
- try:
504
- results = []
505
- for i in range(0, len(tasks), batch_size):
506
- batch_tasks = tasks[i : i + batch_size]
507
- batch_imgs = (
508
- img[i : i + batch_size]
509
- if img
510
- else [None] * len(batch_tasks)
511
- )
512
-
513
- # Process batch using asyncio.gather
514
- batch_coros = [
515
- self.astream(
516
- task=task, img=img_path, *args, **kwargs
517
- )
518
- for task, img_path in zip(batch_tasks, batch_imgs)
519
- ]
520
- batch_results = await asyncio.gather(*batch_coros)
521
- results.extend(batch_results)
522
-
523
- return results
524
- except Exception as e:
525
- self._catch_error(e)
526
-
527
476
  def concurrent_run(
528
477
  self,
529
478
  tasks: List[str],
530
479
  img: Optional[List[str]] = None,
531
480
  max_workers: Optional[int] = None,
532
- device: str = "cpu",
533
- device_id: int = None,
534
- all_cores: bool = True,
535
- all_gpus: bool = False,
536
481
  *args,
537
482
  **kwargs,
538
483
  ) -> List[str]:
@@ -561,10 +506,6 @@ class AgentRearrange(BaseSwarm):
561
506
  self.run,
562
507
  task=task,
563
508
  img=img_path,
564
- device=device,
565
- device_id=device_id,
566
- all_cores=all_cores,
567
- all_gpus=all_gpus,
568
509
  *args,
569
510
  **kwargs,
570
511
  )
@@ -49,15 +49,12 @@ class SequentialWorkflow:
49
49
  self.flow = self.sequential_flow()
50
50
 
51
51
  self.agent_rearrange = AgentRearrange(
52
- name=name,
53
- description=description,
54
- agents=agents,
52
+ name=self.name,
53
+ description=self.description,
54
+ agents=self.agents,
55
55
  flow=self.flow,
56
- max_loops=max_loops,
57
- output_type=output_type,
58
- shared_memory_system=shared_memory_system,
59
- *args,
60
- **kwargs,
56
+ max_loops=self.max_loops,
57
+ output_type=self.output_type,
61
58
  )
62
59
 
63
60
  def sequential_flow(self):
@@ -105,11 +102,7 @@ class SequentialWorkflow:
105
102
  self,
106
103
  task: str,
107
104
  img: Optional[str] = None,
108
- device: str = "cpu",
109
- all_cores: bool = False,
110
- all_gpus: bool = False,
111
- device_id: int = 0,
112
- no_use_clusterops: bool = True,
105
+ imgs: Optional[List[str]] = None,
113
106
  *args,
114
107
  **kwargs,
115
108
  ):
@@ -134,14 +127,14 @@ class SequentialWorkflow:
134
127
  """
135
128
 
136
129
  try:
137
- result = self.agent_rearrange.run(
130
+ return self.agent_rearrange.run(
138
131
  task=task,
139
132
  img=img,
140
- *args,
141
- **kwargs,
133
+ # imgs=imgs,
134
+ # *args,
135
+ # **kwargs,
142
136
  )
143
137
 
144
- return result
145
138
  except Exception as e:
146
139
  logger.error(
147
140
  f"An error occurred while executing the task: {e}"
@@ -503,7 +503,12 @@ class SwarmRouter:
503
503
  """
504
504
  self.swarm = self._create_swarm(task, *args, **kwargs)
505
505
 
506
- self.conversation = self.swarm.conversation
506
+ if self.swarm_type == "SequentialWorkflow":
507
+ self.conversation = (
508
+ self.swarm.agent_rearrange.conversation
509
+ )
510
+ else:
511
+ self.conversation = self.swarm.conversation
507
512
 
508
513
  if self.list_all_agents is True:
509
514
  list_all_agents(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: swarms
3
- Version: 7.9.1
3
+ Version: 7.9.3
4
4
  Summary: Swarms - TGSC
5
5
  License: MIT
6
6
  Keywords: artificial intelligence,deep learning,optimizers,Prompt Engineering,swarms,agents,llms,transformers,multi-agent,swarms of agents,Enterprise-Grade Agents,Production-Grade Agents,Agents,Multi-Grade-Agents,Swarms,Transformers,LLMs,Prompt Engineering,Agents,Generative Agents,Generative AI,Agent Marketplace,Agent Store,quant,finance,algorithmic trading,portfolio optimization,risk management,financial modeling,machine learning for finance,natural language processing for finance
@@ -106,7 +106,7 @@ swarms/schemas/mcp_schemas.py,sha256=XZJ4HyiY_cv8Gvj-53ddjzXuqT9hBU2f0cHbhIKs_jY
106
106
  swarms/schemas/swarms_api_schemas.py,sha256=uKqleW_7hNpqHi06yoba9jS2i9yzZp-SBV944MnkN68,6233
107
107
  swarms/schemas/tool_schema_base_model.py,sha256=0biTGIoibsPPP3fOrkC6WvNU5vXaalyccVKC1fpO_eg,1409
108
108
  swarms/structs/__init__.py,sha256=8_CG2mct9cS-TQlpKlC5-240kSjmoooy9bfYXRuB9oQ,4552
109
- swarms/structs/agent.py,sha256=KFlloIhQQivm5hTtNI2ZFzqs4bRaC5cMaqs2mnOA-eY,120067
109
+ swarms/structs/agent.py,sha256=3SL7DNr6W2WuHsHlkSb7xoM0cjqim0JYD0pVgFspksM,119647
110
110
  swarms/structs/agent_builder.py,sha256=tYNpfO4_8cgfMHfgA5DAOWffHnt70p6CLt59esqfVCY,12133
111
111
  swarms/structs/agent_rag_handler.py,sha256=g17YRrNmf16TLvyFCCcsitVk3d-QNZmck_XYmjSN_YM,21372
112
112
  swarms/structs/agent_registry.py,sha256=il507cO1NF-d4ChyANVLuWrN8bXsEAi8_7bLJ_sTU6A,12112
@@ -119,7 +119,7 @@ swarms/structs/base_swarm.py,sha256=bO5olk16je7aJ_XmJxiD6y4nVlbvOySZpc5JX6Rdpvg,
119
119
  swarms/structs/base_workflow.py,sha256=DTfFwX3AdFYxACDYwUDqhsbcDZnITlg5TeEYyxmJBCc,11414
120
120
  swarms/structs/batch_agent_execution.py,sha256=d85DzeCq4uTbbPqLhAXFqFx_cxXUS5yRnJ1-gJkwU5w,1871
121
121
  swarms/structs/concat.py,sha256=utezSxNyh1mIwXgdf8-dJ803NDPyEy79WE8zJHuooGk,732
122
- swarms/structs/concurrent_workflow.py,sha256=uwDDqxG_6pc_rnJTOQH6njeaNbVfieehqCzdPCi162A,8350
122
+ swarms/structs/concurrent_workflow.py,sha256=SCyK-weYYpRb5EG3wZW4z7cF9isoIdpN7CvIVQaB7jg,8343
123
123
  swarms/structs/conversation.py,sha256=mmsvR15zWxsJ4dgyxwwunIifvfcVO4gfJr5zl0RxaSA,52258
124
124
  swarms/structs/council_judge.py,sha256=siYDKiHMvFmShUTXxdo4R6vXiQhKt7bEBI205oC3kU4,19639
125
125
  swarms/structs/csv_to_agent.py,sha256=Zv41sjeWA50msq-paGHESzlxZyMU78DYDLNNKZtNfoI,11125
@@ -145,10 +145,10 @@ swarms/structs/multi_agent_exec.py,sha256=3hIGgwJ_mQwgD16N096jN48-DEIZWFPoetR2nC
145
145
  swarms/structs/multi_agent_router.py,sha256=A4MDd4_QAoarrLaxClnCxnEP62bSMFvyq77ttqeq3u8,11049
146
146
  swarms/structs/multi_model_gpu_manager.py,sha256=gHC6MmVia4etMD6RlpEdbqZtV7ng4f-6jVMH0Zrt8y4,47356
147
147
  swarms/structs/omni_agent_types.py,sha256=RdKLfZ-lXDJrEa0aJT_Rfx9TypJQo8SISqKz4fnLkAk,230
148
- swarms/structs/rearrange.py,sha256=x8dU19blC2ED8xEi1NPF5_GMgsupKbZ08nVVEQEGmaQ,22598
148
+ swarms/structs/rearrange.py,sha256=V_CiIIMknZVmTwvr3a4zyimGtbAGaPPmna49nn2k88g,20661
149
149
  swarms/structs/round_robin.py,sha256=MGk623KiN9uSxTMG6MY_BIAkvEDh1RPwyl5Min7GLOU,7573
150
150
  swarms/structs/safe_loading.py,sha256=gmYX8G9TsvAIp6OCvREBZt5mwSFc-p-t1rSnDBfhEmE,7124
151
- swarms/structs/sequential_workflow.py,sha256=CP-MmxSEJpQCJFivegQyK0GTff5k3jFZbso3t3bSu00,8524
151
+ swarms/structs/sequential_workflow.py,sha256=j_WsB_zwsqWdI82Q6D9MaHKg9I70Q7cKpQbH9OeN4fM,8338
152
152
  swarms/structs/spreadsheet_swarm.py,sha256=ToX56QJjlm_nnC3MYppvKC_NTr9Zy_orkBzfxNLdwbA,14845
153
153
  swarms/structs/stopping_conditions.py,sha256=JHHwqgPoUvjX897ofW2gpPZH_cqEWmv5lDTqb2GtA6M,1382
154
154
  swarms/structs/swarm_arange.py,sha256=5ewEfL52Y4gh-a0lRjFcleHWlsCBuc5XR1nVEEGh07w,15481
@@ -156,7 +156,7 @@ swarms/structs/swarm_eval.py,sha256=148E2R2zaCmt_LZYx15nmdFjybXHiQ2CZbl6pk77jNs,
156
156
  swarms/structs/swarm_id_generator.py,sha256=Wly7AtGM9e6VgzhYmfg8_gSOdxAdsOvWHJFK81cpQNQ,68
157
157
  swarms/structs/swarm_matcher.py,sha256=HUCxTWRnxT5Rix3CMKEuJCqNleqPA9xGrWFGw6rjcTw,26821
158
158
  swarms/structs/swarm_registry.py,sha256=P0XRrqp1qBNyt0BycqPQljUzKv9jClaQMhtaBMinhYg,5578
159
- swarms/structs/swarm_router.py,sha256=cr_-bx_Axhq3FM9UyRmgyg3CfVKGU012ZPnYdaYClB0,26574
159
+ swarms/structs/swarm_router.py,sha256=XO_KSsEKMpEpTzTvyUpqa06QFutIFlRds7aGNuhUeSI,26748
160
160
  swarms/structs/swarming_architectures.py,sha256=guNQU2N7Ofuk01fZbU3tmBJymnZ9zdGULpPZAdaqCeA,28276
161
161
  swarms/structs/tree_swarm.py,sha256=AnIxrt0KhWxAQN8uGjfCcOq-XCmsuTJiH8Ex4mXy8V8,12500
162
162
  swarms/structs/utils.py,sha256=Mo6wHQYOB8baWZUKnAJN5Dsgubpo81umNwJIEDitb2A,1873
@@ -208,8 +208,8 @@ swarms/utils/str_to_dict.py,sha256=T3Jsdjz87WIlkSo7jAW6BB80sv0Ns49WT1qXlOrdEoE,8
208
208
  swarms/utils/try_except_wrapper.py,sha256=uvDZDZJcH986EF0Ej6zZBLcqHJ58NHizPsAH5olrE7Q,3919
209
209
  swarms/utils/vllm_wrapper.py,sha256=sNkm4EbeMrqqmHidnvq5zTnofQAaARy3HIrNBu11lKs,5072
210
210
  swarms/utils/xml_utils.py,sha256=D4nEdo1nkHqSoTKrWylXBXjcHFhGaOYvvfGNQQoYV5o,2514
211
- swarms-7.9.1.dist-info/LICENSE,sha256=jwRtEmTWjLrEsvFB6QFdYs2cEeZPRMdj-UMOFkPF8_0,11363
212
- swarms-7.9.1.dist-info/METADATA,sha256=REGmsTOGNRQj0n3oqtsbv6v3VMSMt8DsnR5Nvol53GA,32138
213
- swarms-7.9.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
214
- swarms-7.9.1.dist-info/entry_points.txt,sha256=2K0rTtfO1X1WaO-waJlXIKw5Voa_EpAL_yU0HXE2Jgc,47
215
- swarms-7.9.1.dist-info/RECORD,,
211
+ swarms-7.9.3.dist-info/LICENSE,sha256=jwRtEmTWjLrEsvFB6QFdYs2cEeZPRMdj-UMOFkPF8_0,11363
212
+ swarms-7.9.3.dist-info/METADATA,sha256=mWniYYlqAwYjIBrUriqn4yGxMezGA7h8zPUm-8VnntY,32138
213
+ swarms-7.9.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
214
+ swarms-7.9.3.dist-info/entry_points.txt,sha256=2K0rTtfO1X1WaO-waJlXIKw5Voa_EpAL_yU0HXE2Jgc,47
215
+ swarms-7.9.3.dist-info/RECORD,,
File without changes