Parallel

Two researchers, then one summary

parallel runs several agents on the same input, then a later step can read all of their answers.

The market and competitor agents run together. The aggregator runs after both have finished. Each name is printed above its answer.

Example

from praisonai import Agent, AgentFlow, parallel

market = Agent(name="Market", instructions="Name one market trend in a sentence.")
competitor = Agent(name="Competitor", instructions="Name one competitor type in a sentence.")
aggregator = Agent(name="Aggregator", instructions="Combine the findings into two lines.")
flow = AgentFlow(steps=[
    parallel([market, competitor]),
    aggregator,
])
result = flow.start("Research note-taking apps")
for step in result["steps"]:
    print(step["step"])
    print(step["output"])
    print()

Try it Yourself

Example explained

  • parallel — A list of agents that run at the same time.

Reference: documentation