use execution plan metadata for first analyst

This commit is contained in:
CadeYu 2026-03-31 10:09:57 +08:00
parent 4300b68f19
commit f4519bcb84
3 changed files with 15 additions and 1 deletions

View File

@ -27,6 +27,7 @@ from tradingagents.graph.trading_graph import TradingAgentsGraph
from tradingagents.graph.analyst_execution import (
AnalystWallTimeTracker,
build_analyst_execution_plan,
get_initial_analyst_node,
sync_analyst_tracker_from_chunk,
)
from tradingagents.default_config import DEFAULT_CONFIG
@ -1044,7 +1045,7 @@ def run_analysis():
update_display(layout, stats_handler=stats_handler, start_time=start_time)
# Update agent status to in_progress for the first analyst
first_analyst = f"{selected_analyst_keys[0].capitalize()} Analyst"
first_analyst = get_initial_analyst_node(analyst_execution_plan)
message_buffer.update_agent_status(first_analyst, "in_progress")
analyst_wall_time_tracker.mark_started(selected_analyst_keys[0])
update_display(layout, stats_handler=stats_handler, start_time=start_time)

View File

@ -3,6 +3,7 @@ import unittest
from tradingagents.graph.analyst_execution import (
AnalystWallTimeTracker,
build_analyst_execution_plan,
get_initial_analyst_node,
sync_analyst_tracker_from_chunk,
)
@ -25,6 +26,14 @@ class AnalystExecutionPlanTests(unittest.TestCase):
with self.assertRaises(ValueError):
build_analyst_execution_plan(["market"], concurrency_limit=0)
def test_get_initial_analyst_node_uses_plan_metadata(self):
plan = build_analyst_execution_plan(["fundamentals", "news"])
self.assertEqual(
get_initial_analyst_node(plan),
"Fundamentals Analyst",
)
class AnalystWallTimeTrackerTests(unittest.TestCase):
def test_records_wall_time_when_analyst_completes(self):

View File

@ -70,6 +70,10 @@ def build_analyst_execution_plan(
return AnalystExecutionPlan(specs=specs, concurrency_limit=concurrency_limit)
def get_initial_analyst_node(plan: AnalystExecutionPlan) -> str:
return plan.specs[0].agent_node
class AnalystWallTimeTracker:
def __init__(self, plan: AnalystExecutionPlan):
self.plan = plan