diff --git a/tests/unit/test_config_wiring.py b/tests/unit/test_config_wiring.py index 15e9bc4d..2258b317 100644 --- a/tests/unit/test_config_wiring.py +++ b/tests/unit/test_config_wiring.py @@ -24,26 +24,26 @@ class TestAgentStateFields: class TestNewToolsExported: def test_get_ttm_analysis_exported(self): - from tradingagents.agents.utils.agent_utils import get_ttm_analysis + from tradingagents.agents.utils.fundamental_data_tools import get_ttm_analysis # @tool returns a LangChain StructuredTool — callable() is False on it. # hasattr(..., "invoke") is the correct check for LangChain tools. assert hasattr(get_ttm_analysis, "invoke") def test_get_peer_comparison_exported(self): - from tradingagents.agents.utils.agent_utils import get_peer_comparison + from tradingagents.agents.utils.fundamental_data_tools import get_peer_comparison assert hasattr(get_peer_comparison, "invoke") def test_get_sector_relative_exported(self): - from tradingagents.agents.utils.agent_utils import get_sector_relative + from tradingagents.agents.utils.fundamental_data_tools import get_sector_relative assert hasattr(get_sector_relative, "invoke") def test_get_macro_regime_exported(self): - from tradingagents.agents.utils.agent_utils import get_macro_regime + from tradingagents.agents.utils.fundamental_data_tools import get_macro_regime assert hasattr(get_macro_regime, "invoke") def test_tools_are_langchain_tools(self): """All new tools should be LangChain @tool decorated (have .name attribute).""" - from tradingagents.agents.utils.agent_utils import ( + from tradingagents.agents.utils.fundamental_data_tools import ( get_ttm_analysis, get_peer_comparison, get_sector_relative, get_macro_regime ) for tool in [get_ttm_analysis, get_peer_comparison, get_sector_relative, get_macro_regime]: diff --git a/tradingagents/agents/analysts/fundamentals_analyst.py b/tradingagents/agents/analysts/fundamentals_analyst.py index 108b6d3e..8749b4cd 100644 --- a/tradingagents/agents/analysts/fundamentals_analyst.py +++ b/tradingagents/agents/analysts/fundamentals_analyst.py @@ -1,16 +1,16 @@ from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder import time import json -from tradingagents.agents.utils.agent_utils import ( +from tradingagents.agents.utils.fundamental_data_tools import ( get_fundamentals, get_balance_sheet, get_cashflow, get_income_statement, - get_insider_transactions, get_ttm_analysis, get_peer_comparison, get_sector_relative, ) +from tradingagents.agents.utils.news_data_tools import get_insider_transactions from tradingagents.dataflows.config import get_config diff --git a/tradingagents/agents/analysts/market_analyst.py b/tradingagents/agents/analysts/market_analyst.py index 6d4afe3e..65abd9ea 100644 --- a/tradingagents/agents/analysts/market_analyst.py +++ b/tradingagents/agents/analysts/market_analyst.py @@ -1,7 +1,9 @@ from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder import time import json -from tradingagents.agents.utils.agent_utils import get_stock_data, get_indicators, get_macro_regime +from tradingagents.agents.utils.core_stock_tools import get_stock_data +from tradingagents.agents.utils.technical_indicators_tools import get_indicators +from tradingagents.agents.utils.fundamental_data_tools import get_macro_regime from tradingagents.dataflows.config import get_config diff --git a/tradingagents/agents/analysts/news_analyst.py b/tradingagents/agents/analysts/news_analyst.py index 03b4fae4..27c7c3d1 100644 --- a/tradingagents/agents/analysts/news_analyst.py +++ b/tradingagents/agents/analysts/news_analyst.py @@ -1,7 +1,7 @@ from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder import time import json -from tradingagents.agents.utils.agent_utils import get_news, get_global_news +from tradingagents.agents.utils.news_data_tools import get_news, get_global_news from tradingagents.dataflows.config import get_config diff --git a/tradingagents/agents/analysts/social_media_analyst.py b/tradingagents/agents/analysts/social_media_analyst.py index b25712d7..82089443 100644 --- a/tradingagents/agents/analysts/social_media_analyst.py +++ b/tradingagents/agents/analysts/social_media_analyst.py @@ -1,7 +1,7 @@ from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder import time import json -from tradingagents.agents.utils.agent_utils import get_news +from tradingagents.agents.utils.news_data_tools import get_news from tradingagents.dataflows.config import get_config diff --git a/tradingagents/agents/scanners/geopolitical_scanner.py b/tradingagents/agents/scanners/geopolitical_scanner.py index afa5d3ce..98075b19 100644 --- a/tradingagents/agents/scanners/geopolitical_scanner.py +++ b/tradingagents/agents/scanners/geopolitical_scanner.py @@ -1,5 +1,5 @@ from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder -from tradingagents.agents.utils.agent_utils import get_topic_news +from tradingagents.agents.utils.scanner_tools import get_topic_news from tradingagents.agents.utils.tool_runner import run_tool_loop diff --git a/tradingagents/agents/scanners/industry_deep_dive.py b/tradingagents/agents/scanners/industry_deep_dive.py index 3b15cf4f..06bc0ac7 100644 --- a/tradingagents/agents/scanners/industry_deep_dive.py +++ b/tradingagents/agents/scanners/industry_deep_dive.py @@ -1,7 +1,7 @@ from __future__ import annotations from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder -from tradingagents.agents.utils.agent_utils import get_industry_performance, get_topic_news +from tradingagents.agents.utils.scanner_tools import get_industry_performance, get_topic_news from tradingagents.agents.utils.tool_runner import run_tool_loop # All valid sector keys accepted by yfinance Sector() and get_industry_performance. diff --git a/tradingagents/agents/scanners/market_movers_scanner.py b/tradingagents/agents/scanners/market_movers_scanner.py index 219a5adf..1fb85244 100644 --- a/tradingagents/agents/scanners/market_movers_scanner.py +++ b/tradingagents/agents/scanners/market_movers_scanner.py @@ -1,5 +1,5 @@ from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder -from tradingagents.agents.utils.agent_utils import get_market_movers, get_market_indices +from tradingagents.agents.utils.scanner_tools import get_market_movers, get_market_indices from tradingagents.agents.utils.tool_runner import run_tool_loop diff --git a/tradingagents/agents/scanners/sector_scanner.py b/tradingagents/agents/scanners/sector_scanner.py index f66782af..4e1e41b7 100644 --- a/tradingagents/agents/scanners/sector_scanner.py +++ b/tradingagents/agents/scanners/sector_scanner.py @@ -1,5 +1,5 @@ from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder -from tradingagents.agents.utils.agent_utils import get_sector_performance +from tradingagents.agents.utils.scanner_tools import get_sector_performance from tradingagents.agents.utils.tool_runner import run_tool_loop diff --git a/tradingagents/agents/utils/agent_utils.py b/tradingagents/agents/utils/agent_utils.py index 32ad548d..892c2365 100644 --- a/tradingagents/agents/utils/agent_utils.py +++ b/tradingagents/agents/utils/agent_utils.py @@ -1,35 +1,5 @@ from langchain_core.messages import HumanMessage, RemoveMessage -# Import tools from separate utility files -from tradingagents.agents.utils.core_stock_tools import ( - get_stock_data -) -from tradingagents.agents.utils.technical_indicators_tools import ( - get_indicators -) -from tradingagents.agents.utils.fundamental_data_tools import ( - get_fundamentals, - get_balance_sheet, - get_cashflow, - get_income_statement, - get_ttm_analysis, - get_peer_comparison, - get_sector_relative, - get_macro_regime, -) -from tradingagents.agents.utils.news_data_tools import ( - get_news, - get_insider_transactions, - get_global_news -) -from tradingagents.agents.utils.scanner_tools import ( - get_market_movers, - get_market_indices, - get_sector_performance, - get_industry_performance, - get_topic_news -) - def create_msg_delete(): def delete_messages(state): diff --git a/tradingagents/graph/trading_graph.py b/tradingagents/graph/trading_graph.py index 7119e6ad..474315c3 100644 --- a/tradingagents/graph/trading_graph.py +++ b/tradingagents/graph/trading_graph.py @@ -20,22 +20,24 @@ from tradingagents.agents.utils.agent_states import ( ) from tradingagents.dataflows.config import set_config -# Import the new abstract tool methods from agent_utils -from tradingagents.agents.utils.agent_utils import ( - get_stock_data, - get_indicators, +# Import the new abstract tool methods +from tradingagents.agents.utils.core_stock_tools import get_stock_data +from tradingagents.agents.utils.technical_indicators_tools import get_indicators +from tradingagents.agents.utils.fundamental_data_tools import ( get_fundamentals, get_balance_sheet, get_cashflow, get_income_statement, - get_news, - get_insider_transactions, - get_global_news, get_ttm_analysis, get_peer_comparison, get_sector_relative, get_macro_regime, ) +from tradingagents.agents.utils.news_data_tools import ( + get_news, + get_insider_transactions, + get_global_news, +) from .conditional_logic import ConditionalLogic from .setup import GraphSetup