<!-- source: https://deepwiki.com/MervinPraison/PraisonAI/14.3-cli-examples -->

# CLI Examples

- 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

This document provides practical command-line usage examples for PraisonAI. These examples demonstrate common patterns for executing agents, configuring environments, and deploying services via the CLI. For programmatic Python API usage, see [Python Examples](/MervinPraison/PraisonAI/14.1-python-examples). For deployment automation, see [Deployment Examples](/MervinPraison/PraisonAI/14.4-deployment-examples).

## Overview

The PraisonAI CLI provides multiple interaction modes and execution patterns. All commands use the `praisonai` entry point defined in [src/praisonai/pyproject.toml24-25](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/pyproject.toml#L24-L25) The main CLI logic is implemented in [src/praisonai/praisonai/cli/main.py1-531](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L1-L531)

**Key CLI capabilities:**

- Direct prompt execution without configuration files
- YAML-based agent orchestration
- Multiple UI modes (terminal, web, chat)
- Framework selection (PraisonAI, CrewAI, AutoGen)
- Deployment and scheduling
- Configuration management

## Command Routing Architecture

```

```

**Diagram: CLI Command Flow**

The CLI routes commands through argument parsing to either direct execution, file-based execution, or specialized feature handlers. Framework selection occurs after YAML parsing.

Sources: [src/praisonai/praisonai/cli/main.py214-531](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L214-L531)

## Basic Agent Execution

### Direct Prompt Execution

Execute a one-time agent task without creating files:

```

```

The direct prompt handler is implemented in [src/praisonai/praisonai/cli/main.py311-315](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L311-L315) and creates a temporary agent instance for execution.

Sources: [src/praisonai/praisonai/cli/main.py311-419](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L311-L419) [README.md156-166](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/README.md?plain=1#L156-L166)

### YAML-Based Agent Execution

Execute agents defined in YAML configuration:

```

```

Framework selection is handled in [src/praisonai/praisonai/cli/main.py316-320](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L316-L320) with fallback logic for framework availability checks in [src/praisonai/praisonai/cli/main.py122-131](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L122-L131)

Sources: [src/praisonai/praisonai/cli/main.py214-250](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L214-L250) [src/praisonai/pyproject.toml11-22](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/pyproject.toml#L11-L22)

## Environment Configuration

### Environment Variable Patterns

```

```

```

```

**Diagram: Environment Variable Resolution**

The CLI supports multiple environment variable patterns for backward compatibility. Priority order: `MODEL_NAME` > `OPENAI_MODEL_NAME` for model selection, `OPENAI_BASE_URL` > `OPENAI_API_BASE` > `OLLAMA_API_BASE` for base URL.

Sources: [src/praisonai/praisonai/cli/main.py224-242](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L224-L242) [README.md196-216](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/README.md?plain=1#L196-L216)

## Docker CLI Usage

### Single Service Execution

```

```

Docker images are defined in [docker/Dockerfile.ui1-33](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.ui#L1-L33) [docker/Dockerfile.chat1-32](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.chat#L1-L32) [docker/Dockerfile1-47](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile#L1-L47) and [docker/Dockerfile.dev1-47](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.dev#L1-L47)

Sources: [docker/README.md24-43](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/README.md?plain=1#L24-L43) [docker/Dockerfile.ui1-33](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.ui#L1-L33) [docker/Dockerfile.chat1-32](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.chat#L1-L32)

### Multi-Service Orchestration

```

```

The docker-compose configuration manages multiple services with shared environment variables and directory configuration defined in [docker/Dockerfile.ui26-30](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.ui#L26-L30)

```

```

**Diagram: Docker Service Architecture**

All services share configuration through the `~/.praison/` directory and environment variables. Each service runs on a dedicated port with health checks.

Sources: [docker/README.md36-51](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/README.md?plain=1#L36-L51) [docker/Dockerfile.ui26-30](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.ui#L26-L30) [docker/Dockerfile.chat26-30](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.chat#L26-L30)

## Interface Modes

### UI Mode (Web Interface)

```

```

UI mode is detected in [src/praisonai/praisonai/cli/main.py93-119](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L93-L119) with lazy Chainlit import for performance. The UI directory configuration is set in [docker/Dockerfile.ui26-30](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.ui#L26-L30)

Sources: [docker/Dockerfile.ui1-33](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.ui#L1-L33) [docker/README.md78-86](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/README.md?plain=1#L78-L86) [src/praisonai/praisonai/cli/main.py106-119](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L106-L119)

### Chat Mode (Terminal Native)

```

```

Chat mode launches a Chainlit interface optimized for conversational interactions. Configuration is managed similarly to UI mode.

Sources: [docker/Dockerfile.chat1-32](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/Dockerfile.chat#L1-L32) [docker/README.md88-94](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/README.md?plain=1#L88-L94)

### Realtime Mode (Voice Interface)

```

```

Realtime mode is detected in [src/praisonai/praisonai/cli/main.py498-500](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L498-L500) and requires additional dependencies defined in [src/praisonai/pyproject.toml69-80](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/pyproject.toml#L69-L80)

Sources: [src/praisonai/praisonai/cli/main.py498-500](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L498-L500) [src/praisonai/pyproject.toml69-80](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/pyproject.toml#L69-L80)

### Call Mode (Phone Integration)

```

```

Call mode is handled in [src/praisonai/praisonai/cli/main.py502-511](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L502-L511) with availability check for the `praisonai.api.call` module.

Sources: [src/praisonai/praisonai/cli/main.py502-511](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L502-L511) [src/praisonai/pyproject.toml81-89](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/pyproject.toml#L81-L89)

## Deployment Commands

### Cloud Deployment

```

```

The deployment process is managed by the `CloudDeployer` class in [src/praisonai/praisonai/deploy.py6-185](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/deploy.py#L6-L185) which creates Dockerfile and API files, then deploys to Google Cloud Run.

```

```

**Diagram: Deployment Command Flow**

The `CloudDeployer` orchestrates Dockerfile generation, Docker image building, pushing to Google Container Registry, and deploying to Cloud Run with environment variables.

Sources: [src/praisonai/praisonai/deploy.py6-185](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/deploy.py#L6-L185) [src/praisonai/praisonai/cli/main.py422-493](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L422-L493)

### Scheduled Deployment

```

```

Scheduled deployment is handled in [src/praisonai/praisonai/cli/main.py423-477](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L423-L477) using the scheduler module for periodic execution.

Sources: [src/praisonai/praisonai/cli/main.py423-477](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L423-L477)

## Training Commands

```

```

Training mode is detected in [src/praisonai/praisonai/cli/main.py513-531](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L513-L531) and requires the `unsloth` package availability checked in [src/praisonai/praisonai/cli/main.py131](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L131-L131)

Sources: [src/praisonai/praisonai/cli/main.py513-531](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L513-L531) [src/praisonai/pyproject.toml90](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/pyproject.toml#L90-L90)

## Advanced CLI Patterns

### Input Handling Patterns

```

```

Input handling logic is in [src/praisonai/praisonai/cli/main.py255-287](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L255-L287) with stdin detection via `sys.stdin.isatty()` check.

Sources: [src/praisonai/praisonai/cli/main.py255-420](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L255-L420)

### Persistence Command

```

```

The persistence command is routed in [src/praisonai/praisonai/cli/main.py330-333](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L330-L333) to the feature handler.

Sources: [src/praisonai/praisonai/cli/main.py330-333](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L330-L333)

### Schedule Command

```

```

Schedule command routing is in [src/praisonai/praisonai/cli/main.py336-348](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L336-L348) with subcommand handling for daemon operations.

Sources: [src/praisonai/praisonai/cli/main.py336-348](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L336-L348)

### Compare Mode

```

```

Compare mode routing is in [src/praisonai/praisonai/cli/main.py354-363](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L354-L363) and [src/praisonai/praisonai/cli/main.py383-392](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L383-L392)

Sources: [src/praisonai/praisonai/cli/main.py354-392](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L354-L392)

## CLI Execution Flow

```

```

**Diagram: Complete CLI Execution Flow**

The CLI routes commands through argument parsing, command type detection, input handling (stdin/file), and framework selection before agent execution.

Sources: [src/praisonai/praisonai/cli/main.py289-531](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L289-L531)

## Common CLI Workflows

### Development Workflow

```

```

### Production Workflow

```

```

Sources: [docker/README.md224-264](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/docker/README.md?plain=1#L224-L264) [src/praisonai/praisonai/cli/main.py214-531](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L214-L531)

## CLI Configuration Summary

All CLI flags are parsed in [src/praisonai/praisonai/cli/main.py289-320](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L289-L320)

Sources: [src/praisonai/praisonai/cli/main.py214-320](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/src/praisonai/praisonai/cli/main.py#L214-L320) [README.md42-85](https://github.com/MervinPraison/PraisonAI/blob/ab80807b/README.md?plain=1#L42-L85)
