AI / Automation

Why 8B Models Loop on Agents: 3 Hermes Tunings for Low VRAM (2026)

Hermes Agent tuning Llama 3.1 8B and Qwen 2.5 7B on Mac for stable function calling

In 2026, running Llama 3.1/3.2 8B, Qwen 2.5 7B, or Hermes 3 8B locally feels like a bargain—until the agent enters a death loop: malformed JSON tool calls, repeated terminal invocations, or “I will now run the tests…” without ever calling a tool. The GPU is fine; the sampling + context + tool surface is not.

Hermes Agent (NousResearch/hermes-agent, MIT) is built for frontier models but runs on OpenRouter, Ollama, and other OpenAI-compatible endpoints. This guide explains why small models break on agents and gives three hard config levers—plus a seven-step runbook—for stable long tasks on 16–24 GB VRAM Macs or Linux boxes.

Note: ProxyMac publishes Mac hosting guides; Hermes is vendor-neutral. Settings reference Hermes configuration docs as of June 2026. User-facing temperature in config.yaml is still limited (#17565)—use Ollama/server sampling plus the knobs below.

Why 8B models choke on function calling

Small instruct models are trained for single-shot chat, not fifty-turn tool transcripts. Agent loops punish three weaknesses:

WeaknessWhat you see in HermesWhy it burns tokens
Structured output driftTool JSON with trailing prose, wrong keys, or “fake” tool calls in plain textParser retries; model re-reads the whole thread
Attention dilutionEarly tool dumps (HTML, logs) push out the original goalModel “forgets” stop conditions and repeats
High-entropy samplingCreative re-phrasing of the same planIdentical curl/grep with tiny flag changes

Quotable definition: On Hermes, a “tool call” is a structured message the runtime parses and executes; when an 8B model emits narrative text instead of that structure, the loop never advances and context fills with duplicate plans.

Frontier models recover with size; 8B models need a narrower tool menu, lower reasoning overhead, and aggressive context hygiene. Pair this article with trajectory compression so middle-turn bloat does not amplify loops. When sizing unified memory, see Apple Mac mini specs.

Architecture: what Hermes actually sends each turn

LayerPath / commandSmall-model impact
Model endpointhermes modelconfig.yaml model:Wrong context_length → premature compression or overflow
Tool surfacehermes tools / agent.disabled_toolsetsFewer tools = fewer JSON schemas in prompt
Skills~/.hermes/skills/, hermes chat -s a,bEach skill adds instructions; cap at 2 for 8B
Enforcementagent.tool_use_enforcementSteers Llama/Qwen to call tools, not describe them
Reasoningagent.reasoning_effort + /reasoningmedium default adds hidden “thinking” tokens on some routes
Context hygienecompression.*, tool_output.*Truncates giant stdout before it refills the window

Hermes applies model-specific temperature contracts internally. For local servers, set sampling on the inference server (Ollama PARAMETER temperature 0.2, llama.cpp --temp 0.2) and keep Hermes-side reasoning and tool knobs as the main levers until #17565 exposes user temperature in YAML.

Three tunings that matter more than raw temperature

Tuning 1 — Kill hidden reasoning tax (reasoning_effort: none)

Default Hermes reasoning is medium, which helps Opus-class models but often bloats small locals:

agent: reasoning_effort: none # or minimal for light planning

display: show_reasoning: false

/reasoning /reasoning none

Symptom fixed: long blank “thinking” stretches before malformed tool JSON appears.

Tuning 2 — Force real tool calls (tool_use_enforcement)

8B Llama/Qwen frequently narrate actions. Hermes can inject enforcement prompts:

agent: tool_use_enforcement: true

provider_routing: require_parameters: true

Default "auto" enables enforcement for GPT/Gemini families only—local 8B stacks are off unless you opt in. See provider routing docs.

Tuning 3 — Skill diet: two skills, minimal toolsets

Skills use progressive disclosure, but the index alone costs ~3k tokens. Optional MCP catalogs add more.

Launch pattern for 8B:

hermes chat --toolsets "terminal,file" \ -s github-pr-workflow,plan \ -m "qwen/qwen-2.5-7b-instruct"

  • ≤2 skills preloaded (-s skill-a,skill-b); load others manually only when needed
  • Disable heavy toolsets globally—see snippet below
  • Do not install every optional-mcps/ entry on an 8B box—each MCP expands schemas and failure modes (MCP Mac guide)

agent: disabled_toolsets: - web - browser - image_gen - moa - memory

Optional: blank skill slate at profile create:

hermes profile create local-8b --no-skills

VRAM presets: what fits on Mac / single-GPU Linux

Not every “8B” setup is the same. Quantization (Q4_K_M vs Q8), gateway overhead, and whether you run browser MCP sidecars change stability more than the model name on the tin.

HardwareModel exampleHermes profileExpected stable turns
16 GB unified (Mac mini M4)Qwen2.5-7B Q4 + 8k ctxterminal,file + 1 skill6–12 tool calls before manual /compress
24 GB (Mac mini M4 Pro)Llama-3.1-8B Q5 + 16k ctxterminal,file,skills + 2 skills12–20 calls with compression.threshold: 0.40
32 GB+ or dGPU 12 GB+Hermes-3-Llama-3.1-8B Q6 + 32k ctxAdd one MCP server maxLonger refactors if enforcement on

If X, do Y: If you see two failed JSON tool calls in a row, drop to one skill and halve tool_output.max_bytes. If loops persist after enforcement + low server temperature, the task likely needs a 14B+ tool model or cloud fallback for planning only.

Three loop patterns (and the fix)

  • Parser loop — invalid JSON → retry → longer thread. Fix: tool_use_enforcement: true, fewer tools, colder server sampling.
  • Plan loop — restates plan without tools. Fix: reasoning_effort: none, explicit max tool count in prompt.
  • Stdout loop — reads giant logs repeatedly. Fix: lower tool_output caps, compress at 40% context, pre-truncate with head in terminal.

Log each pattern in /usage after a failed session—teams that track “tokens per successful tool call” spot regressions when they change quant or context length.

Seven-step runbook: stable 8B agent on Hermes

Step 1 — Install and pick a realistic context window

curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash source ~/.zshrc hermes doctor

Set model.context_length to match your actual local context (e.g. 8192 or 16384), not the theoretical 128k marketing number:

model: context_length: 16384

Prerequisite: Hermes Mac setup.

Step 2 — Point Hermes at your local endpoint

hermes model hermes chat -q "Reply OK only" -m "your-local-model-id"

Step 3 — Apply the three tunings in config.yaml

agent: reasoning_effort: none tool_use_enforcement: true disabled_toolsets: - web - browser - image_gen - memory compression: enabled: true threshold: 0.40 tool_output: max_bytes: 20000 max_lines: 500 file_read_max_chars: 30000

Lower thresholds than defaults—small windows fill fast.

Step 4 — Set server-side sampling (until config exposes temperature)

On Ollama Modelfile or API, prefer low temperature and modest top_p:

PARAMETER temperature 0.2 PARAMETER top_p 0.9

Hermes may still apply per-model overrides; server-side low entropy reduces JSON hallucinations.

Step 5 — Run a bounded tool task with two skills

hermes chat --toolsets "terminal,file" \ -s plan \ -m "your-local-model-id"

Task: list top 5 largest files in ./src, write paths to /tmp/top5.txt. Rules: max 8 tool calls; if stuck, stop and report blocker.

Watch the status bar context %; manually /compress if orange before auto fires.

Step 6 — Detect loops early with /usage and /stop

/usage /stop

If tool calls repeat with identical arguments three times, abort and narrow the prompt—8B models rarely self-correct without human steering.

Step 7 — Optional: gateway on an always-on Mac mini

For 24/7 automations, move gateway to hardware that does not sleep; keep 8B inference on GPU, Hermes gateway on CPU. See cron digest guide only after loops are stable—scheduled jobs amplify runaway spend.

Troubleshooting

JSON parse errors on every tool call

Symptom: Failed to parse tool call or tool name appears inside prose.

Fix: Enable tool_use_enforcement: true; reduce toolsets to terminal,file; lower server temperature; switch to a tool-tuned quant (e.g. Qwen2.5-Instruct vs base). Avoid parallel tool calls in the prompt.

Infinite “I will…” without tools

Symptom: Model describes steps; no terminal icon in TUI.

Fix: Same as above plus explicit system rule in SOUL.md: “Always invoke tools; never promise future actions.” Reduce skills to one. Check you are not on reasoning_effort: high.

Context full at turn 4 on 16K models

Symptom: Red context bar; garbled answers.

Fix: Set compression.threshold: 0.35, cut tool_output.max_bytes, disable web/browser, enable trajectory compression habits (/compress before big pastes).

FAQ

Is Hermes 3 8B officially supported?+
Hermes routes any OpenAI-compatible model ID. Support quality depends on the quant, context length, and tool-tuning—not the Hermes brand name alone. Test with the seven-step runbook before production cron jobs.
Can I set temperature in config.yaml today?+
As of June 2026, user-facing temperature in config.yaml is limited; use local server sampling plus reasoning_effort: none and tool_use_enforcement. Track issue #17565 for native exposure.
How does this relate to Trajectory Compressor?+
Compressor trims completed trajectories for training/export. Runtime compression.* and /compress stop loops from growing the live window—use both on 8B hosts.
Llama 3 vs Qwen 2.5 for agents?+
Qwen2.5-Instruct often handles JSON tools slightly better at 7B–8B; Llama 3.1 8B benefits most from enforcement + tiny toolsets. Benchmark on your task, not leaderboard chat scores.
Will two skills really fit with MCP GitHub enabled?+
MCP adds tools and tokens. For 8B, pick either a focused MCP server or two skills—not the full catalog. Expand only after stable 10-turn runs.

Need an always-on Mac for local agents?

Optional Mac mini keeps Hermes gateway online while 8B inference runs on your GPU.