Skip to content

feat: add runtime reasoning_effort tool for on-the-fly agent reasoning control #7273

Description

@ian-pascoe

Summary

Add a first-class reasoning_effort tool so Hermes agents can adjust their own reasoning effort on the fly during a session instead of relying on user-only slash commands like /reasoning.

Problem

Hermes already supports reasoning effort through config and chat commands:

  • agent.reasoning_effort in config
  • /reasoning ... in CLI and gateway chats

But agents cannot reliably use those as structured state transitions.

Today, if an agent realizes a task just became much harder or much simpler, it cannot cleanly say:

  • lower reasoning for rote follow-through
  • raise reasoning for debugging / cross-file synthesis / hard planning
  • persist the new default only when the user explicitly wants that

Trying to fake /reasoning low in chat is brittle and not a real tool interaction.

Proposed change

Add a tool with this shape:

{
  "name": "reasoning_effort",
  "parameters": {
    "level": "none|minimal|low|medium|high|xhigh",
    "persist": false
  }
}

Behavior

  • updates the active AIAgent.reasoning_config for subsequent model calls
  • optionally persists through the platform layer when persist=true
  • returns structured JSON describing the new state

Important implementation detail

This should not be treated as a plain registry-only tool.

Like clarify and delegate_task, it needs access to live AIAgent state and optional platform callbacks. In practice that means:

  • normal registry-backed schema in tools/reasoning_effort_tool.py
  • discovery import in model_tools.py
  • exposure via toolsets.py
  • agent-loop interception in run_agent.py so it can mutate self.reasoning_config
  • optional persistence callback injected from CLI / gateway instead of importing platform config logic directly into run_agent.py

Why this is useful

This lets agents adapt reasoning cost and depth to the actual work:

  • low / minimal for simple lookups, formatting, rote edits, narrow reads
  • medium for default non-trivial work
  • high / xhigh for ambiguous debugging, hard planning, cross-file reasoning, tradeoff analysis

That makes Hermes more efficient and more agentic.

Docs / prompting follow-up

If added, Hermes should also include tool-aware prompt guidance telling agents when to use the tool effectively and when not to thrash it.

Testing

Suggested coverage:

  • tool registration + discovery
  • agent-loop interception
  • updates to AIAgent.reasoning_config
  • none disables reasoning
  • invalid level returns JSON error
  • persistence callback path
  • CLI/gateway regressions

Extra note

The current docs imply adding a tool is a 3-file change, but stateful tools like this end up needing a 4th integration point in run_agent.py. It may be worth clarifying that in the developer docs too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/agentCore agent runtime: loop, agent_init, prompt builder, context-compression, responses endpointcomp/toolsTool registry, model_tools, toolsetstype/featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions