Guide

Sidekiq-safe AI jobs.

LLM calls fail more, cost more, and take longer than your average job. Here is how Rails Agent handles that so you do not have to.

Retries that respect rate limits

AgentJob detects provider rate-limit responses and reschedules with server-suggested backoff instead of Sidekiq default retry.

Idempotency keys

Every run has a deterministic idempotency key so a retried job never bills you twice.

Cost caps per job

class SummariseJob < RailsAgent::AgentJob
  agent Summariser
  max_cost_cents 5
  on_cost_exceeded :notify_and_pause
end