Skip to main content

AgentScheduler

Defined in the Agent Scheduler module.
AI Agents Framework Scheduler for running PraisonAI agents periodically. Features:
  • Interval-based scheduling (hourly, daily, custom)
  • Thread-safe operation
  • Automatic retry on failure
  • Execution logging and monitoring
  • Graceful shutdown

Constructor

agent
Any
required
No description available.
task
str
required
No description available.
config
Optional
No description available.
on_success
Optional
No description available.
on_failure
Optional
No description available.

Methods

start()

Start scheduled agent execution.

stop()

Stop the scheduler gracefully.

get_stats()

Get execution statistics.

execute_once()

Execute agent immediately (one-time execution).

Usage

scheduler = AgentScheduler(agent, task="Check news")
    scheduler.start(schedule_expr="hourly", max_retries=3)
    # Agent runs every hour automatically
    scheduler.stop()  # Stop when needed

Source

View on GitHub

praisonai/agent_scheduler.py at line 119

Agents Concept

Single Agent Guide

Multi-Agent Guide

Agent Configuration

Auto Agents