Skip to main content

Module background

Module background 

Source
Expand description

Background task manager for long-horizon async runs

Supports assign-and-walk-away execution with persistence across restarts. Tasks are serialized to JSON in a configurable directory and can be resumed on process restart.

§Architecture

  • BackgroundTaskManager — owns the task store and manages lifecycle
  • BackgroundTask — a single task with status, prompt, and result
  • TaskStatus — pending → running → completed / failed
  • Tasks are persisted as individual JSON files in tasks/ directory

§Usage

let mut manager = BackgroundTaskManager::new("/tmp/ravenclaws-tasks")?;
let task_id = manager.submit("Analyze this data", llm_client).await?;
let status = manager.status(&task_id)?;

Structs§

BackgroundTask
A single background task with full lifecycle tracking
BackgroundTaskManager
Manager for background tasks with disk persistence

Enums§

TaskStatus
Status of a background task