agent-ops-patterns / gallery / Hermes Agent map / how it decides
How Hermes Agent decides
In Hermes Agent, on a normal step the configured main model proposes tool calls or a text answer; code checks an answer before accepting it and can send the model back, for example up to twice for a short reply that only announces a next step. Code applies the limits, among them a step allowance per turn, automatic compression as the prompt nears the window, and an optional time budget that can warn near the end but does not itself stop the run.
What it does without asking you
-
May this sender's message dispatch agent work?
Decided by plain code Code walks a fixed order of grants on every incoming gateway message. On a fresh install with no allowlist, an unknown sender on an ordinary messaging platform is normally refused unless an operator approved their pairing code; local sessions, webhooks and adapters with their own access policy follow separate rules.
authz_mixin.py:707-790· decision A1 in the full map
How it decides it is done
-
The reply ends by announcing a next action but makes no tool call: is the model stalled?
Decided by plain code On by default when tools are offered. A reply of at most 400 characters with no tool call that ends on an announced next step ("I'll now", "next, I") is treated as a stall and the model is nudged to act, at most twice per turn, a limit shared with two similar checks.
agent_runtime_helpers.py:3342-3357· decision G16 in the full map
Limits and memory
-
Has this turn used up its step allowance?
Decided by plain code Code normally takes one step from the turn's allowance as each loop iteration starts. The cap is agent.max_turns: 500 in the config.yaml the installers seed, 150 after the recommended hermes setup, 90 after Blank Slate setup, and no cap with no finite value; a delegated child defaults to 250. At the cap the turn ends, apart from one granted grace call.
turn_iteration_prep.py:408-416· decision F1 in the full map -
Should the model be told to wrap up because the wall-clock budget is 80% gone?
Decided by plain code Off by default. With a run budget set, after 80% of the time has passed code adds a one-time wrap-up notice to a tool result when it can. The setting does not itself stop the run when the time is up.
conversation_loop.py:126-158· decision F8 in the full map -
Should automatic compression run now?
Decided by plain code On by default. Code compresses once the prompt passes a threshold worked out from the usable input window (by default starting from 50%, raised to at least 75% for windows under 512K tokens); floors, caps, deferral and failure safeguards can move or block it.
context_compressor.py:3007-3016· decision F13 in the full map -
Who writes the summary that replaces the middle of the conversation?
Decided by an AI model A language model, in one auxiliary compression request that sets no max_tokens. Empty, refused or cut-off replies count as failures.
context_compressor.py:3798-3815· decision F20 in the full map
Other judgments
-
What should the agent do next: call which tools with which arguments, or answer?
Decided by an AI model On a normal model call, the main model proposes tool calls or a text answer. Before a call can run, code repairs or rejects a tool name it does not know and checks that the arguments are valid JSON; other guards can still stop a call.
turn_api_call.py:139-145· decision C1 in the full map -
Retries and fallbacks are spent on a passing outage: wait, or end the turn?
Decided by plain code On by default. For an overload, server error or timeout, and only if no answer text has reached the user, code waits with a visible countdown, about 15, 30, then 60 seconds (or the provider's own Retry-After, up to 120 seconds), and stops after five cycles.
turn_recovery_autorecover.py:59-116· decision E8 in the full map
Three problems in the code
-
1. A run budget can warn near the end but does not enforce a deadline
With --run-budget or agent.run_budget_seconds set, once 80% of the time has passed Hermes adds a one-time wrap-up notice to a tool result when it can, and it can shorten a default wait on a silent model call. The setting does not itself stop the run when the time is up, although the option's help text says it is intended for runs with a hard ceiling. An open pull request proposes stopping the model at the deadline.
Reported; a fix is proposed, not merged (#127780), checked 2026-11-15.
Where:
conversation_loop.py:126-158,chat_completion_helpers.py:678-687,_parser.py:300-306. How we checked: the code was re-read at the source version named above; the sentences were checked by an independent AI reviewer from another company (OpenAI Codex, read-only) on 2026-11-08, in three rounds; every sentence it found too wide was narrowed or removed. -
2. Subagent calls over the limit in one reply are dropped without telling the model
When a model reply has passed Hermes' tool-call checks and asks for more delegate_task calls than delegation.max_concurrent_children (10 by default), Hermes drops the calls over the limit before the reply goes into the conversation. The cap itself only logs a warning, and the model gets no result for the dropped calls. An open report in Hermes' tracker describes this.
Already tracked upstream (#30405), checked 2026-11-15.
Where:
run_agent.py:1182-1200,turn_tool_round.py:96-113. How we checked: the code was re-read at the source version named above; the sentences were checked by an independent AI reviewer from another company (OpenAI Codex, read-only) on 2026-11-08, in three rounds; every sentence it found too wide was narrowed or removed. -
3. A /loop ends when its finishing line appears anywhere in a reply
A /loop ends as done when a reply has a line that is only LOOP_COMPLETE. The check matches such a line anywhere in the reply, not only at the end as the function's own description says, so a reply with that line in the middle also ends the loop.
No tracker issue found, checked 2026-11-08.
Where:
loops.py:33-37,loops.py:370-372,loops.py:562-565. How we checked: the code was re-read at the source version named above; the sentences were checked by an independent AI reviewer from another company (OpenAI Codex, read-only) on 2026-11-08, in three rounds; every sentence it found too wide was narrowed or removed.