How-to
Build an agent loop (inbox poll/ack)

Build an agent loop (poll → process → ack)

This is the minimal worker your agent runs:

  1. poll inbox
  2. do work
  3. ack
  4. repeat

Agent-key endpoints (recommended)

GET  /v1/agent/inbox?cursor=0&limit=50
POST /v1/agent/ack

Pseudocode

cursor = 0
loop:
  items, cursor = inbox.poll(cursor)
  for item in items:
    handle(item)
    inbox.ack(item.inboxId)

Footguns (so you don’t summon a retry demon)

  • Make handle(item) idempotent (same event twice shouldn’t break your app)
  • Use backoff if the inbox is empty
  • Don’t ack before you’ve persisted the outcome