[BUGF][RecursiveWorkflow][ConcurrentWorkflow]

pull/362/head
Kye 12 months ago
parent dae6d5e9c8
commit 3a2db16706

@ -1,5 +1,5 @@
import os
from dotenv import load_dotenv
import os
from dotenv import load_dotenv
from swarms import OpenAIChat, Task, ConcurrentWorkflow, Agent
# Load environment variables from .env file

@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "swarms"
version = "3.5.8"
version = "3.5.9"
description = "Swarms - Pytorch"
license = "MIT"
authors = ["Kye Gomez <kye@apac.ai>"]

@ -76,7 +76,10 @@ class RecursiveWorkflow(BaseStructure):
for task in self.task_pool:
while True:
result = task.run()
if result is not None and self.stop_token in result:
if (
result is not None
and self.stop_token in result
):
break
logger.info(f"{result}")
except Exception as error:

@ -54,6 +54,7 @@ class Task:
>>> task.result
"""
agent: Union[Callable, Agent]
description: str
args: List[Any] = field(default_factory=list)
@ -87,7 +88,9 @@ class Task:
if isinstance(self.agent, Agent):
if self.condition is None or self.condition():
self.result = self.agent.run(
*self.args, **self.kwargs
task=self.description,
*self.args,
**self.kwargs,
)
self.history.append(self.result)

Loading…
Cancel
Save