AGENTSPYTHON AND JAVASCRIPTYOUR APPLICATION
For developers
For your
application.
Import an Agent, an AgentTeam, or an AgentFlow and call it from your own program. People do not open a chat here. That is the bot.
Call these from the program you already ship. The bot page is for a person writing in Telegram, Discord, Slack, or WhatsApp.
Agent
One agent.
One instruction, then start. The call returns the reply. Put that call behind a route in your application.
from praisonaiagents import Agent
agent = Agent(
name="ContentWriter",
instructions="You are a content writer. Output in markdown format.",
)
agent.start("Write a short blog post about AI assistants")PYTHONAGENT.START
AgentTeam
Agent Team.
Give each agent a task. Agent Team runs them in order, together, or under a manager, then returns one result.
from praisonaiagents import Agent, AgentTeam, Task
researcher = Agent(
name="Researcher",
role="Research Specialist",
instructions="Research and gather information on topics",
)
writer = Agent(
name="Writer",
role="Content Writer",
instructions="Write clear, engaging content",
)
task1 = Task(description="Research AI trends", agent=researcher)
task2 = Task(description="Write article", agent=writer)
team = AgentTeam(
agents=[researcher, writer],
tasks=[task1, task2],
)
result = team.start()PYTHONTEAM.START
AgentFlow
Agent Flow.
Each step is an agent. Agent Flow runs the steps in order, and can branch, loop, or run steps together. The result is the last step.
from praisonaiagents import Agent, AgentFlow
writer = Agent(
name="Writer",
instructions="Write content based on the input",
)
editor = Agent(
name="Editor",
instructions="Edit and improve the content",
)
flow = AgentFlow(steps=[writer, editor])
result = flow.start("Write about artificial intelligence")
print(result["output"])PYTHONFLOW.START