TradingAgents/docs/agent/decisions
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
..
.gitkeep feat: add agentic memory scaffold and migrate tracking files to docs/agent/ 2026-03-17 17:14:11 +01:00
001-hybrid-llm-setup.md feat: add agentic memory scaffold and migrate tracking files to docs/agent/ 2026-03-17 17:14:11 +01:00
002-data-vendor-fallback.md feat: opt-in vendor fallback — fail-fast by default (#18) 2026-03-18 14:25:38 +01:00
003-yfinance-etf-proxies.md feat: add agentic memory scaffold and migrate tracking files to docs/agent/ 2026-03-17 17:14:11 +01:00
004-inline-tool-execution.md feat: add agentic memory scaffold and migrate tracking files to docs/agent/ 2026-03-17 17:14:11 +01:00
005-langgraph-parallel-reducers.md feat: add agentic memory scaffold and migrate tracking files to docs/agent/ 2026-03-17 17:14:11 +01:00
006-env-var-config-overrides.md feat: add agentic memory scaffold and migrate tracking files to docs/agent/ 2026-03-17 17:14:11 +01:00
007-thread-safe-rate-limiter.md feat: add agentic memory scaffold and migrate tracking files to docs/agent/ 2026-03-17 17:14:11 +01:00
008-lessons-learned.md feat: opt-in vendor fallback — fail-fast by default (#18) 2026-03-18 14:25:38 +01:00
009-industry-deep-dive-quality.md docs: update memory files after PR #13 (Industry Deep Dive quality fix) 2026-03-17 20:20:39 +01:00
010-finnhub-vendor-integration.md feat: opt-in vendor fallback — fail-fast by default (#18) 2026-03-18 14:25:38 +01:00
011-opt-in-vendor-fallback.md feat: opt-in vendor fallback — fail-fast by default (#18) 2026-03-18 14:25:38 +01:00
012-portfolio-no-orm.md docs: ADR-012 — raw supabase-py over Prisma/SQLAlchemy for portfolio data layer 2026-03-20 10:48:40 +00:00
013-agentos-websocket-streaming.md docs: update docs/agent/ with AgentOS architecture, components, conventions, and ADR 013 2026-03-23 10:48:49 +00:00
014-finviz-smart-money-scanner.md feat(scanner): Finviz smart money scanner + Golden Overlap strategy 2026-03-24 16:03:17 +01:00
015-mongodb-report-store-reflexion.md fix: address all PR#106 review findings (ADR 016) (#106) 2026-03-25 11:14:23 +01:00
016-pr106-review-findings.md fix: graceful LLM 404 handling + per-tier fallback model config (#108) 2026-03-25 11:19:08 +01:00
017-llm-policy-fallback.md fix: graceful LLM 404 handling + per-tier fallback model config (#108) 2026-03-25 11:19:08 +01:00