mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-06-16 21:06:15 +03:00
fix(graph): register get_verified_market_snapshot in the market ToolNode
The market analyst is bound to call get_verified_market_snapshot and its prompt requires it as the source of truth, but the tool was missing from the market ToolNode executor — so the call failed and the model reported it "unavailable" and skipped verification. Register it (with a regression guard) so the snapshot actually runs and grounds the report.
This commit is contained in:
23
tests/test_market_toolnode.py
Normal file
23
tests/test_market_toolnode.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
"""The market analyst is bound (and prompt-instructed) to call
|
||||||
|
get_verified_market_snapshot; if the executor ToolNode doesn't register it, the
|
||||||
|
call fails and the model reports the tool "unavailable" and skips verification.
|
||||||
|
|
||||||
|
Regression guard for that wiring gap (snapshot bound to the LLM but missing from
|
||||||
|
the market ToolNode).
|
||||||
|
"""
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from tradingagents.graph.trading_graph import TradingAgentsGraph
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.unit
|
||||||
|
def test_market_toolnode_can_execute_verified_snapshot():
|
||||||
|
# _create_tool_nodes does not use self -> call unbound (avoids building LLMs).
|
||||||
|
nodes = TradingAgentsGraph._create_tool_nodes(None)
|
||||||
|
market_tools = set(nodes["market"].tools_by_name)
|
||||||
|
assert "get_verified_market_snapshot" in market_tools, (
|
||||||
|
"get_verified_market_snapshot is bound to the market analyst but not "
|
||||||
|
"registered in the market ToolNode, so the model's call fails."
|
||||||
|
)
|
||||||
|
# the other core market tools must remain too
|
||||||
|
assert {"get_stock_data", "get_indicators"} <= market_tools
|
||||||
@@ -32,6 +32,7 @@ from tradingagents.agents.utils.agent_utils import (
|
|||||||
resolve_instrument_identity,
|
resolve_instrument_identity,
|
||||||
get_stock_data,
|
get_stock_data,
|
||||||
get_indicators,
|
get_indicators,
|
||||||
|
get_verified_market_snapshot,
|
||||||
get_fundamentals,
|
get_fundamentals,
|
||||||
get_balance_sheet,
|
get_balance_sheet,
|
||||||
get_cashflow,
|
get_cashflow,
|
||||||
@@ -173,6 +174,10 @@ class TradingAgentsGraph:
|
|||||||
get_stock_data,
|
get_stock_data,
|
||||||
# Technical indicators
|
# Technical indicators
|
||||||
get_indicators,
|
get_indicators,
|
||||||
|
# Deterministic verification snapshot (bound to the analyst
|
||||||
|
# LLM and required by its prompt; must be executable here or
|
||||||
|
# the call fails and the model reports it "unavailable").
|
||||||
|
get_verified_market_snapshot,
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
"social": ToolNode(
|
"social": ToolNode(
|
||||||
|
|||||||
Reference in New Issue
Block a user