background command manages background task execution for agents and recipes.
Quick Start
Commands Overview
Submit a Recipe
Submit a recipe to run in the background:Submit Options
Alternative: Recipe Run with Background Flag
You can also use the recipe run command with the--background flag:
List Tasks
Check Task Status
Status Output
Cancel Task
Clear Completed Tasks
Python API
Using Recipe Operations
Async callers (FastAPI / Jupyter)
Inside a running event loop, usearun_background. The sync run_background raises RuntimeError there instead of deadlocking:
Using BackgroundRunner Directly
Safe Defaults
Complete Workflow Example
Scripting with JSON Output
Inspect the same tasks from chat
praisonai background list and the in-conversation /tasks command read the same process-wide runner (get_background_runner()), so tasks submitted here are also visible from the REPL, TUI, and bot chats.
/tasks is per-user scoped — a caller only sees and cancels tasks whose metadata["user_id"] matches. See Bot Chat Commands → /tasks.
Performance
Connection reuse (PR #5322): Repeated invocations of
praisonai background <subcommand> no longer spawn a fresh event loop per call. Per-loop connection pools (e.g. httpx.AsyncClient) and any embedder-installed scoped_bridge() are preserved across calls, so a supervisor loop invoking this command in a tight loop won’t leak sockets or hit RuntimeError: Event loop is closed. See run_cli_coro().See Also
- Background Tasks Feature
- Bot Chat Commands - Inspect and cancel tasks from chat with
/tasks - Async Jobs CLI
- Scheduler CLI
- Background Tasks SDK

