Auto Module

Automated agent generation from natural language prompts

Auto Module

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

Installation

bash
pip install praisonai

Quick Start

python
from praisonai import PraisonAI

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

CLI Usage

bash
# 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:

yaml
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

python
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

python
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