Skip to main content

Models

  • Recommended: gemini/gemini-2.5-flash (latest, best balance)
  • Fast/Cheap: gemini/gemini-2.0-flash-lite (fastest)
  • Pro: gemini/gemini-2.5-pro (highest quality)
  • Thinking: gemini/gemini-2.0-flash-thinking-exp (reasoning)
  • Legacy: gemini/gemini-1.5-flash, gemini/gemini-1.5-pro

Python

# export GEMINI_API_KEY=your-api-key
from praisonaiagents import Agent

agent = Agent(
    instructions="You are a helpful assistant",
    llm="gemini/gemini-2.5-flash"
)
agent.start("Explain machine learning")

With Tools

# export GEMINI_API_KEY=your-api-key
from praisonaiagents import Agent

def search_web(query: str) -> str:
    """Search the web for information."""
    return f"Search results for: {query}"

agent = Agent(
    instructions="You are a research assistant",
    llm="gemini/gemini-2.5-flash",
    tools=[search_web]
)
agent.start("Find information about renewable energy")

Multi-Agent

# export GEMINI_API_KEY=your-api-key
from praisonaiagents import Agent, Task, Agents

researcher = Agent(
    instructions="You research topics thoroughly",
    llm="gemini/gemini-2.5-pro"
)
writer = Agent(
    instructions="You write clear content",
    llm="gemini/gemini-2.5-flash"
)

task1 = Task(description="Research climate change", agent=researcher)
task2 = Task(description="Write a summary", agent=writer)

agents = Agents(agents=[researcher, writer], tasks=[task1, task2])
agents.start()

Thinking Model

# export GEMINI_API_KEY=your-api-key
from praisonaiagents import Agent

agent = Agent(
    instructions="You are a problem solver",
    llm={
        "model": "gemini/gemini-2.0-flash-thinking-exp",
        "response_format": {"type": "text"}
    }
)
agent.start("Solve this logic puzzle...")

CLI

export GEMINI_API_KEY=your-api-key

# Basic prompt
python -m praisonai "Explain AI" --llm gemini/gemini-2.5-flash

# With temperature
python -m praisonai "Write a poem" --llm gemini/gemini-2.5-flash --temperature 0.9

# Run agents.yaml
python -m praisonai

YAML

framework: praisonai
topic: Research technology trends
agents:
  researcher:
    role: Tech Researcher
    goal: Find latest technology developments
    instructions: You are an expert technology researcher
    llm:
      model: gemini/gemini-2.5-pro
    tasks:
      research_task:
        description: Research the latest trends in AI and technology
        expected_output: Comprehensive technology report

  writer:
    role: Content Writer
    goal: Create engaging summaries
    instructions: You write clear and engaging content
    llm:
      model: gemini/gemini-2.5-flash
    tasks:
      write_task:
        description: Write a summary of the research findings
        expected_output: Well-written summary article