fix(graph): integrate #487 + #567 — sentiment label, route, propagate asset_type

- analyst_execution.py: rename "Social Analyst" / "Msg Clear Social"
  to "Sentiment Analyst" / "Msg Clear Sentiment" to match v0.2.5.
- conditional_logic.should_continue_social returns the renamed route.
- TradingAgentsGraph.propagate accepts asset_type and threads through
  to Propagator.create_initial_state.
- Regression test on the Sentiment Analyst label.

Verified end-to-end (NVDA stock + BTC-USD crypto) on gpt-5.4-mini.
This commit is contained in:
Yijia-Xiao committed 2026-05-17 07:25:59 +00:00
1 parent a2e7ac1599
commit 3e5e99b368
4 files changed
+34 -10

No files matched your search

+9 -6
View File
@@ -292,11 +292,14 @@ class TradingAgentsGraph:
if updates:
self.memory_log.batch_update_with_outcomes(updates)
def propagate(self, company_name, trade_date):
def propagate(self, company_name, trade_date, asset_type: str = "stock"):
"""Run the trading agents graph for a company on a specific date.
When ``checkpoint_enabled`` is set in config, the graph is recompiled
with a per-ticker SqliteSaver so a crashed run can resume from the last
``asset_type`` selects between the stock pipeline (default) and the
crypto pipeline (``"crypto"``) shipped in #567 — the CLI auto-detects
from the ticker; programmatic callers pass it explicitly. When
``checkpoint_enabled`` is set in config, the graph is recompiled with
a per-ticker SqliteSaver so a crashed run can resume from the last
successful node on a subsequent invocation with the same ticker+date.
"""
self.ticker = company_name
@@ -323,19 +326,19 @@ class TradingAgentsGraph:
logger.info("Starting fresh for %s on %s", company_name, trade_date)
try:
return self._run_graph(company_name, trade_date)
return self._run_graph(company_name, trade_date, asset_type=asset_type)
finally:
if self._checkpointer_ctx is not None:
self._checkpointer_ctx.__exit__(None, None, None)
self._checkpointer_ctx = None
self.graph = self.workflow.compile()
def _run_graph(self, company_name, trade_date):
def _run_graph(self, company_name, trade_date, asset_type: str = "stock"):
"""Execute the graph and write the resulting state to disk and memory log."""
# Initialize state — inject memory log context for PM.
past_context = self.memory_log.get_past_context(company_name)
init_agent_state = self.propagator.create_initial_state(
company_name, trade_date, past_context=past_context
company_name, trade_date, asset_type=asset_type, past_context=past_context
)
args = self.propagator.get_graph_args()