com um clique
api-retry-tuning
Tune agent.api_max_retries for fast fallback or resilience.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Menu
Tune agent.api_max_retries for fast fallback or resilience.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Baseado na classificação ocupacional SOC
Guides Cloudflare One Zero Trust and SASE work across Access, Gateway, WARP, Tunnel, Cloudflare WAN, DLP, CASB, device posture, and identity. Use when designing, configuring, troubleshooting, or reviewing Cloudflare One deployments. Retrieval-first: use current Cloudflare docs/API schemas instead of embedded product docs.
Use when scheduling recurring polls, read-only monitors, or background jobs that must survive shell session boundaries.
Discover, register, and maintain Hermes skills from non-default paths (plugin directories, external repos, shared vaults). Use when skills are missing from `skills_list()`, when the user mentions plugin skills, when symlinking skills, or when reconciling duplicate/overlapping skills between the default tree and external sources.
Operate the Antigravity CLI (agy): plugins, auth, sandbox.
Tune HERMES_STREAM_RETRIES for mid-stream reconnect resilience.
Manage parallel Hermes sessions in Telegram topics.
| name | api-retry-tuning |
| description | Tune agent.api_max_retries for fast fallback or resilience. |
| version | 0.2.0 |
| author | Hermes |
| metadata | {"hermes":{"tags":["Hermes","Configuration","Reliability","Fallback","Retry"]}} |
Control how many times Hermes retries a failed LLM API call before surfacing the error or falling back to the next provider. The agent.api_max_retries config key (default 3) wraps each model API call in the conversation loop. Lowering it makes fallback chains activate faster on flaky primaries; raising it tolerates longer provider hiccups on a single-provider setup.
This is a config-level tuning knob — no code changes, no env vars, just config.yaml.
hermes --version).~/.hermes/config.yaml (or profile-specific ~/.hermes/profiles/<name>/config.yaml).Invoke through the terminal tool:
hermes config set agent.api_max_retries <value>
Then start a new session (/reset in chat, or relaunch the CLI/gateway).
| Key | Section | Default | Clamp | Config path |
|---|---|---|---|---|
api_max_retries | agent | 3 | min 1 | config.yaml |
hermes config set agent.api_max_retries 1 # no retry, single attempt
hermes config set agent.api_max_retries 2 # one retry (Aegis default-profile uses this)
hermes config set agent.api_max_retries 3 # default
hermes config set agent.api_max_retries 5 # high tolerance
Check current value — invoke through the terminal tool:
hermes config | grep api_max_retries
Or use read_file on your config.yaml and look for the agent: → api_max_retries: key.
Set the desired value:
hermes config set agent.api_max_retries <N>
Restart the session — the value is read at agent init time (agent_init.py), not hot-reloadable:
hermes./restart or hermes gateway restart.Verify — in a new session, the agent's _api_max_retries attribute reflects the new value.
api_max_retries controls retry within a single provider. The fallback_providers list in config.yaml controls what happens when all retries are exhausted. Good chain design matters as much as the retry count.
The most important principle: providers sharing infrastructure share a failure domain. A local Ollama instance serving both the primary (via proxy) and a fallback model is ONE failure domain — when Ollama locks (VRAM contention, daemon crash), both rungs die simultaneously.
Rules:
qwen2.5:7b) behind the same Ollama port as a large local model is NOT a real fallback — the failure mode is "API unreachable," not "model too big."| Option | Pros | Cons |
|---|---|---|
| OpenRouter | Widest model selection, pennies per call, OpenAI-compatible API | Needs credits + API key |
| Groq | Fastest TTFT, free tier, OpenAI-compatible | Limited model selection |
| Mistral free tier | Already have key in many setups, different model avoids rate-limit sharing | Smaller model selection |
| HuggingFace Endpoints | Flexible | Cold-start delay (10s–min), or always-on hourly bill — wrong for rarely-used last resort |
| Small local model (separate runtime) | Works offline | Operational overhead, another daemon to maintain |
See references/fallback-chain-design.md for the full Fable 5 analysis and Aegis-specific chain configuration.
AIAgent.__init__ time. Changing config mid-session has no effect — always restart.0 or negative values clamps to 1 (single attempt, no retry). The while retry_count < max_retries loop guard requires at least 1."not-a-number") silently fall back to the default of 3, not an error.max_retries=2) for transient network errors. api_max_retries is the Hermes-level loop that wraps the entire call including SDK retries. Total attempts on a flaky call ≈ api_max_retries × (SDK max_retries + 1).api_max_retries attempts on a refusal that will never succeed.qwen2.5:7b as a fallback behind the same 127.0.0.1:11434 as gemma4:31b provides zero protection — when Ollama is unreachable, both models are unreachable. Use a separate runtime (llama-server on a different port) or a cloud provider instead.hermes config | grep api_max_retries
Should show your configured value. For runtime confirmation, start a new session and check the agent attribute is set — the value is logged at debug level during agent initialization.