From 24c90bdd5d214316b1191df3daaed7078fd7c38d Mon Sep 17 00:00:00 2001 From: dtarkent2-sys Date: Thu, 5 Mar 2026 17:51:20 +0000 Subject: [PATCH] Fix crash when LLM requests unsupported indicator (e.g. vwap) Return error message to LLM instead of crashing the pipeline. Also list supported indicators in the tool docstring. Co-Authored-By: Claude Opus 4.6 --- tradingagents/agents/utils/technical_indicators_tools.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tradingagents/agents/utils/technical_indicators_tools.py b/tradingagents/agents/utils/technical_indicators_tools.py index c6c08bca..7d087f26 100644 --- a/tradingagents/agents/utils/technical_indicators_tools.py +++ b/tradingagents/agents/utils/technical_indicators_tools.py @@ -14,10 +14,13 @@ def get_indicators( Uses the configured technical_indicators vendor. Args: symbol (str): Ticker symbol of the company, e.g. AAPL, TSM - indicator (str): Technical indicator to get the analysis and report of + indicator (str): Technical indicator. Supported: close_50_sma, close_200_sma, close_10_ema, macd, macds, macdh, rsi, boll, boll_ub, boll_lb, atr, vwma, mfi curr_date (str): The current trading date you are trading on, YYYY-mm-dd look_back_days (int): How many days to look back, default is 30 Returns: str: A formatted dataframe containing the technical indicators for the specified ticker symbol and indicator. """ - return route_to_vendor("get_indicators", symbol, indicator, curr_date, look_back_days) \ No newline at end of file + try: + return route_to_vendor("get_indicators", symbol, indicator, curr_date, look_back_days) + except ValueError as e: + return str(e) \ No newline at end of file