Skip to content

feat(reasoning): expose "max" effort level for Anthropic 4.6/4.7 adaptive thinking - #25401

Closed
Vic563 wants to merge 1 commit into
NousResearch:mainfrom
Vic563:feat/reasoning-max-alias
Closed

feat(reasoning): expose "max" effort level for Anthropic 4.6/4.7 adaptive thinking#25401
Vic563 wants to merge 1 commit into
NousResearch:mainfrom
Vic563:feat/reasoning-max-alias

Conversation

@Vic563

@Vic563 Vic563 commented May 14, 2026

Copy link
Copy Markdown

The Anthropic adapter has supported "max" since Opus 4.7 launched (it is also the strongest level Opus/Sonnet 4.6 accept), and ADAPTIVE_EFFORT_MAP already routes it through to output_config.effort. But "max" was never listed in VALID_REASONING_EFFORTS, so it failed parse_reasoning_effort() validation everywhere upstream — config.yaml loaders, /reasoning slash command, gateway, batch_runner — and users had to lie via "xhigh" + a 4.6 model to actually request it.

This makes "max" a first-class reasoning level alongside minimal/low/medium/high/xhigh.

Changes

  • Add "max" to VALID_REASONING_EFFORTS in hermes_constants.py and document it as the Anthropic 4.7+ adaptive-thinking ceiling
  • Update CLI help, gateway _load_reasoning_config, batch_runner help + valid_efforts, autocomplete subcommands, setup wizard canonical_order, and all 16 locale files (status + unknown_arg messages)
  • Update bundled hermes-agent skill + corresponding website doc page
  • Update website/docs/user-guide/configuration.md reference

Provider compatibility

  • Anthropic adapter (4.6+): pass-through via existing ADAPTIVE_EFFORT_MAP; 4.6/4.7 both accept "max" natively
  • LM Studio: added "max" to _LM_VALID_EFFORTS; the existing allowed_options clamp will downgrade if a model does not expose it
  • Gemini 3 Flash/Pro: "max" maps to the same "high" thinking level as "xhigh" (matches the existing xhigh treatment)
  • Codex Responses (OpenAI/xAI): clamp "max""high" via _effort_clamp, matching the existing minimallow pattern. Same clamp applied in auxiliary_client.py for consistency

Tests

  • test_hermes_constants.py: documented-set guard now requires "max"; new test_max_is_a_valid_level covers normalization (MAX, Max , etc.)
  • test_codex_transport.py: new test_max_effort_clamped verifies the Codex backend never sees a literal "max"
  • test_anthropic_adapter.py: pre-existing tests already cover max on 4.6/4.7

360 reasoning/anthropic/codex/chat-completions tests pass. The 10 TestResolveAnthropicToken failures observed during local testing are pre-existing on origin/main (env-var leakage in test isolation, unrelated to this change).

…tive thinking

The Anthropic adapter has supported "max" since Opus 4.7 launched (it's
also the strongest level Opus/Sonnet 4.6 accept), and ADAPTIVE_EFFORT_MAP
already routes it through to output_config.effort. But "max" was never
listed in VALID_REASONING_EFFORTS, so it failed parse_reasoning_effort()
validation everywhere upstream — config.yaml loaders, /reasoning slash
command, gateway, batch_runner — and users had to lie via "xhigh" + a 4.6
model to actually request it.

This makes "max" a first-class reasoning level alongside minimal/low/medium
/high/xhigh:

  - Add "max" to VALID_REASONING_EFFORTS in hermes_constants.py and
    document it as the Anthropic 4.7+ adaptive-thinking ceiling
  - Update CLI help, gateway _load_reasoning_config, batch_runner help
    + valid_efforts, autocomplete subcommands, setup wizard canonical
    order, and all 16 locale files (status + unknown_arg messages)
  - Update bundled hermes-agent skill + corresponding website doc page
  - Update website/docs/user-guide/configuration.md reference

Provider compatibility:

  - Anthropic adapter (4.6+): pass-through via existing ADAPTIVE_EFFORT_MAP;
    4.6/4.7 both accept "max" natively
  - LM Studio: added "max" to _LM_VALID_EFFORTS; the existing allowed_options
    clamp will downgrade if a model doesn't expose it
  - Gemini 3 Flash/Pro: "max" maps to the same "high" thinking level as
    "xhigh" (matches the existing xhigh treatment)
  - Codex Responses (OpenAI/xAI): clamp "max" → "high" via _effort_clamp,
    matching the existing minimal → low pattern. Same clamp applied in
    auxiliary_client.py for consistency

Tests:

  - test_hermes_constants.py: documented set guard now requires "max";
    new test_max_is_a_valid_level covers normalization
  - test_codex_transport.py: new test_max_effort_clamped verifies the
    Codex backend never sees a literal "max"
  - test_anthropic_adapter.py: pre-existing tests already cover max
    on 4.6/4.7

