openclaw - 💡(How to fix) Fix [Feature]: per-agent model override for heartbeat sessions [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#60036Fetched 2026-04-08 02:37:09
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Participants
Timeline (top)
labeled ×1

Add a model option to the heartbeat configuration (either in openclaw.json or as a --model flag on openclaw system heartbeat enable) that overrides the model used specifically for heartbeat-triggered agent runs.

Root Cause

Add a model option to the heartbeat configuration (either in openclaw.json or as a --model flag on openclaw system heartbeat enable) that overrides the model used specifically for heartbeat-triggered agent runs.

Fix Action

Fix / Workaround

  • Affects any deployment running multiple agents with heartbeats enabled. Severity is low, it doesn't block functionality, but the cost impact is ongoing and scales linearly with the number of agents and heartbeat frequency.
  • In practice: a 5-agent deployment with 30-minute heartbeats runs ~240 heartbeat invocations per day. Heartbeat tasks are intentionally minimal (read a file, check a date, send one alert or reply OK), but they currently run on whatever the primary model is, in most production deployments, Sonnet or equivalent. There's no mechanism to route these lightweight, repetitive calls to a cheaper model without also downgrading all interactive sessions for that agent.
  • This occurs on every heartbeat tick, it's not intermittent. The consequence isn't errors or workflow blockage, it's persistent unnecessary spend. For a cost-conscious deployment the practical workaround is to either keep heartbeats disabled (losing proactive monitoring) or accept the overhead. Neither is a good answer for what should be a solved problem at the config layer.

The active session for the heartbeat agent (agent:main:main) consistently shows claude-sonnet-4-6 with no way to configure an alternative at the heartbeat level. The only workaround available today is setting a per-agent default model in openclaw.json, which affects all interactive sessions for that agent — not just heartbeat invocations.

RAW_BUFFERClick to expand / collapse

Summary

Add a model option to the heartbeat configuration (either in openclaw.json or as a --model flag on openclaw system heartbeat enable) that overrides the model used specifically for heartbeat-triggered agent runs.

Problem to solve

Currently heartbeats always use the agent's default model (inherited from agents.defaults.model). There's no way to configure a lighter/cheaper model specifically for heartbeat invocations without affecting all interactive sessions for that agent.

Proposed solution

"heartbeat": { "interval": "30m",
"model": "openrouter/anthropic/claude-haiku-4.5"
}

Alternatives considered

  1. Per-agent default model (safest, but a blunt instrument) Set Haiku as the default model for a specific agent in openclaw.json. Heartbeats and all interactive conversations for that agent would use Haiku. Probably too limiting.

  2. Temp-switch script (risky) A script that switches the global default to Haiku, fires the heartbeat, waits, then switches back. The race condition is the problem. If a Telegram message arrives during the 5-10 second window, it gets Haiku instead of Sonnet. And if the script fails mid-run, the config stays wrong until manually fixed.

  3. Replace heartbeats with cron + openclaw agent calls (no model gain) Disable the OpenClaw heartbeat and drive the same behavior via cron calling openclaw agent. But since openclaw agent also inherits the global model, you gain nothing on cost, just more complexity.

Impact

  • Affects any deployment running multiple agents with heartbeats enabled. Severity is low, it doesn't block functionality, but the cost impact is ongoing and scales linearly with the number of agents and heartbeat frequency.
  • In practice: a 5-agent deployment with 30-minute heartbeats runs ~240 heartbeat invocations per day. Heartbeat tasks are intentionally minimal (read a file, check a date, send one alert or reply OK), but they currently run on whatever the primary model is, in most production deployments, Sonnet or equivalent. There's no mechanism to route these lightweight, repetitive calls to a cheaper model without also downgrading all interactive sessions for that agent.
  • This occurs on every heartbeat tick, it's not intermittent. The consequence isn't errors or workflow blockage, it's persistent unnecessary spend. For a cost-conscious deployment the practical workaround is to either keep heartbeats disabled (losing proactive monitoring) or accept the overhead. Neither is a good answer for what should be a solved problem at the config layer.

Evidence/examples

Running openclaw system heartbeat --help and openclaw system heartbeat enable --help confirms no --model flag exists. The openclaw agent CLI also has no --model flag. Per-agent model config (agents.list[n].model) is not a supported key in openclaw.json — openclaw config get agents.main.model returns Config path not found.

Gateway logs confirm heartbeats fire using the global default model with no override mechanism:

{"subsystem":"gateway/heartbeat","intervalMs":1800000,"heartbeat":"started"}

The active session for the heartbeat agent (agent:main:main) consistently shows claude-sonnet-4-6 with no way to configure an alternative at the heartbeat level. The only workaround available today is setting a per-agent default model in openclaw.json, which affects all interactive sessions for that agent — not just heartbeat invocations.

Confirmed on OpenClaw v2026.3.28, macOS 26.4, Node 22.22.2.

Additional information

No response

extent analysis

TL;DR

Add a model option to the heartbeat configuration in openclaw.json to override the default model used for heartbeat-triggered agent runs.

Guidance

  • Introduce a new configuration option heartbeat.model in openclaw.json to specify a model for heartbeat invocations, separate from the default model used by the agent.
  • Update the openclaw system heartbeat enable command to accept a --model flag, allowing users to configure the heartbeat model at runtime.
  • Verify the fix by checking the gateway logs for the subsystem "gateway/heartbeat" and ensuring that the specified model is used for heartbeat invocations.
  • Test the configuration by setting a different model for heartbeat invocations and verifying that it is used correctly.

Example

"heartbeat": {
  "interval": "30m",
  "model": "openrouter/anthropic/claude-haiku-4.5"
}

Notes

The proposed solution requires updates to the openclaw.json configuration file and the openclaw system heartbeat enable command. The fix should be applied to the latest version of OpenClaw, and users should verify the changes by checking the gateway logs and testing the configuration.

Recommendation

Apply the workaround by adding the model option to the heartbeat configuration in openclaw.json, as this allows for a more fine-grained control over the model used for heartbeat invocations without affecting all interactive sessions for the agent.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING