feat(agents): automatic Ollama Cloud → xAI fallback #121

Merged
hermes merged 2 commits from fix/agents-xai-fallback-ollama-exhausted into main 2026-07-30 15:28:45 +02:00
Collaborator

Why

Ollama Cloud hits 100% usage and agents die. Better than hard-switching: try primary, fall back automatically.

How

agents.json keeps Ollama Cloud as primary and adds:

"fallback": "xai-oc/grok-4.5"

run-agent.sh on quota/credit/429/capacity-class errors:

  1. log failover
  2. set MODEL=fallback once
  3. continue remaining retry attempts on xAI

install-opencode.sh registers both primary and fallback models in provider maps so opencode can resolve either.

Matrix

Agent Primary Fallback
pm ollama-cloud/minimax-m3 xai-oc/grok-4.5
junior ollama-cloud/kimi-k2.7-code xai-oc/grok-4.3
senior ollama-cloud/glm-5.2 xai-oc/grok-4.5
qa ollama-cloud/minimax-m3 xai-oc/grok-4.5
intern ollama/ornith:35b xai-oc/grok-4.3
lead/ops xai-oc/grok-4.5 (none)

Needs existing XAI_API_KEY Actions secret.

After merge

Re-@pm stuck issues (e.g. homelab #221).

## Why Ollama Cloud hits 100% usage and agents die. Better than hard-switching: **try primary, fall back automatically**. ## How `agents.json` keeps Ollama Cloud as primary and adds: ```json "fallback": "xai-oc/grok-4.5" ``` `run-agent.sh` on quota/credit/429/capacity-class errors: 1. log failover 2. set MODEL=fallback once 3. continue remaining retry attempts on xAI `install-opencode.sh` registers both primary and fallback models in provider maps so opencode can resolve either. ## Matrix | Agent | Primary | Fallback | |-------|---------|----------| | pm | ollama-cloud/minimax-m3 | xai-oc/grok-4.5 | | junior | ollama-cloud/kimi-k2.7-code | xai-oc/grok-4.3 | | senior | ollama-cloud/glm-5.2 | xai-oc/grok-4.5 | | qa | ollama-cloud/minimax-m3 | xai-oc/grok-4.5 | | intern | ollama/ornith:35b | xai-oc/grok-4.3 | | lead/ops | xai-oc/grok-4.5 | (none) | Needs existing `XAI_API_KEY` Actions secret. ## After merge Re-@pm stuck issues (e.g. homelab #221).
hermes added 1 commit 2026-07-30 15:25:47 +02:00
Ollama Cloud usage is at 100% so ollama-cloud/* agents fail. Move
pm, junior, senior, qa to xai-oc (grok-4.5 / grok-4.3). leave intern on
local ollama/ornith:35b; lead/ops already on xAI.
hermes changed title from Route agents to xAI while Ollama Cloud quota is exhausted to feat(agents): automatic Ollama Cloud → xAI fallback 2026-07-30 15:28:31 +02:00
hermes added 1 commit 2026-07-30 15:28:31 +02:00
Keep ollama-cloud/* as primary. Each agent may declare fallback in
agents.json (xai-oc/grok-*). On quota/auth/provider failure, run-agent
switches once to the fallback and continues retries.

- agents.json: fallback fields for pm/junior/senior/qa/intern
- route.sh: emit fallback to GITHUB_OUTPUT
- agent.yml: pass FALLBACK env into run-agent
- install-opencode.sh: register primary+fallback models in provider maps
- run-agent.sh: failover on quota/credit/429/capacity-class errors
hermes merged commit 58db2996ad into main 2026-07-30 15:28:45 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gitea/agents#121