Background Tasks CLI
Manage background tasks from the command line. Submit recipes, check status, cancel tasks, and clear completed tasks.Commands Overview
| Command | Description |
|---|---|
praisonai background list | List all background tasks |
praisonai background status <id> | Get task status |
praisonai background cancel <id> | Cancel a running task |
praisonai background clear | Clear completed tasks |
praisonai background submit | Submit a recipe as background task |
Submit a Recipe
Submit a recipe to run in the background:Submit Options
| Option | Short | Description |
|---|---|---|
--recipe | Recipe name to execute (required) | |
--input | -i | Input data as JSON string |
--config | -c | Config overrides as JSON string |
--session-id | -s | Session ID for conversation continuity |
--timeout | Timeout in seconds (default: 300) | |
--json | Output JSON for scripting |
Alternative: Recipe Run with Background Flag
You can also use the recipe run command with the--background flag:
List Tasks
List all background tasks:List Options
| Option | Description |
|---|---|
--status | Filter by status: pending, running, completed, failed, cancelled |
--page | Page number (default: 1) |
--page-size | Tasks per page (default: 20) |
--json | Output JSON for scripting |
Check Status
Get detailed status of a specific task:Status Output
Cancel Task
Cancel a running task:Clear Completed Tasks
Remove completed tasks from the list:Clear Options
| Option | Description |
|---|---|
--all | Clear all tasks including running |
--older-than | Clear tasks older than N seconds |
--json | Output JSON for scripting |
Examples
Complete Workflow
Scripting with JSON Output
Troubleshooting
Task Not Starting
If tasks remain inpending status:
- Check if max concurrent tasks limit is reached
- Verify the recipe exists and is valid
- Check system resources
Task Timeout
If tasks are timing out:- Increase timeout with
--timeoutflag - Check if the recipe is making slow API calls
- Consider breaking into smaller tasks
Cannot Find Task
If task ID is not found:- Tasks may have been cleared
- Check if using correct task ID format
- List all tasks to verify
See Also
- Background Tasks SDK - Python API for background tasks
- Async Jobs CLI - Server-based job execution
- Scheduler CLI - Periodic task scheduling

