A small workflow
Parallel, then one editor
A workflow can use more than one pattern. Here two researchers work at the same time, then one editor shortens what they found.
The two names appear first. The editor’s sentence is last. That is the finished note.
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.")
editor = Agent(name="Editor", instructions="Shorten the notes to one sentence.")
flow = AgentFlow(steps=[
parallel([market, competitor]),
editor,
])
result = flow.start("Research note-taking apps")
for step in result["steps"]:
print(step["step"])
print(step["output"])
print()Example explained
- parallel — The researchers run together.
- editor — Runs after both have finished.
Reference: documentation