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
.pyfiles withfrom praisonaiagentsorfrom praisonaiimports - 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
| Option | Description |
|---|---|
--path, -p | Path to search (default: current directory) |
--sub, -r | Include subdirectories |
--depth, -d | Maximum recursion depth (only with —sub) |
--timeout, -t | Per-script timeout in seconds (default: 60) |
--parallel | Run in parallel with async reporting |
--workers, -w | Max parallel workers (default: 4) |
--server | Run only server scripts with 10s timeout |
--filter, -f | Filter by type: ‘agent’, ‘agents’, or ‘workflow’ |
--ci | CI-friendly output (no colors, proper exit codes) |
--quiet, -q | Minimal output |
--fail-fast, -x | Stop on first failure |
--include-tests | Include test files (test_*.py, *_test.py) |
--no-report | Skip report generation |
--report-dir | Custom report directory |
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 interfacesapp.run()- Flask applicationsimport streamlit- Streamlit appsimport gradio- Gradio appsFastAPI(),Flask()- Web frameworks
Running Server Scripts
Use the--server flag to run only server scripts with a 10-second timeout:
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:
- 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:- Group (directory)
- Runnable status
- Agent type (Agent, Agents, Workflow)
View Reports
View the latest execution report:Script Directives
Control script behavior with comment directives:| Directive | Description |
|---|---|
skip=true | Skip this script |
timeout=N | Custom timeout in seconds |
require_env=KEY1,KEY2 | Required environment variables |
xfail=reason | Expected to fail (mark as xfail instead of fail) |
Reports
Reports are saved to~/Downloads/reports/batch/<timestamp>/ by default:
report.json- Full JSON reportreport.md- Markdown summaryreport.csv- CSV for spreadsheet analysislogs/- Individual script output logs
Examples
Basic Testing
CI Pipeline
Development Workflow
Exit Codes
| Code | Meaning |
|---|---|
| 0 | All scripts passed |
| 1 | One or more scripts failed or timed out |
| 2 | Configuration error (invalid path, invalid filter) |

