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

# Producer and schedules

> Public producer and schedules signatures and configuration in @agentium/queue 4.0.0.

Import these **3 exports** from `@agentium/queue`. Read the [producer and schedules guide](/queue/producer) for setup and behavior, or return to the [package reference](/api-reference/queue).

A `?` marks an optional field. These are declarations for lookup; run the examples in the linked guide. Follow related-type links for Agentium types and source links for imported dependency types.

## AgentQueue

[Source](https://github.com/agentiumOS/agentium/blob/v4.0.0/packages/queue/src/job-producer.ts)

```typescript theme={null}
export declare class AgentQueue {
    constructor(config: QueueConfig);
    enqueueAgentRun(opts: {
        agentName: string;
        input: string;
        sessionId?: string;
        tenantId?: string;
        userId?: string;
        priority?: number;
        delay?: number;
        attempts?: number;
        backoff?: {
            type: "exponential" | "fixed";
            delay: number;
        };
        repeat?: {
            pattern: string;
            timezone?: string;
        };
    }): Promise<{
        jobId: string;
    }>;
    enqueueWorkflow(opts: {
        workflowName: string;
        userId?: string;
        initialState?: Record<string, unknown>;
        sessionId?: string;
        tenantId?: string;
        priority?: number;
        delay?: number;
        attempts?: number;
        backoff?: {
            type: "exponential" | "fixed";
            delay: number;
        };
        repeat?: {
            pattern: string;
            timezone?: string;
        };
    }): Promise<{
        jobId: string;
    }>;
    enqueueTeamRun(opts: {
        teamName: string;
        input: string;
        sessionId?: string;
        tenantId?: string;
        userId?: string;
        priority?: number;
        delay?: number;
        attempts?: number;
        backoff?: {
            type: "exponential" | "fixed";
            delay: number;
        };
        repeat?: {
            pattern: string;
            timezone?: string;
        };
    }): Promise<{
        jobId: string;
    }>;
    getJobStatus(jobId: string): Promise<JobStatus>;
    cancelJob(jobId: string): Promise<void>;
    onCompleted(handler: (jobId: string, result: RunOutput) => void): void;
    onFailed(handler: (jobId: string, error: Error) => void): void;
    schedule(opts: ScheduleOptions): Promise<{
        jobId: string;
    }>;
    unschedule(id: string): Promise<void>;
    listSchedules(): Promise<ScheduleInfo[]>;
    /** BullMQ v5 maintenance only. Never silently converts persisted legacy repeat records. */
    listLegacySchedules(): Promise<Array<{
        key: string;
        name: string;
        pattern?: string;
        timezone?: string;
        next: number;
    }>>;
    pause(): Promise<void>;
    resume(): Promise<void>;
    /** Maintenance-only removal: callers retain inventory/payload backups and stop concurrent schedule writers. */
    removeLegacySchedule(key: string): Promise<void>;
    close(): Promise<void>;
}
```

Related: [`JobStatus`](/api-reference/queue/jobs#jobstatus), [`QueueConfig`](/api-reference/queue/producer#queueconfig), [`RunOutput`](/api-reference/core/agent#runoutput), [`ScheduleInfo`](/api-reference/queue/jobs#scheduleinfo), [`ScheduleOptions`](/api-reference/queue/producer#scheduleoptions).

## QueueConfig

[Source](https://github.com/agentiumOS/agentium/blob/v4.0.0/packages/queue/src/job-producer.ts)

```typescript theme={null}
export interface QueueConfig {
    connection: {
        host: string;
        port: number;
        password?: string;
        db?: number;
        tls?: boolean;
    } | string;
    queueName?: string;
    defaultJobOptions?: Record<string, unknown>;
}
```

## ScheduleOptions

[Source](https://github.com/agentiumOS/agentium/blob/v4.0.0/packages/queue/src/job-producer.ts)

```typescript theme={null}
export interface ScheduleOptions {
    id: string;
    cron: string;
    timezone?: string;
    agent?: {
        name: string;
        input: string;
        sessionId?: string;
        userId?: string;
        tenantId?: string;
    };
    workflow?: {
        name: string;
        initialState?: Record<string, unknown>;
        sessionId?: string;
        userId?: string;
        tenantId?: string;
    };
    team?: {
        name: string;
        input: string;
        sessionId?: string;
        userId?: string;
        tenantId?: string;
    };
}
```


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