> ## 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.

# Doctor

> Comprehensive health checks and diagnostics for PraisonAI

The `praisonai doctor` command provides comprehensive health checks and diagnostics for your PraisonAI installation, configuration, and environment.

## Quick Start

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Run all fast checks
praisonai doctor

# Run checks for a specific category
praisonai doctor env
praisonai doctor config
praisonai doctor tools

# Output in JSON format
praisonai doctor --json

# CI mode with deterministic output
praisonai doctor ci
```

## Subcommands

| Subcommand    | Description                                                |
| ------------- | ---------------------------------------------------------- |
| `env`         | Check environment variables and system configuration       |
| `config`      | Validate configuration files (agents.yaml, workflow\.yaml) |
| `tools`       | Check tool availability and dependencies                   |
| `db`          | Check database drivers and connectivity                    |
| `mcp`         | Check MCP server configuration                             |
| `obs`         | Check observability providers (Langfuse, LangSmith, etc.)  |
| `skills`      | Check agent skills directories                             |
| `memory`      | Check memory storage and sessions                          |
| `permissions` | Check filesystem permissions                               |
| `network`     | Check network connectivity and proxy settings              |
| `performance` | Check import times and module counts                       |
| `ci`          | CI-optimized checks with JSON output                       |
| `selftest`    | Test agent creation and chat functionality                 |

## Global Flags

| Flag                  | Description                                        |
| --------------------- | -------------------------------------------------- |
| `--json`              | Output in JSON format                              |
| `--format text\|json` | Output format (default: text)                      |
| `--output PATH`       | Write report to file                               |
| `--deep`              | Enable deeper probes (DB connects, network checks) |
| `--timeout SEC`       | Per-check timeout in seconds (default: 10)         |
| `--strict`            | Treat warnings as failures                         |
| `--quiet`             | Minimal output                                     |
| `--no-color`          | Disable ANSI colors                                |
| `--only IDS`          | Only run these check IDs (comma-separated)         |
| `--skip IDS`          | Skip these check IDs (comma-separated)             |
| `--list-checks`       | List available check IDs                           |
| `--version`           | Show doctor module version                         |

## Exit Codes

### Root Command

| Code | Meaning                                                |
| ---- | ------------------------------------------------------ |
| 0    | All checks passed                                      |
| 1    | One or more checks failed (or warnings in strict mode) |
| 2    | Internal error                                         |

### CI Mode

| Code | Meaning                   |
| ---- | ------------------------- |
| 0    | All checks passed         |
| 1    | One or more checks failed |
| 2    | Timeout                   |
| 3    | Internal error            |

## Examples

### Environment Checks

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Check all environment settings
praisonai doctor env

# Check with API key visibility
praisonai doctor env --show-keys
```

### Configuration Validation

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Validate all config files
praisonai doctor config

# Validate specific file
praisonai doctor config --file agents.yaml

# Show expected schema
praisonai doctor config --schema
```

### Database Checks

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Check database drivers
praisonai doctor db

# Test database connectivity (deep mode)
praisonai doctor db --deep

# Check specific provider
praisonai doctor db --provider postgresql
```

### MCP Server Checks

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Check MCP configuration
praisonai doctor mcp

# List MCP tools
praisonai doctor mcp --list-tools

# Test server spawning (deep mode)
praisonai doctor mcp --deep
```

### Performance Analysis

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Check import times
praisonai doctor performance

# Set import time budget
praisonai doctor performance --budget-ms 1000

# Show top slow imports
praisonai doctor performance --top 20
```

### Self-Test

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Run mock self-test (no API calls)
praisonai doctor selftest --mock

# Run live self-test with API calls
praisonai doctor selftest --live

# Use specific model
praisonai doctor selftest --live --model gpt-4o
```

### CI Integration

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Run CI checks with JSON output
praisonai doctor ci

# Fail fast on first error
praisonai doctor ci --fail-fast

# Save report to file
praisonai doctor ci --output report.json
```

### Filtering Checks

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# List all available checks
praisonai doctor --list-checks

# Run only specific checks
praisonai doctor --only python_version,openai_api_key

# Skip specific checks
praisonai doctor --skip network_dns,network_https

# Combine filters
praisonai doctor env --only openai_api_key,anthropic_api_key
```

## JSON Output Format

```json theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
{
  "version": "1.0.0",
  "timestamp": "2025-01-01T00:00:00.000000+00:00",
  "duration_ms": 150.5,
  "environment": {
    "python_version": "3.11.0",
    "os_name": "Darwin",
    "praisonai_version": "2.7.0"
  },
  "results": [
    {
      "id": "python_version",
      "title": "Python Version",
      "category": "environment",
      "status": "pass",
      "message": "Python 3.11.0 (>= 3.9 required)",
      "duration_ms": 0.5
    }
  ],
  "summary": {
    "total": 50,
    "passed": 45,
    "warnings": 3,
    "failed": 1,
    "skipped": 1,
    "errors": 0
  },
  "exit_code": 1
}
```

## Check Categories

### Environment (`env`)

* Python version validation
* Package installation checks
* API key configuration
* OS and architecture info
* Virtual environment detection
* Binary availability (git, docker, npx)

### Configuration (`config`)

* agents.yaml existence and syntax
* workflow\.yaml validation
* .praison config directory
* .env file detection

### Tools (`tools`)

* Tool registry access
* Web search tools
* File operation tools
* Code execution tools
* API key requirements

### Database (`db`)

* Driver availability (PostgreSQL, SQLite, Redis, MongoDB)
* ChromaDB for RAG
* Connection testing (deep mode)

### MCP (`mcp`)

* Configuration file validation
* npx availability
* Python MCP package
* Server configuration validation
* Server spawn testing (deep mode)

### Observability (`obs`)

* Langfuse configuration
* LangSmith configuration
* AgentOps configuration
* PraisonAI telemetry

### Skills (`skills`)

* Skills directory discovery
* SKILL.md validation
* PraisonAI skills module

### Memory (`memory`)

* Memory directories
* JSON file integrity
* Session storage
* ChromaDB vector memory

### Permissions (`permissions`)

* \~/.praison directory
* Project .praison directory
* Temp directory
* Current working directory
* Config directory

### Network (`network`)

* DNS resolution (deep mode)
* HTTPS connectivity (deep mode)
* Proxy configuration
* SSL/TLS settings
* OpenAI base URL

### Performance (`performance`)

* Package import times
* Slow import detection (deep mode)
* Loaded module count

### Self-Test (`selftest`)

* Agent import
* Agent instantiation
* LLM configuration
* Mock/live chat testing
* Tools wiring

### Serve & Endpoints (`serve`)

* Serve module availability
* Endpoints module availability
* Endpoints CLI handler
* Server connectivity (deep mode)
* Discovery endpoint (deep mode)
* A2U module availability
* Provider adapters availability
* FastAPI availability
* Uvicorn availability
