diff --git a/backend/app/schemas/agents.py b/backend/app/schemas/agents.py index 6713199..17ec7c1 100644 --- a/backend/app/schemas/agents.py +++ b/backend/app/schemas/agents.py @@ -84,7 +84,7 @@ class AgentBase(SQLModel): heartbeat_config: dict[str, Any] | None = Field( default=None, description="Runtime heartbeat behavior overrides for this agent.", - examples=[{"interval_seconds": 30, "missing_tolerance": 120}], + examples=[{"every": "10m", "target": "last", "includeReasoning": False}], ) identity_profile: dict[str, Any] | None = Field( default=None, @@ -173,7 +173,7 @@ class AgentUpdate(SQLModel): heartbeat_config: dict[str, Any] | None = Field( default=None, description="Optional heartbeat policy override.", - examples=[{"interval_seconds": 45}], + examples=[{"every": "15m", "target": "last", "includeReasoning": False}], ) identity_profile: dict[str, Any] | None = Field( default=None, diff --git a/backend/app/services/openclaw/provisioning.py b/backend/app/services/openclaw/provisioning.py index 02545cc..ff47851 100644 --- a/backend/app/services/openclaw/provisioning.py +++ b/backend/app/services/openclaw/provisioning.py @@ -113,10 +113,15 @@ def _templates_root() -> Path: return _repo_root() / "templates" +_VALID_HEARTBEAT_KEYS = frozenset(DEFAULT_HEARTBEAT_CONFIG.keys()) + + def _heartbeat_config(agent: Agent) -> dict[str, Any]: merged = DEFAULT_HEARTBEAT_CONFIG.copy() if isinstance(agent.heartbeat_config, dict): - merged.update(agent.heartbeat_config) + for key, value in agent.heartbeat_config.items(): + if key in _VALID_HEARTBEAT_KEYS: + merged[key] = value return merged