> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Jobs

> Schedule agent tasks

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

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
graph LR
    subgraph "Job Scheduling"
        A[⏰ Schedule] --> B[📋 Queue]
        B --> C[🤖 Agent]
        C --> D[📊 Result]
    end
    
    classDef agent fill:#8B0000,stroke:#7C90A0,color:#fff
    classDef tool fill:#189AB4,stroke:#7C90A0,color:#fff
    
    class C agent
    class A,B,D tool
    classDef agent fill:#8B0000,color:#fff
    classDef tool fill:#189AB4,color:#fff

```

## Quick Start

**1. Simple Usage**

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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**

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
const job = new Job({
  agent,
  task: 'Check system status',
  interval: '30m'  // Every 30 minutes
});
```

***

## User Interaction Flow

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
sequenceDiagram
    participant Schedule
    participant Job
    participant Agent
    
    Schedule->>Job: Trigger (9 AM)
    Job->>Agent: Execute task
    Agent-->>Job: Complete
    Job->>Job: Schedule next run
```

***

## Configuration Levels

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
// 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

| Type | Example |
| - | - |
| Cron | `'0 9 * * *'` (daily at 9 AM) |
| Interval | `'30m'`, `'1h'`, `'1d'` |
| One-time | `new Date('2024-03-15')` |

***

## API Reference

> [card] [SessionConfig](https://praison.ai/docs/sdk/reference/typescript/classes/SessionConfig.md)
>
> Session configuration

***

## Best Practices

> [accordion] Use cron for fixed times
>
> Cron is best for "every day at 9 AM" type schedules.

> [accordion] Handle failures
>
> Set retries and notifications for important jobs.

> [accordion] Consider timezones
>
> Always specify timezone for user-facing schedules.

***

## Related

> [card] [Workflows](https://praison.ai/docs/js/workflows.md)
>
> Multi-step workflows

> [card] [Execution](https://praison.ai/docs/js/execution.md)
>
> Execution settings


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.