trw_heartbeat
Refresh a pin's heartbeat to keep it alive during long-running campaigns or to probe if the run is stale enough for checkpointing, with automatic rate limiting.
Instructions
Refresh the caller's pin heartbeat and append a heartbeat event.
Use when:
A long-running campaign needs to keep its pin alive between work units.
You want to probe whether the current run is stale enough to checkpoint.
Rate-limit: if now - last_heartbeat_ts < 60s the call short-circuits
(no events.jsonl append, no pin-store write) and returns
rate_limited=True so long-running loops don't spam the audit trail.
Rate-limit state lives in pins.json::<pin_key>::last_heartbeat_ts
so the 60s window survives server restart.
Input:
message: optional context string logged alongside the heartbeat event.
Output: TrwHeartbeatResultDict — on success {run_id, last_heartbeat_ts, stale_after_ts, age_hours, should_checkpoint, rate_limited}; on missing-pin {error: "no_active_pin", hint: "call trw_init or trw_adopt_run first"}.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "trw_heartbeat"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | No |