Background Tasks

Long-running agent work, scheduled reminders, recurring jobs. Persisted to disk and resumed across gateway restarts.

Three kinds of task

  • reminder โ€” notify at time T with a message (no LLM)
  • deferred-run โ€” at time T, run agent loop with a prompt
  • deferred-now โ€” run agent loop now in background, notify when done

Examples

# Set a reminder for 1 hour
curl -X POST http://127.0.0.1:18789/tasks \
  -d '{
    "kind": "reminder",
    "sessionKey": "user-123",
    "channel": "telegram",
    "payload": "BTC daily check time",
    "runAt": $(date +%s000)
  }'

# Schedule recurring daily summary at 9am
curl -X POST http://127.0.0.1:18789/tasks \
  -d '{
    "kind": "deferred-run",
    "sessionKey": "user-123",
    "channel": "telegram",
    "agent": "defi-strategist",
    "payload": "Give me yesterday market summary",
    "runAt": 1737475200000,
    "recurEveryMs": 86400000
  }'

Status & cancel

curl http://127.0.0.1:18789/tasks
curl http://127.0.0.1:18789/tasks?status=scheduled
curl -X DELETE http://127.0.0.1:18789/tasks/t_173...

Storage

Tasks persist at ~/.openvesper/tasks/<id>.json (mode 0600). Daemon ticks every 5s by default.

Source

Implementation: apps/gateway/src/tasks.ts

What's next?