emmanuelakbi commited on
Commit
b8795f5
·
1 Parent(s): 24cf535

Fix tools wiring so agents actually call yfinance/ddgs/pandas-ta

Browse files

The first deploy passed tools={} to WatchlistRunner, which meant every
agent got tools=[] and couldn't look up real prices. The LLM reasoned
from its training data and hallucinated a plausible-looking entry
price ($192 vs actual $293 for AAPL). Import the 10 tool functions
from the tools package and dispatch them to the right agent via
crew_tools so get_price_change / get_financials / etc. actually run.

Files changed (1) hide show
  1. app.py +30 -1
app.py CHANGED
@@ -215,7 +215,36 @@ def run_analysis(
215
  pending_events.append(event)
216
 
217
  callback = ActivityFeedCallback(handler=event_handler)
218
- runner = WatchlistRunner(config=config, tools={}, callback=callback)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
 
220
  for i, ticker in enumerate(tickers, 1):
221
  # Enforce the overall pipeline timeout (Requirement 4.4). We
 
215
  pending_events.append(event)
216
 
217
  callback = ActivityFeedCallback(handler=event_handler)
218
+
219
+ # Build the tools dict that maps each agent's name to its tool
220
+ # function list. Without this, every agent runs without tools
221
+ # and the LLM just hallucinates plausible-looking numbers
222
+ # instead of calling yfinance / ddgs / pandas-ta. (This was the
223
+ # cause of the "AAPL entry $192" hallucination from the first
224
+ # deploy — real AAPL was ~$293 at the time.)
225
+ from tools import (
226
+ search_news,
227
+ get_price_change,
228
+ get_volume,
229
+ get_financials,
230
+ get_earnings,
231
+ get_peers,
232
+ get_price_history,
233
+ calculate_indicators,
234
+ calculate_position_size,
235
+ set_stop_loss,
236
+ )
237
+
238
+ crew_tools = {
239
+ "market_scanner": [search_news, get_price_change, get_volume],
240
+ "fundamental_analyst": [get_financials, get_earnings, get_peers],
241
+ "technical_analyst": [get_price_history, calculate_indicators],
242
+ "risk_manager": [calculate_position_size, set_stop_loss],
243
+ }
244
+
245
+ runner = WatchlistRunner(
246
+ config=config, tools=crew_tools, callback=callback
247
+ )
248
 
249
  for i, ticker in enumerate(tickers, 1):
250
  # Enforce the overall pipeline timeout (Requirement 4.4). We