Tasks
Two tasks, in order
A task is one piece of work. Two tasks run one after the other, so the second starts when the first has finished.
The result prints the first sentence, then the second. process="sequential" is that order.
Example
from praisonai import Agent, Task, AgentTeam
agent = Agent(name="Researcher", instructions="Answer in one short sentence.")
first = Task(
description="Name one use of an AI agent",
expected_output="One sentence",
agent=agent,
)
second = Task(
description="Name a second, different use",
expected_output="One sentence",
agent=agent,
)
team = AgentTeam(agents=[agent], tasks=[first, second], process="sequential")
result = team.start(output="silent", return_dict=True)
for value in result["task_results"].values():
print(value.raw)
print()Example explained
- Task — The work, the expected output, and which agent does it.
- AgentTeam — Runs the agents and the tasks.
Reference: documentation