TradingAgents/agent_os/backend
ahmet guzererler 2145b04318
fix: graceful LLM 404 handling + per-tier fallback model config (#108)
* fix: per-tier fallback LLM for provider 404/policy errors

- tool_runner: catch status_code==404 from chain.invoke(), re-raise as
  RuntimeError with actionable message (OpenRouter privacy URL + env var hint)
- langgraph_engine: wrap astream_events in try/except, detect policy errors
  and re-raise with model/provider context
- langgraph_engine: _run_one_ticker distinguishes policy 404s (logger.error,
  no traceback) from real bugs (logger.exception with traceback); if fallback
  is configured, rebuilds pipeline with fallback model tier and retries
- langgraph_engine: add _is_policy_error() and _build_fallback_config() helpers
- default_config: add quick/mid/deep_think_fallback_llm + _provider keys
  (TRADINGAGENTS_QUICK_THINK_FALLBACK_LLM etc.)
- .env.example: document new fallback env vars

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: ADR 017 LLM policy fallback, correct ADR 016 findings, update CLAUDE.md

- docs/agent/decisions/017: add ADR for per-tier LLM fallback design decision
- docs/agent/decisions/016: correct 3 inaccurate review findings — list_pm_decisions
  ObjectId projection, created_at datetime type, and base_dir pointer handling are
  all already correctly implemented in PR#106
- CLAUDE.md: add Per-Tier Fallback LLM section and _is_policy_error critical pattern
- CURRENT_STATE.md: update milestone and recent progress for PR#106/107/108 merges

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 11:19:08 +01:00
..
routes fix: address all PR#106 review findings (ADR 016) (#106) 2026-03-25 11:14:23 +01:00
services fix: graceful LLM 404 handling + per-tier fallback model config (#108) 2026-03-25 11:19:08 +01:00
.env.example feat: initialize AgentOS observability foundation 2026-03-22 21:54:13 +01:00
__init__.py fix: add missing __init__.py files to agent_os package tree 2026-03-23 07:16:38 +00:00
dependencies.py feat: initialize AgentOS observability foundation 2026-03-22 21:54:13 +01:00
main.py fix: migrate backend to port 8088 and use 127.0.0.1 to avoid macOS system conflicts 2026-03-22 22:51:09 +01:00
store.py feat: implement AgentOS frontend and live backend integration 2026-03-22 22:12:33 +01:00