> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI Module

> PraisonAI command-line interface and programmatic access

# CLI Module

The CLI module provides the main `PraisonAI` class for running agents from YAML configurations and command-line.

## Installation

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
pip install praisonai
```

## PraisonAI Class

Main entry point for running PraisonAI agents.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonai import PraisonAI

praison = PraisonAI(agent_file="agents.yaml")
result = praison.run()
```

### Constructor

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
PraisonAI(
    agent_file: str = "agents.yaml",
    framework: str = "praisonai",
    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  | `"praisonai"`   | Framework: `praisonai`, `crewai`, `autogen`, `langgraph`, `openai_agents`, `google_adk` (precedence: CLI flag → YAML `framework:` → default) |
| `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                                                                                                              |

<Note>
  If neither `--framework` CLI flag nor YAML `framework:` key is set, PraisonAI defaults to the `praisonai` adapter.
</Note>

### Methods

#### run()

Execute the agents defined in the configuration.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
result = praison.run()
print(result)
```

**Returns**: Agent execution result (string or structured output)

#### main()

CLI entry point method.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praison = PraisonAI()
praison.main()  # Parses CLI arguments and runs
```

## CLI Usage

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# 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

```yaml theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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

### With Tools

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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

* [Auto Module](/docs/sdk/praisonai/auto) - Automated agent generation
* [Deploy Module](/docs/sdk/praisonai/deploy) - Deployment utilities
* [CLI Documentation](/docs/cli/cli) - Full CLI reference
