Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
CLI Module
The CLI module provides the main PraisonAI class for running agents from YAML configurations and command-line.
Installation
PraisonAI Class
Main entry point for running PraisonAI agents.
from praisonai import PraisonAI
praison = PraisonAI(agent_file="agents.yaml")
result = praison.run()
Constructor
PraisonAI(
agent_file: str = "agents.yaml",
framework: str = "praisonaiagents",
auto: bool = False,
agent_yaml: str = None,
tools: list = None
)
| Parameter | Type | Default | Description |
|---|
agent_file | str | "agents.yaml" | Path to YAML agent definition |
framework | str | "praisonaiagents" | Framework: praisonaiagents, crewai, autogen |
auto | bool | False | Enable auto mode for agent generation |
agent_yaml | str | None | YAML content as string (alternative to file) |
tools | list | None | List of tools to make available |
Methods
run()
Execute the agents defined in the configuration.
result = praison.run()
print(result)
Returns: Agent execution result (string or structured output)
main()
CLI entry point method.
praison = PraisonAI()
praison.main() # Parses CLI arguments and runs
CLI Usage
# Run with default agents.yaml
praisonai
# Specify agent file
praisonai --agent-file my-agents.yaml
# Auto mode - generate agents from prompt
praisonai --auto "Create a research team"
# Use specific framework
praisonai --framework crewai
# Interactive chat mode
praisonai --chat
# Code mode
praisonai --code "Fix the bug in main.py"
CLI Flags
| Flag | Description |
|---|
--agent-file | Path to YAML agent definition |
--framework | Framework to use |
--auto | Enable auto mode with prompt |
--chat | Interactive chat mode |
--code | Code agent mode |
--ui | Launch web UI |
--deploy | Deploy as API |
YAML Configuration
framework: praisonaiagents
topic: Research AI trends
roles:
researcher:
role: Research Analyst
goal: Research and analyze AI trends
backstory: Expert researcher with deep knowledge
tasks:
research_task:
description: Research the latest AI developments
expected_output: Comprehensive research report
Programmatic Usage
from praisonai import PraisonAI
def my_tool(query: str) -> str:
return f"Result for {query}"
praison = PraisonAI(
agent_file="agents.yaml",
tools=[my_tool]
)
result = praison.run()
With YAML String
yaml_content = """
framework: praisonaiagents
topic: Test
roles:
assistant:
role: Helper
goal: Help users
tasks:
help_task:
description: Provide assistance
expected_output: Helpful response
"""
praison = PraisonAI(agent_yaml=yaml_content)
result = praison.run()
See Also