edozi.ai@edozi.ai
PRODUCTION · 25 min

Operate agents safely in production

Add approval gates, idempotency, budgets, dead-letter queues, alerts, and an effective kill switch.

Model the work as a state machine

Chat history is not an operations database. Persist every job’s input, state, proposed actions, evidence, approvals, attempts, and final result.

job record
{
  "id": "job_01",
  "idempotencyKey": "publication:2026-09-27:morning-brief",
  "status": "awaiting_approval",
  "attempt": 1,
  "leaseUntil": null,
  "budget": { "maxTurns": 20, "maxCostUsd": 2 },
  "proposedActions": [{ "type": "publish", "target": "draft_42" }],
  "evidence": ["source_1", "source_2"],
  "createdAt": "2026-09-27T00:00:00Z"
}

Separate thinking from authority

Agent may do automatically

Read approved sources, analyse, draft, classify, propose, and save internal artifacts.

Human approval by default

Publish, send, spend, delete, change permissions, contact people, merge to production, or act on sensitive personal data.

Production checklist

  • Idempotency: repeated delivery produces the same logical result.
  • Leases: crashed workers release work without duplicate side effects.
  • Budgets: cap wall time, turns, tokens/cost, tool calls, and parallel jobs.
  • Retries: retry transient failures with jitter; quarantine permanent failures.
  • Evidence: retain source links and tool receipts for consequential outputs.
  • Observability: measure success rate, queue lag, latency, cost, approvals, and side-effect errors.
  • Security: isolate tenants, scope credentials, redact logs, and distrust retrieved instructions.
  • Kill switch: stop new claims independently of the model and deployment pipeline.

Release ladder

  1. Shadow:

    Agent produces proposals; a human performs every action.

  2. Approve:

    Agent stages actions and a human approves each consequential one.

  3. Bounded autonomy:

    Low-risk actions proceed inside explicit limits; samples are reviewed.

  4. Expand carefully:

    Raise limits only when failure data, rollback, and monitoring justify it.

The candid rule

If you cannot stop it, replay it, explain what it did, and identify which credential caused the side effect, it is not ready to run unattended.

Continue building

All tutorials ↗