Models
- Recommended:
gpt-4o(latest, best quality) - Fast/Cheap:
gpt-4o-mini(fast, cost-effective) - Reasoning:
o1,o1-mini(advanced reasoning) - Latest:
gpt-4.1,gpt-4.5-preview(newest releases)
Python
Copy
# export OPENAI_API_KEY=your-api-key
from praisonaiagents import Agent
agent = Agent(
instructions="You are a helpful assistant",
llm="gpt-4o"
)
agent.start("What is artificial intelligence?")
With Tools
Copy
# export OPENAI_API_KEY=your-api-key
from praisonaiagents import Agent
def get_weather(city: str) -> str:
"""Get weather for a city."""
return f"Weather in {city}: 72°F, Sunny"
agent = Agent(
instructions="You are a weather assistant",
llm="gpt-4o-mini",
tools=[get_weather]
)
agent.start("What's the weather in Tokyo?")
Multi-Agent
Copy
# export OPENAI_API_KEY=your-api-key
from praisonaiagents import Agent, Task, Agents
researcher = Agent(
instructions="You research topics thoroughly",
llm="gpt-4o"
)
writer = Agent(
instructions="You write clear summaries",
llm="gpt-4o-mini"
)
task1 = Task(description="Research AI trends", agent=researcher)
task2 = Task(description="Summarize findings", agent=writer)
agents = Agents(agents=[researcher, writer], tasks=[task1, task2])
agents.start()
CLI
Copy
export OPENAI_API_KEY=your-api-key
# Basic prompt
python -m praisonai "What is AI?" --llm gpt-4o
# With temperature
python -m praisonai "Write a poem" --llm gpt-4o --temperature 0.9
# With tools
python -m praisonai "Search for AI news" --llm gpt-4o --tools web_search
# Run agents.yaml
python -m praisonai
YAML
Copy
framework: praisonai
topic: Research AI trends
agents:
researcher:
role: Research Analyst
goal: Find latest AI developments
instructions: You are an expert researcher who finds accurate information
llm:
model: gpt-4o
tasks:
research_task:
description: Research the latest trends in artificial intelligence
expected_output: A comprehensive report on AI trends
writer:
role: Content Writer
goal: Create clear summaries
instructions: You write engaging and clear content
llm:
model: gpt-4o-mini
tasks:
write_task:
description: Write a summary of the research findings
expected_output: A well-written summary article

