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

# Scheduler CLI

> CLI commands for scheduling periodic agent and recipe execution

# Scheduler CLI

Schedule agents and recipes to run periodically as background daemons. Perfect for monitoring tasks, periodic reports, and automated workflows.

## Commands Overview

| Command                              | Description               |
| ------------------------------------ | ------------------------- |
| `praisonai schedule start`           | Start a new scheduler     |
| `praisonai schedule list`            | List all schedulers       |
| `praisonai schedule stop <name>`     | Stop a scheduler          |
| `praisonai schedule logs <name>`     | View scheduler logs       |
| `praisonai schedule restart <name>`  | Restart a scheduler       |
| `praisonai schedule delete <name>`   | Delete a scheduler        |
| `praisonai schedule describe <name>` | Show scheduler details    |
| `praisonai schedule save <name>`     | Export scheduler config   |
| `praisonai schedule stop-all`        | Stop all schedulers       |
| `praisonai schedule stats`           | Show aggregate statistics |

## Start a Scheduler

### With a Task Prompt

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Basic scheduler with task
praisonai schedule start news-checker "Check AI news and summarize" --interval hourly

# With custom interval
praisonai schedule start monitor "Monitor system status" --interval "*/30m"

# With timeout and budget
praisonai schedule start reporter "Generate daily report" \
    --interval daily \
    --timeout 300 \
    --max-cost 1.00

# With max retries
praisonai schedule start checker "Check for updates" \
    --interval hourly \
    --max-retries 5
```

### With a Recipe

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Schedule a recipe
praisonai schedule start news-monitor --recipe news-analyzer --interval hourly

# Recipe with custom interval
praisonai schedule start daily-report --recipe report-generator --interval daily

# Recipe with all options
praisonai schedule start my-scheduler \
    --recipe my-recipe \
    --interval "*/6h" \
    --timeout 600 \
    --max-cost 2.00 \
    --max-retries 3
```

### With an Agents YAML File

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Schedule from agents.yaml
praisonai schedule agents.yaml

# With interval override
praisonai schedule agents.yaml --interval "*/2h"
```

### Start Options

| Option          | Description                                     |
| --------------- | ----------------------------------------------- |
| `--recipe`      | Recipe name to schedule                         |
| `--interval`    | Schedule interval (hourly, daily, \*/30m, etc.) |
| `--timeout`     | Timeout per execution in seconds                |
| `--max-cost`    | Maximum budget in USD                           |
| `--max-retries` | Maximum retry attempts (default: 3)             |
| `--daemon`      | Run as background daemon                        |
| `--verbose`     | Enable verbose logging                          |

### Interval Formats

| Format   | Description        |
| -------- | ------------------ |
| `hourly` | Every hour         |
| `daily`  | Every day          |
| `*/30m`  | Every 30 minutes   |
| `*/6h`   | Every 6 hours      |
| `3600`   | Every 3600 seconds |

## List Schedulers

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# List all schedulers
praisonai schedule list
```

### Output

```
Name                 Status     PID      Interval     Task
================================================================================
news-checker         🟢 running 12345    hourly       Check AI news and summarize
daily-report         🟢 running 12346    daily        Generate daily report
monitor              🔴 stopped 0        */30m        Monitor system status

Total: 3 scheduler(s)
```

## Stop a Scheduler

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Stop by name
praisonai schedule stop news-checker

# Stop all schedulers
praisonai schedule stop-all
```

## View Logs

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# View recent logs
praisonai schedule logs news-checker

# Follow logs in real-time
praisonai schedule logs news-checker --follow

# Show more lines
praisonai schedule logs news-checker --lines 100
```

## Restart a Scheduler

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Restart by name
praisonai schedule restart news-checker
```

## Delete a Scheduler

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Delete by name (stops if running)
praisonai schedule delete news-checker
```

## Describe a Scheduler

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Show detailed information
praisonai schedule describe news-checker
```

### Output

```
Scheduler: news-checker
========================
Status: running
PID: 12345
Task: Check AI news and summarize
Recipe: news-analyzer
Interval: hourly
Timeout: 300s
Budget: $1.00
Max Retries: 3
Started: 2024-01-15 10:30:00

Statistics:
  Total Executions: 24
  Successful: 23
  Failed: 1
  Success Rate: 95.8%
  Total Cost: $0.0024
```

## Save Scheduler Config

Export a scheduler's configuration to YAML:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Save to file
praisonai schedule save news-checker --output news-checker.yaml
```

### Output YAML

```yaml theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
name: news-checker
task: Check AI news and summarize
recipe_name: news-analyzer
interval: hourly
timeout: 300
max_cost: 1.00
max_retries: 3
```

## Show Statistics

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Aggregate stats for all schedulers
praisonai schedule stats

# Stats for specific scheduler
praisonai schedule stats news-checker
```

## Examples

### Complete Workflow

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# 1. Start a recipe scheduler
praisonai schedule start news-monitor \
    --recipe news-analyzer \
    --interval hourly \
    --max-cost 0.50

# 2. List schedulers
praisonai schedule list

# 3. Check logs
praisonai schedule logs news-monitor --follow

# 4. View stats
praisonai schedule describe news-monitor

# 5. Stop when done
praisonai schedule stop news-monitor
```

### Foreground Mode (for Testing)

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Run in foreground (Ctrl+C to stop)
praisonai schedule "Check news" --interval "*/10s"
```

### Production Daemon

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Start as daemon
praisonai schedule start production-monitor \
    --recipe system-monitor \
    --interval "*/5m" \
    --daemon

# Check it's running
praisonai schedule list

# View logs
praisonai schedule logs production-monitor --follow
```

### Multiple Schedulers

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Start multiple schedulers
praisonai schedule start hourly-news --recipe news-monitor --interval hourly
praisonai schedule start daily-report --recipe report-generator --interval daily
praisonai schedule start health-check --recipe health-checker --interval "*/5m"

# List all
praisonai schedule list

# Stop all at once
praisonai schedule stop-all
```

## Troubleshooting

### Scheduler Not Starting

If scheduler fails to start:

* Check if name is already in use: `praisonai schedule list`
* Verify recipe exists: `praisonai recipe list`
* Check logs for errors

### High Cost

If costs are higher than expected:

* Set `--max-cost` budget limit
* Increase interval between executions
* Use a smaller/cheaper model

### Scheduler Stopped Unexpectedly

If scheduler stops:

* Check logs: `praisonai schedule logs <name>`
* Verify API keys are set
* Check if budget limit was reached

### Cannot Stop Scheduler

If stop command doesn't work:

* Get PID from list: `praisonai schedule list`
* Kill manually: `kill <PID>`
* Delete state: `praisonai schedule delete <name>`

## See Also

* [Scheduler SDK](/docs/sdk/praisonai/scheduler) - Python API for scheduling
* [Background Tasks CLI](/docs/sdk/praisonai/cli/background-tasks-cli) - One-time background tasks
* [Async Jobs CLI](/docs/sdk/praisonai/cli/async-jobs-cli) - Server-based job execution
