Files
hermes-agent/tests
Alexander Whitestone e2c96e35e1
Some checks failed
Contributor Attribution Check / check-attribution (pull_request) Failing after 46s
Docker Build and Publish / build-and-push (pull_request) Has been skipped
Supply Chain Audit / Scan PR for supply chain risks (pull_request) Successful in 57s
Tests / e2e (pull_request) Successful in 3m4s
Tests / test (pull_request) Failing after 1h0m20s
feat: local model fallback chain for tool calls (#746)
When cloud provider fails during tool calling (timeout, 429, 503),
fall back to local Ollama to keep the agent working.

New agent/tool_fallback.py:
- ToolFallbackHandler: manages fallback execution
- should_fallback(error): detects provider failures (429, 503,
  timeout, rate limit, quota exceeded, connection errors)
- call_with_fallback(): makes API call via local Ollama when
  primary provider fails
- FallbackEvent: records each fallback for fleet reporting
- format_report(): human-readable fallback summary
- Singleton handler via get_tool_fallback_handler()

Config via env vars:
- TOOL_FALLBACK_PROVIDER (default: ollama)
- TOOL_FALLBACK_MODEL (default: qwen2.5:7b)
- TOOL_FALLBACK_BASE_URL (default: http://localhost:11434/v1)

Tests: tests/test_tool_fallback.py

Closes #746
2026-04-14 23:29:44 -04:00
..