360 reasoning/anthropic/codex/chat-completions tests pass. The 10
TestResolveAnthropicToken failures are pre-existing on origin/main
(env-var leakage, unrelated to this change).
Copilot AI review requested due to automatic review settings May 14, 2026 03:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new "max" reasoning effort level to the existing set (none|minimal|low|medium|high|xhigh), wiring it through the constants registry, CLI/gateway commands, provider transports, localization strings, and documentation.

Changes:

  • Add "max" to VALID_REASONING_EFFORTS and accept it in parsing/validation paths.
  • Map "max" appropriately in provider adapters (Codex/auxiliary clamp to "high"; Gemini maps to "high"; LM Studio accepts).
  • Update CLI/gateway help text, slash-command subcommands, and all locale strings; add tests.

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
hermes_constants.py Adds "max" to valid efforts; expanded docstring.
hermes_cli/main.py Adds "max" to canonical order in prompt selection.
hermes_cli/commands.py Adds "max" subcommand for /reasoning.
gateway/run.py Accepts "max" and updates docstring.
cli.py Updates /reasoning help/error text to include "max".
batch_runner.py Adds "max" to valid efforts list and docstring.
agent/transports/codex.py Clamps "max""high" for Codex backend.
agent/transports/chat_completions.py Maps "max" for Gemini Flash/Pro.
agent/lmstudio_reasoning.py Adds "max" to LM Studio's accepted set.
agent/auxiliary_client.py Auxiliary client clamps "max""high".
locales/*.yaml (16 files) Updates /reasoning usage and unknown-arg strings to include "max".
skills/.../SKILL.md, website/docs/... Doc updates listing "max".
tests/test_hermes_constants.py Adds test_max_is_a_valid_level; updates documented-levels set.
tests/agent/transports/test_codex_transport.py Adds test_max_effort_clamped.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +56 to 57
if effort not in {"minimal", "low", "medium", "high", "xhigh", "max"}:
effort = "medium"
Comment thread agent/transports/codex.py
Comment on lines +89 to 90
_effort_clamp = {"minimal": "low", "max": "high"}
reasoning_effort = _effort_clamp.get(reasoning_effort, reasoning_effort)
Comment on lines 71 to 73
thinking_config["thinkingLevel"] = (
"high" if effort in {"high", "xhigh"} else "low"
"high" if effort in {"high", "xhigh", "max"} else "low"
)
rather than 400ing the request."""
messages = [{"role": "user", "content": "Hi"}]
kw = transport.build_kwargs(
model="gpt-5.4", messages=messages, tools=[],
Comment thread hermes_constants.py
Comment on lines +202 to +204
treat it as their own ceiling — for example, OpenRouter/OpenAI-style
`reasoning.effort` consumers should map "max" to their highest supported
level.
@pytest.mark.parametrize(
"value",
["bogus", "very-high", "max", "0", "off", "true", "default"],
["bogus", "very-high", "0", "off", "true", "default"],
@Vic563

Vic563 commented May 14, 2026

Copy link
Copy Markdown
Author

Closing — change is being kept as a local customization rather than upstreamed. Branch remains on the fork (Vic563/hermes-agent feat/reasoning-max-alias) for personal use.

@Vic563 Vic563 closed this May 14, 2026
@Vic563

Vic563 commented May 14, 2026

Copy link
Copy Markdown
Author

Reopening — keeping the upstream contribution open as originally intended.

@Vic563 Vic563 reopened this May 14, 2026
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery provider/anthropic Anthropic native Messages API labels May 14, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #12211, which also adds "max" to VALID_REASONING_EFFORTS. #14717 was previously triaged as a duplicate of #12211 for the same change.

This PR is more comprehensive (locale files, tests, docs, provider compat mapping) but addresses the identical gap.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the thorough cross-provider analysis and tests. This is an automated hermes-sweeper review; the requested behavior is now implemented on main.

  • Merged PR feat(reasoning): add max and ultra effort levels #62650 implemented max (and the later ultra level) in commit 7550c594ce18d7d100014c2120112576efb03c26.
  • hermes_constants.py:794-822 now accepts max through the shared parser.
  • agent/anthropic_adapter.py:67-74,2646-2658 maps and emits Anthropic adaptive-thinking output_config.effort, including max.
  • Main includes gateway, Codex, and dashboard coverage for the extended effort levels (tests/gateway/test_reasoning_command.py:152-172, tests/agent/transports/test_codex_transport.py:78-86, web/src/lib/reasoning-effort.ts:17-30).

The member note identifying the earlier duplicate effort is consistent with this now-landed implementation.

@teknium1 teknium1 closed this Jul 13, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have provider/anthropic Anthropic native Messages API sweeper:implemented-on-main Sweeper: behavior already present on current main type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants