Skip to main content

Auto Module

The Auto module provides automated agent generation from natural language prompts.

Installation

pip install praisonai

Quick Start

from praisonai import PraisonAI

# Generate agents from a prompt
praison = PraisonAI(auto="Create a team to research AI trends")
result = praison.run()

CLI Usage

# Auto mode with prompt
praisonai --auto "Create a research team for market analysis"

# Auto mode with topic
praisonai --auto "Build a content creation pipeline"

How It Works

  1. Prompt Analysis: The auto module analyzes your natural language prompt
  2. Agent Generation: Creates appropriate agents with roles, goals, and tasks
  3. YAML Creation: Generates a valid agents.yaml configuration
  4. Execution: Runs the generated agents

Configuration

Environment Variables

VariableDescription
OPENAI_API_KEYOpenAI API key for agent generation
PRAISONAI_MODELModel to use for generation (default: gpt-4o-mini)

Generated Structure

Auto mode generates a YAML structure like:
framework: praisonaiagents
topic: Research AI trends
roles:
  researcher:
    role: Research Analyst
    goal: Research and analyze AI trends
    backstory: Expert researcher with analytical skills
    tasks:
      research_task:
        description: Research the latest AI developments
        expected_output: Comprehensive research report
  
  writer:
    role: Content Writer
    goal: Create engaging content from research
    backstory: Skilled writer with technical background
    tasks:
      write_task:
        description: Write article based on research
        expected_output: Well-structured article

Programmatic Usage

from praisonai import PraisonAI

# Basic auto generation
praison = PraisonAI(auto="Create a customer support team")
result = praison.run()

# With specific framework
praison = PraisonAI(
    auto="Build a data analysis pipeline",
    framework="praisonaiagents"
)
result = praison.run()

Customization

Adding Tools

from praisonai import PraisonAI

def search_tool(query: str) -> str:
    return f"Search results for: {query}"

praison = PraisonAI(
    auto="Create a research team with web search",
    tools=[search_tool]
)
result = praison.run()

See Also