Skip to main content
The praisonai batch command discovers and runs all Python files containing PraisonAI imports in a directory. It’s designed for quick debugging and testing of multiple scripts at once.

Basic Usage

Key Features

  • Auto-discovery: Finds all .py files with from praisonaiagents or from praisonai imports
  • Server exclusion: Automatically excludes server scripts (uvicorn, Flask, streamlit, etc.) that would hang
  • Agent filtering: Filter by agent type (Agent, Agents, Workflow)
  • CI integration: Machine-readable output for automated pipelines
  • Parallel execution: Run multiple scripts concurrently
  • Report generation: JSON, Markdown, and CSV reports

Options

Server Script Handling

By default, the batch command excludes server scripts that would hang during execution. Server scripts are detected by patterns like:
  • uvicorn.run() - ASGI servers
  • .launch() - PraisonAI agent APIs, Gradio interfaces
  • app.run() - Flask applications
  • import streamlit - Streamlit apps
  • import gradio - Gradio apps
  • FastAPI(), Flask() - Web frameworks

Running Server Scripts

Use the --server flag to run only server scripts with a 10-second timeout:
This is useful for smoke-testing that server scripts start correctly.

Filtering by Agent Type

Filter scripts by the PraisonAI components they use:

CI Integration

The --ci flag provides machine-readable output suitable for CI/CD pipelines:
CI mode features:
  • No emoji/color output (plain text)
  • Proper exit codes (0 = success, 1 = failures, 2 = errors)
  • Machine-parseable summary

Example CI Output

Parallel Execution

Run scripts concurrently for faster execution:

Subcommands

List Scripts

List discovered scripts without running them:

Show Statistics

Display statistics about discovered scripts:
Output includes counts by:
  • Group (directory)
  • Runnable status
  • Agent type (Agent, Agents, Workflow)

View Reports

View the latest execution report:

Script Directives

Control script behavior with comment directives:

Reports

Reports are saved to ~/Downloads/reports/batch/<timestamp>/ by default:
  • report.json - Full JSON report
  • report.md - Markdown summary
  • report.csv - CSV for spreadsheet analysis
  • logs/ - Individual script output logs

Examples

Basic Testing

CI Pipeline

Development Workflow

Exit Codes