Skip to main content
The 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

Expected Output:

Check Task Status

Status Output

Cancel Task

Clear Completed Tasks

Python API

Using Recipe Operations

Async callers (FastAPI / Jupyter)

Inside a running event loop, use arun_background. The sync run_background raises RuntimeError there instead of deadlocking:
Never call recipe.run_background() from a running event loop — it raises RuntimeError and points you to arun_background.

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.
In bot chats /tasks is per-user scoped — a caller only sees and cancels tasks whose metadata["user_id"] matches. See Bot Chat Commands → /tasks.

See Also