Skip to main content
Agents can run on a schedule - daily reports, hourly checks, or one-time tasks.

Quick Start

1

Simple Usage

import { Agent, Job } from 'praisonai';

const agent = new Agent({
  instructions: 'Generate daily sales reports'
});

const job = new Job({
  agent,
  task: 'Create the daily sales summary',
  schedule: '0 9 * * *'  // Every day at 9 AM
});

await job.start();
2

With Configuration

const job = new Job({
  agent,
  task: 'Check system status',
  interval: '30m'  // Every 30 minutes
});

User Interaction Flow


Configuration Levels

// Level 1: String - Cron schedule
const job = new Job({
  agent,
  task: 'Daily report',
  schedule: '0 9 * * *'
});

// Level 2: Dict - With options
const job = new Job({
  agent,
  task: 'Check status',
  interval: '1h',
  runOnStart: true
});

// Level 3: Instance - Full control
const job = new Job({
  agent,
  task: 'Generate report',
  schedule: '0 9 * * 1-5',  // Weekdays only
  timezone: 'America/New_York',
  onComplete: (result) => sendEmail(result),
  retries: 2
});

Schedule Types

TypeExample
Cron'0 9 * * *' (daily at 9 AM)
Interval'30m', '1h', '1d'
One-timenew Date('2024-03-15')

API Reference

SessionConfig

Session configuration

Best Practices

Cron is best for “every day at 9 AM” type schedules.
Set retries and notifications for important jobs.
Always specify timezone for user-facing schedules.

Workflows

Multi-step workflows

Execution

Execution settings