Skip to content

[BUG] Unable to run SequentialWorkflow #452

Closed
@adtygan

Description

@adtygan

Describe the bug
I'm trying to run a modified version (explained the change in To Reproduce section) of "Example 1: Adding Tasks to a Sequential Workflow" from the docs here and run into the following error:
Screenshot 2024-04-25 at 3 38 35 PM

Moreover, the 2 agents don't seem to be solving the task given to them.
Screenshot 2024-04-25 at 3 39 54 PM

To Reproduce
The code given in the blog post raises an error in the section #Create the Sequential Workflow as it expects the agents to be specified. Hence I passed them as parameters using agents=[flow1,flow2]. Code snippet to reproduce the behavior:

from swarms.models import OpenAIChat
from swarms.structs import Agent
from swarms.structs.sequential_workflow import SequentialWorkflow

# Initialize the language model agent (e.g., GPT-3)
llm = OpenAIChat(
    openai_api_key="", # Enter OpenAI API key here
    temperature=0.5,
    max_tokens=3000,
)

# Initialize flows for individual tasks
flow1 = Agent(llm=llm, max_loops=1, dashboard=False)
flow2 = Agent(llm=llm, max_loops=1, dashboard=False)

# Create the Sequential Workflow
workflow = SequentialWorkflow(max_loops=1, agents=[flow1,flow2])

# Add tasks to the workflow
workflow.add("Generate a 10,000 word blog on health and wellness.", flow1)
workflow.add("Summarize the generated blog", flow2)

# Run the workflow
workflow.run()

# Output the results
for task in workflow.tasks:
    print(f"Task: {task.description}, Result: {task.result}")

Expected behavior
At this stage, the agents are initialized and the run() function must iterate through each agent, calling each agent to execute tasks.

Additional context
The part of the code responsible for failure is:

self.workflow_bootup()
`

workflow_bootup() is defined in

def workflow_bootup(self, **kwargs) -> None:

So in my understanding, swarms/structs/sequential_workflow.py is not properly importing from swarms/structs/base_workflow.py.

Request some assistance on this.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions