Jobs & Scheduling
Agent workflows integrate with the Trident job system (PgBoss). Jobs are used for session resume and periodic cleanup.
Job types
The agent-related queues are defined in apps/trident-web/src/lib/jobs/types.ts.
agents.run_pipeline: run the E-E-A-T pipeline orchestrator with sessions enabled for stage agentsagents.resume_session: resume a previously checkpointed sessionagents.cleanup_sessions: delete expired sessions (+ checkpoints via cascade)
Scheduling cleanup
When AUTO_START_JOBS=true, Trident Web schedules a daily cleanup job at midnight UTC in apps/trident-web/src/instrumentation.ts.
AUTO_START_JOBS=true
DATABASE_URL=postgresql://...Cron job processing
In serverless deployments, jobs can be processed via the cron endpoint: GET /api/cron/job-processor. Protect it by setting CRON_SECRET and providing an Authorization header.
# Example
CRON_SECRET=your-secret
GET /api/cron/job-processor
Authorization: Bearer your-secretManual enqueue
You can enqueue jobs using sendJob.
import { sendJob, QUEUES } from "@/lib/jobs";
await sendJob(QUEUES.AGENTS_CLEANUP_SESSIONS, { olderThanDays: 7 });
await sendJob(QUEUES.AGENTS_RESUME_SESSION, {
organizationId: "org_123",
sessionId: "session_uuid",
});