feat(cron): support per-job max_iterations override - #2168
Closed
kpmfyi wants to merge 1 commit into
Closed
Conversation
Allow individual cron jobs to specify `max_iterations` in their job definition, overriding the global `agent.max_turns` config. This is useful for jobs that need more (or fewer) iterations than the default, such as research jobs that require extended tool use. Follows the existing per-job override pattern used by `model`, `provider`, and `base_url`. Fallback chain: job.max_iterations > config.agent.max_turns > config.max_turns > 90 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Closing this one — the use case is real but too niche to justify expanding the cronjob tool schema further. The PR also only covers the scheduler read path; it would still need the tool schema parameter and create/update plumbing in cronjob_tools.py to be usable. The global max_iterations default works for most jobs, and jobs that need more room can be tuned via prompt design. Thanks for the contribution though! |
4 tasks
inquistiff
added a commit
to inquistiff/hermes-agent-fork
that referenced
this pull request
May 27, 2026
- Extract inline one-liner into validated block with logger.warning on invalid type (string, float, negative, zero) — matches spec from PR description; closes gap that got NousResearch#2168 closed - Add tests/cron/test_scheduler_max_iterations.py: 13 tests covering fallback chain, type validation, boundary values, and scheduler import - Fallback chain: job.max_iterations (positive int) > agent.max_turns > max_turns > 90 hard default Production-validated: patch running in live cron fleet 6+ weeks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
max_iterationsin their job definition (e.g., injobs.json)agent.max_turns/max_turnsconfig on a per-job basismodel,provider, andbase_urlFallback chain:
job.max_iterations>config.agent.max_turns>config.max_turns>90Use case
Research/accumulation jobs that use web search and file tools often need 20+ iterations, while simple notification jobs only need 3-5. Currently all jobs share the same global limit, forcing a compromise that either wastes resources on simple jobs or constrains complex ones.
Example
{ "id": "daily-research", "name": "Daily Research Digest", "prompt": "Research and compile...", "max_iterations": 25, "schedule": "0 8 * * *" }Test plan
max_iterationsset uses that valuemax_iterationsfalls back to global configmax_iterationsand no global config falls back to 90🤖 Generated with Claude Code