Add cron_effort to run cron/hook turns below interactive effort#163
Open
alex-fedotyev wants to merge 1 commit into
Open
Add cron_effort to run cron/hook turns below interactive effort#163alex-fedotyev wants to merge 1 commit into
alex-fedotyev wants to merge 1 commit into
Conversation
Cron- and hook-sourced turns are sensing and triage work that fire far more often than interactive sessions and rarely need Opus-tier deliberation. They previously inherited the global agent.effort (max), which is the dominant per-turn cost on high-frequency crons such as the watcher. Add AgentConfig.cron_effort (default medium) and apply it in _build_options through a new _base_effort_for_source helper: a turn whose source is "cron" or "hook" uses cron_effort, everything else keeps effort. The chosen value still passes through _effective_effort for model-cap clamping, so it is safe on models with a shorter effort ladder. Interactive sources (web, telegram, wakeup) are unchanged.
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
Cron- and hook-sourced turns are sensing and triage work that fire far more
often than interactive sessions and rarely need the interactive model's full
reasoning depth. Today they inherit the global
agent.effort(defaultmax),so a high-frequency job like the watcher pays top-tier effort on every quiet
tick, which is the dominant per-turn cost on those jobs.
This adds
agent.cron_effort(defaultmedium) and applies it in_build_options: a turn whosesourceiscronorhookusescron_effort,while interactive sources (
web,telegram,wakeup) keepeffort. Theselected value still flows through
_effective_effort, so it is clamped to thetarget model's effort ladder and stays safe on models with a shorter ladder.
The source-to-effort choice is factored into a small
_base_effort_for_sourcestaticmethod so the policy is unit-testable inisolation, mirroring the existing
_effective_efforthelper.No migration needed:
cron_effortdefaults tomedium, and a deployment thatwants the previous behavior can set
cron_effort: max.Test plan
tests/test_engine.py:test_base_effort_for_source: cron/hook map tocron_effort;web/telegram/wakeup/api map to
effort.test_base_effort_for_source_then_capped: routing composed with themodel-cap clamp (Sonnet ladder, and pass-through for an uncapped model).
test_agent_config_cron_effort_default_and_override:from_dictdefaultis
medium, override respected,effortstays independent.python3 -m pytest tests/-> 1355 passed, 2 skipped. The only 2 failuresare pre-existing and unrelated (docker-mode detection tests that assume the
host is not a container); they fail identically on
main.