Schedule examples
Runnable file: agentium-examples/scheduling/cron-agent.ts. Guide: Schedules Needs Redis onlocalhost:6379.
1. Every 5 minutes + every morning
sessionId on the daily job → the agent can see yesterday’s report.Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Cron a queue job. Redis keeps the schedule if a process restarts.
localhost:6379.
import { Agent, openai } from "@agentium/core";
import { AgentQueue, AgentWorker } from "@agentium/queue";
const reportAgent = new Agent({
name: "report-agent",
model: openai("gpt-4o-mini"),
instructions: "You write a short status line.",
});
const connection = { host: "localhost", port: 6379 };
const queue = new AgentQueue({ connection, queueName: "scheduled-runs" });
await queue.schedule({
id: "status-check",
cron: "*/5 * * * *",
agent: { name: "report-agent", input: "System status check." },
});
await queue.schedule({
id: "daily-report",
cron: "0 9 * * *",
timezone: "Asia/Kolkata",
agent: {
name: "report-agent",
input: "Write the daily report.",
sessionId: "daily-report",
},
});
const worker = new AgentWorker({
connection,
queueName: "scheduled-runs",
agentRegistry: { "report-agent": reportAgent },
});
worker.start();
sessionId on the daily job → the agent can see yesterday’s report.