<!-- source: https://deepwiki.com/MervinPraison/PraisonAI/7.1-cli-interface -->

# CLI Interface

- README.md
- docker/Dockerfile
- docker/Dockerfile.chat
- docker/Dockerfile.dev
- docker/Dockerfile.ui
- docker/README.md
- src/praisonai-agents/pyproject.toml
- src/praisonai-agents/uv.lock
- src/praisonai/README.md
- src/praisonai/praisonai.rb
- src/praisonai/praisonai/cli/main.py
- src/praisonai/praisonai/deploy.py
- src/praisonai/praisonai/version.py
- src/praisonai/pyproject.toml
- src/praisonai/uv.lock

The CLI Interface provides command-line access to PraisonAI's multi-agent system capabilities. It serves as the primary entry point for users to create, configure, and execute AI agent workflows through terminal commands, supporting both interactive and automated deployment scenarios.

For web-based interfaces, see [Web UI (Chainlit)](/MervinPraison/PraisonAI/6.1-guardrails). For programmatic access, see [Python SDK](/MervinPraison/PraisonAI/7.1-cli-interface).

## Command Entry Points

The CLI is implemented through the `PraisonAI` class in [src/praisonai/praisonai/cli.py118-157](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli.py#L118-L157) which provides the main entry point via the `main()` method. The system supports multiple command patterns:

**CLI Command Flow Architecture**

```

```

Sources: [src/praisonai/praisonai/cli.py192-503](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli.py#L192-L503) [src/praisonai/praisonai/agents_generator.py292-408](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/agents_generator.py#L292-L408)

## Argument Parsing System

The CLI uses `argparse` to handle command-line arguments with special handling for library usage detection and test environments. The `parse_args()` method [src/praisonai/praisonai/cli.py504-715](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli.py#L504-L715) implements sophisticated argument resolution:

```

```

Sources: [src/praisonai/praisonai/cli.py504-715](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli.py#L504-L715) [src/praisonai/praisonai/cli.py508-545](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli.py#L508-L545)

## Framework Integration Architecture

The CLI routes commands to different AI agent frameworks based on configuration and availability. The `AgentsGenerator` class manages this routing:

**Framework Selection and Execution Flow**

```

```

Sources: [src/praisonai/praisonai/agents_generator.py364-408](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/agents_generator.py#L364-L408) [src/praisonai/praisonai/agents_generator.py20-75](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/agents_generator.py#L20-L75)

## Configuration Processing

The CLI supports multiple configuration input methods that are processed through different pathways:

The configuration flow handles multiple input sources [src/praisonai/praisonai/cli.py208-263](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli.py#L208-L263):

```

```

Sources: [src/praisonai/praisonai/cli.py158-191](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli.py#L158-L191) [src/praisonai/praisonai/cli.py208-263](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli.py#L208-L263)

## Direct Prompt Execution

Direct prompts bypass YAML configuration and create single agents dynamically. The `handle_direct_prompt()` method [src/praisonai/praisonai/cli.py717-789](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli.py#L717-L789) implements framework-specific agent creation:

```

```

Sources: [src/praisonai/praisonai/cli.py717-789](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli.py#L717-L789)

## Environment and Configuration Management

The CLI system manages environment variables and configuration through multiple layers:

Key environment variables processed [src/praisonai/praisonai/cli.py125-145](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli.py#L125-L145):

- MODEL_NAME / OPENAI_MODEL_NAME : LLM model selection
- OPENAI_BASE_URL / OPENAI_API_BASE / OLLAMA_API_BASE : API endpoints
- OPENAI_API_KEY : Authentication
- AUTOGEN_VERSION : AutoGen version preference
- CHAINLIT_APP_ROOT : UI configuration directory

**Configuration Priority and Resolution**

```

```

Sources: [src/praisonai/praisonai/cli.py125-150](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli.py#L125-L150) [src/praisonai/praisonai/auto.py110-127](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/auto.py#L110-L127)

## Special Command Handlers

The CLI includes specialized handlers for specific use cases beyond basic agent execution:

The deployment system supports both one-time and scheduled deployments [src/praisonai/praisonai/cli.py265-326](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli.py#L265-L326):

```

```

Sources: [src/praisonai/praisonai/cli.py265-326](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli.py#L265-L326) [src/praisonai/praisonai/scheduler.py104-150](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/scheduler.py#L104-L150)
