edozi.ai@edozi.ai
START HERE · 15 min

Design an agent that runs 24/7

Understand triggers, queues, state, approvals, observability, and the three sensible runtime patterns.

“24/7” is an operating model

Do not keep a chat tab open forever. Reliable agents wake on a trigger, claim a bounded job, load durable state, use approved tools, save the result, and stop or wait safely.

Trigger→Queue→Worker→State→Review

Choose one runtime pattern

01

Scheduled run

Best for monitoring, digests, data refreshes, and predictable editorial scans. The process starts, completes one batch, and exits.

Build this pattern ↗
02

Event-driven job

Best when an email, webhook, upload, or database event creates work. Put the event on a queue and acknowledge it quickly.

Add the controls ↗
03

Always-on worker

Best for low-latency queues and continuous monitoring. The worker still processes bounded jobs and survives restarts.

Build this pattern ↗

The minimum durable architecture

  • Trigger: cron, webhook, queue message, or database event.
  • Job store: immutable input, status, attempt count, timestamps, and idempotency key.
  • Worker: a bounded agent run with a deadline, tool allowlist, and budget.
  • State: results and checkpoints stored in a database or object store—not only in chat history.
  • Control: approvals for public, financial, destructive, or person-directed actions.
  • Operations: logs, metrics, alerts, retries, dead-letter queue, and kill switch.

Start in this order

  1. Make one run deterministic.

    Given the same job ID, it should not create duplicate messages, posts, charges, or records.

  2. Schedule it.

    Run every hour before trying every minute. Observe cost, latency, and failure modes.

  3. Add events or a persistent worker.

    Only when the required response time justifies the operational complexity.

  4. Add autonomy last.

    Expand permissions only after you can audit, stop, replay, and review the system.

Continue building

All tutorials ↗