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()

Try it Yourself

Example explained

  • Task — The work, the expected output, and which agent does it.
  • AgentTeam — Runs the agents and the tasks.

expected_output

Tasks can demand a shape. The team still runs sequentially — each task must finish before the next starts.

Example

from praisonai import Agent, Task, AgentTeam

agent = Agent(name="Analyst", instructions="Answer in one sentence.")
t1 = Task(description="Name one risk of agent tools", expected_output="One sentence", agent=agent)
t2 = Task(description="Name one mitigation", expected_output="One sentence", agent=agent)
team = AgentTeam(agents=[agent], tasks=[t1, t2], process="sequential")
out = team.start(output="silent", return_dict=True)
for value in out["task_results"].values():
    print(value.raw)

Try it Yourself

Example explained

  • from praisonai import Agent, Task, AgentTeam — Imports Agent, Task, AgentTeam needed for expected_output.
  • Agent(…) — Instantiates the Agent configured for expected_output.
  • Task(…) — Defines a concrete unit of work assigned to a specific agent.
  • AgentTeam(…) — Coordinates multiple agents and tasks working together as a team.

Reference: documentation