Aller au contenu
#0100
DaemonAgent

Run an agent forever, restart it when it falls

Your agent watches a Slack channel, drafts replies, and acts on approvals. It needs to run 24/7: but agents crash. Token limits hit, the LLM API rate-limits, a malformed tool response throws unhandled. Last week's agent was offline for six hours before anyone noticed.

You wrap the agent process as a daemon program with autorestart: "true". When the loop crashes, supervisord restarts it within milliseconds with a fresh process. State that needs to survive: conversation context, in-flight tasks: lives in hoody-sqlite, a URL the new process reads on startup. The agent dies. The daemon resurrects it. The conversation continues.

You GET the status URL from your dashboard once an hour. RUNNING means it's alive. BACKOFF means something deeper is wrong and you should look.

The agent doesn't manage its own lifecycle. The daemon does, and the daemon doesn't sleep.