use execution plan metadata for first analyst
This commit is contained in:
parent
4300b68f19
commit
f4519bcb84
|
|
@ -27,6 +27,7 @@ from tradingagents.graph.trading_graph import TradingAgentsGraph
|
||||||
from tradingagents.graph.analyst_execution import (
|
from tradingagents.graph.analyst_execution import (
|
||||||
AnalystWallTimeTracker,
|
AnalystWallTimeTracker,
|
||||||
build_analyst_execution_plan,
|
build_analyst_execution_plan,
|
||||||
|
get_initial_analyst_node,
|
||||||
sync_analyst_tracker_from_chunk,
|
sync_analyst_tracker_from_chunk,
|
||||||
)
|
)
|
||||||
from tradingagents.default_config import DEFAULT_CONFIG
|
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_display(layout, stats_handler=stats_handler, start_time=start_time)
|
||||||
|
|
||||||
# Update agent status to in_progress for the first analyst
|
# 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")
|
message_buffer.update_agent_status(first_analyst, "in_progress")
|
||||||
analyst_wall_time_tracker.mark_started(selected_analyst_keys[0])
|
analyst_wall_time_tracker.mark_started(selected_analyst_keys[0])
|
||||||
update_display(layout, stats_handler=stats_handler, start_time=start_time)
|
update_display(layout, stats_handler=stats_handler, start_time=start_time)
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import unittest
|
||||||
from tradingagents.graph.analyst_execution import (
|
from tradingagents.graph.analyst_execution import (
|
||||||
AnalystWallTimeTracker,
|
AnalystWallTimeTracker,
|
||||||
build_analyst_execution_plan,
|
build_analyst_execution_plan,
|
||||||
|
get_initial_analyst_node,
|
||||||
sync_analyst_tracker_from_chunk,
|
sync_analyst_tracker_from_chunk,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -25,6 +26,14 @@ class AnalystExecutionPlanTests(unittest.TestCase):
|
||||||
with self.assertRaises(ValueError):
|
with self.assertRaises(ValueError):
|
||||||
build_analyst_execution_plan(["market"], concurrency_limit=0)
|
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):
|
class AnalystWallTimeTrackerTests(unittest.TestCase):
|
||||||
def test_records_wall_time_when_analyst_completes(self):
|
def test_records_wall_time_when_analyst_completes(self):
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,10 @@ def build_analyst_execution_plan(
|
||||||
return AnalystExecutionPlan(specs=specs, concurrency_limit=concurrency_limit)
|
return AnalystExecutionPlan(specs=specs, concurrency_limit=concurrency_limit)
|
||||||
|
|
||||||
|
|
||||||
|
def get_initial_analyst_node(plan: AnalystExecutionPlan) -> str:
|
||||||
|
return plan.specs[0].agent_node
|
||||||
|
|
||||||
|
|
||||||
class AnalystWallTimeTracker:
|
class AnalystWallTimeTracker:
|
||||||
def __init__(self, plan: AnalystExecutionPlan):
|
def __init__(self, plan: AnalystExecutionPlan):
|
||||||
self.plan = plan
|
self.plan = plan
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue