Soft time budget on LoopBudget (wall-clock limit for agent runs)
Gap
LoopBudget supports maxUsd and maxIterations as hard limits. The contract has maxWallClockMs, but it is only enforced as a hard abort — the child agent is killed when time expires. There is no soft time budget that signals "you are running long, wrap up" before the hard limit hits.
Use case
We frequently instruct agents with time-bounded tasks: "spend 20-30 minutes, run at least 2 iterations, up to 5 subagents, deepen the subject on re-run." Today:
maxWallClockMs: 1800000kills the agent at 30 minutes with no warning and no receipts written.- There is no way to say "at 20 minutes start wrapping up" or "this iteration should take ~5 minutes".
extendSwarmBudgetLeasehandles fair-share across parallel agents, but has no time dimension — only budget units.
Proposal
Add softTimeLimitMs (and optionally expectedIterationMs) alongside the hard maxWallClockMs:
- When
softTimeLimitMsis reached, emit asoft_limit_warningevent (or set a flag the agent loop can check) so the agent can finish the current iteration, write receipts and stop cleanly. expectedIterationMswould be informational only — warn on drift, never abort.- Mirrors the existing
softLimitUsd/softLimitTokenspattern.
Why this matters for us
Our governance model is time-first, not cost-first: we budget in wall-clock minutes and CPU/RAM rather than USD (most of our model capacity is small- to zero-cost tiers, so USD caps rarely bind). The min(child, parentRemaining) cap in live-runtime.ts:775 is exactly the invariant we need — a soft time budget would complement it by letting the agent exit gracefully instead of being killed mid-tool-call.
Code references
packages/contracts/src/swarm.ts—LoopBudgettype,maxWallClockMspackages/core/src/swarm/live-runtime.ts:775— hard cappackages/core/src/swarm/scheduler.ts—extendSwarmBudgetLease
Our context
We are evaluating MartinLoop as a governance layer for a multi-profile Hermes Agent fleet routed through our own OpenAI-compatible router. We would be glad to contribute tests or a prototype if there is interest.