From 7b6f11dccd194c6969d88d13e7042b07b98c62d5 Mon Sep 17 00:00:00 2001 From: Meghaditya Giri <72164147+Mgiri1234@users.noreply.github.com> Date: Sun, 24 Aug 2025 16:22:22 +0530 Subject: [PATCH] Ensure all debate state fields initialized --- tradingagents/graph/propagation.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tradingagents/graph/propagation.py b/tradingagents/graph/propagation.py index 58ebd0a8..5ae383f2 100644 --- a/tradingagents/graph/propagation.py +++ b/tradingagents/graph/propagation.py @@ -23,15 +23,29 @@ class Propagator: "messages": [("human", company_name)], "company_of_interest": company_name, "trade_date": str(trade_date), + # Pre-populate debate state dictionaries with all required keys so + # downstream logic that reads from them doesn't encounter KeyError "investment_debate_state": InvestDebateState( - {"history": "", "current_response": "", "count": 0} + { + "history": "", + "bull_history": "", + "bear_history": "", + "current_response": "", + "judge_decision": "", + "count": 0, + } ), "risk_debate_state": RiskDebateState( { "history": "", + "risky_history": "", + "safe_history": "", + "neutral_history": "", + "latest_speaker": "", "current_risky_response": "", "current_safe_response": "", "current_neutral_response": "", + "judge_decision": "", "count": 0, } ),