AI agents and Claude Code
Let scheduled agents and hooks report that they ran, and alert when they go quiet.
Autonomous agents run on schedules, loop for hours, and stop for reasons nobody logs: a rate limit, an expired token, a crashed container, a prompt that now returns nothing. The fix is the same as for a cron job: the agent proves it is alive by pinging, and you are told when it goes quiet.
Any agent: ping at the end of each cycle
Create a heartbeat monitor with the period you expect between completed cycles, then have the agent make one HTTP request after each cycle. Send a short summary as the body so every run has a readable log.
curl -fsS -m 10 -X POST --data-binary "processed 14 tickets, 0 errors" https://vivere.dev/p/<monitor-id>
If the agent knows it failed, report it with https://vivere.dev/p/<monitor-id>/fail and the error text.
Claude Code scheduled tasks and hooks
For a scheduled Claude Code task, add the ping as the last step of its instructions, or wrap the whole invocation:
vivere run --url https://vivere.dev/p/<monitor-id> -- claude -p "Summarise yesterday's support tickets and post to Slack"
Record what each run cost
claude -p --output-format json prints the run's result with its tokens and cost. Post that output to the ping URL as it is, with a JSON content type, and every run records its model, tokens and cost:
claude -p "Summarise yesterday's support tickets and post to Slack" --output-format json \
| curl -fsS -m 10 --retry 3 -H "Content-Type: application/json" --data-binary @- https://vivere.dev/p/<monitor-id>
The monitor's page then shows cost per run and a 30-day total, and you can set a cost alert on the monitor so a run that costs more than you expect (a loop that keeps calling tools, a prompt that pulls in far more context than it should) alerts like a missed run. To also count the work it did, add ?items=14 to the URL. Any other agent can send the same JSON shape, or the values as query parameters; the ping API lists them.
For long interactive sessions, a Stop hook in .claude/settings.json pings every time the agent finishes a turn, so a monitor with a 30-minute period tells you when a session that should be working has stalled:
{
"hooks": {
"Stop": [{ "hooks": [{ "type": "command",
"command": "curl -fsS -m 5 https://vivere.dev/p/<monitor-id> >/dev/null 2>&1 || true" }] }]
}
}
Let the agent do it through MCP
Connect Vivere as an MCP server and the agent can create its own monitor and call check_in as a tool, no curl step in the prompt.
LangChain, CrewAI, custom loops
Call the ping from the same place you log a completed run. The Python and Node guides have a wrapper that also reports exceptions with the traceback attached.
Watching the tool the agent depends on
Add an HTTP monitor for the API, webhook receiver or dashboard the agent needs. When the agent goes quiet and the API is down, you will see both and skip the guessing.