Files
tradingagents/tests/test_analyst_execution.py
T
Yijia-Xiao 9968bd8dd1 feat(graph): run the analysts at the same time (#1255)
- each analyst is a graph of its own (model and tools on a private message history) that returns only its report; all start together and the research debate waits for every report
- the message-clearing nodes are gone; a checkpoint saved by the sequential layout starts fresh
- TradingAgentsGraph.stream_run streams the analysts' messages for debug mode and the CLI, whose status and timing now track the analysts side by side
2026-09-25 06:35:54 +00:00

31 lines
1.3 KiB
Python

import unittest
from tradingagents.graph.analyst_execution import (
build_analyst_execution_plan,
)
class AnalystExecutionPlanTests(unittest.TestCase):
def test_build_plan_preserves_selected_order(self):
plan = build_analyst_execution_plan(["news", "market"])
self.assertEqual([spec.key for spec in plan.specs], ["news", "market"])
self.assertEqual(plan.specs[0].agent_node, "News Analyst")
self.assertEqual(plan.specs[0].report_key, "news_report")
self.assertFalse(hasattr(plan.specs[0], "clear_node"))
def test_rejects_unknown_analyst_keys(self):
with self.assertRaises(ValueError):
build_analyst_execution_plan(["market", "macro"])
def test_social_key_displays_as_sentiment_analyst(self):
# The wire key stays "social" for saved-config back-compat, but the
# user-visible agent_node label must match the v0.2.5 rename so the
# wall-time summary and any future consumer of agent_node says
# "Sentiment Analyst" rather than the legacy "Social Analyst".
plan = build_analyst_execution_plan(["social"])
spec = plan.specs[0]
self.assertEqual(spec.key, "social")
self.assertEqual(spec.agent_node, "Sentiment Analyst")
self.assertEqual(spec.report_key, "sentiment_report")