A second agent

Researcher and writer

Two agents stay separate. Each has its own instructions. A team runs both.

Give each agent one role. Give each task one agent.

Example

from praisonai import Agent, AgentTeam, Task

researcher = Agent(
    name="Researcher",
    instructions="Research and gather information on topics",
)
writer = Agent(
    name="Writer",
    instructions="Write clear, engaging content",
)
tasks = [
    Task(description="List two facts about AI agents", agent=researcher),
    Task(description="Write two sentences from those facts", agent=writer),
]
team = AgentTeam(agents=[researcher, writer], tasks=tasks)
print(team.start())

Try it Yourself

Example explained

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

Writer must cite researcher

Tighten the writer so it quotes one phrase from the researcher output.

Example

from praisonai import Agent, AgentTeam, Task

researcher = Agent(
    name="Researcher",
    instructions="Reply with two labelled facts: Fact1: ... Fact2: ...",
)
writer = Agent(
    name="Writer",
    instructions="Write one sentence that includes the text Fact1 from the prior task.",
)
tasks = [
    Task(description="Two facts about tracing agents", agent=researcher),
    Task(description="One sentence citing Fact1", agent=writer),
]
team = AgentTeam(agents=[researcher, writer], tasks=tasks)
print(team.start())

Try it Yourself

Example explained

  • from praisonai import Agent, AgentTeam, Task — Imports Agent, AgentTeam, Task needed for writer must cite researcher.
  • Agent(…) — Instantiates the Agent configured for writer must cite researcher.
  • 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