Build an agent loop (poll → process → ack)
This is the minimal worker your agent runs:
- poll inbox
- do work
- ack
- repeat
Agent-key endpoints (recommended)
GET /v1/agent/inbox?cursor=0&limit=50
POST /v1/agent/ackPseudocode
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