コンテンツにスキップ
#0110
DaemonAgentSqlite

An agent loop that resurrects itself on FATAL

A long-running agent crashes hard. Not a clean exit, not a recoverable exception: a segfault from a misbehaving Python wheel, three crashes in thirty seconds, supervisord gives up and marks it FATAL. The naive setup leaves you with a dead agent and a Slack alert.

You configure the agent as a daemon program with autorestart: "unexpected". State lives in hoody-sqlite at a known URL: task queue, conversation history, in-flight context. A separate watchdog daemon polls GET /api/v1/daemon/status/{agent_id} every minute. If status is FATAL, the watchdog POSTs enable then start: supervisord resets, the agent process spawns fresh, reads its state from SQLite, picks up exactly where the dead loop left off.

The agent crashes; the daemon recycles it; the state survives because it never lived in the process. FATAL used to be a tombstone. With state in SQLite and lifecycle in the daemon, FATAL is just a retry.

FATAL used to be a tombstone. With state in SQLite and lifecycle in the daemon, FATAL is just a retry.