Skip to main content

praisonaiagents.background

Core SDK Background Agents Module for PraisonAI Agents. Provides the ability to run agents in the background, allowing:
  • Long-running tasks without blocking
  • Task queuing and management
  • Progress monitoring and notifications
  • Graceful cancellation
Zero Performance Impact:
  • All imports are lazy loaded via getattr
  • Background processing only when explicitly started
  • No overhead when not in use
Usage: from praisonaiagents.background import BackgroundRunner, BackgroundTask

Create a background runner

runner = BackgroundRunner()

Submit a task

task = runner.submit( agent=my_agent, prompt=“Research AI trends”, callback=on_complete )

Check status

print(task.status) # “running”, “completed”, “failed”

Wait for completion

result = await task.wait()

Overview

This module provides components for background.