From e74a715e0a4857d88e43f04859f408a13dae54e8 Mon Sep 17 00:00:00 2001 From: Clayton Brown Date: Mon, 20 Apr 2026 20:22:26 +1000 Subject: [PATCH] feat(027-checkpoint-resume-contrib): add --checkpoint CLI flag (default: disabled) --- cli/main.py | 9 ++++++--- tradingagents/default_config.py | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cli/main.py b/cli/main.py index 33d110fb..4316ebed 100644 --- a/cli/main.py +++ b/cli/main.py @@ -926,7 +926,7 @@ def format_tool_args(args, max_length=80) -> str: return result[:max_length - 3] + "..." return result -def run_analysis(): +def run_analysis(checkpoint: bool = False): # First get all user selections selections = get_user_selections() @@ -943,6 +943,7 @@ def run_analysis(): config["openai_reasoning_effort"] = selections.get("openai_reasoning_effort") config["anthropic_effort"] = selections.get("anthropic_effort") config["output_language"] = selections.get("output_language", "English") + config["checkpoint_enabled"] = checkpoint # Create stats callback handler for tracking LLM/tool calls stats_handler = StatsCallbackHandler() @@ -1197,8 +1198,10 @@ def run_analysis(): @app.command() -def analyze(): - run_analysis() +def analyze( + checkpoint: bool = typer.Option(False, "--checkpoint", help="Enable checkpoint/resume: save state after each node so crashed runs can resume."), +): + run_analysis(checkpoint=checkpoint) if __name__ == "__main__": diff --git a/tradingagents/default_config.py b/tradingagents/default_config.py index a9b75e4b..c0c441ea 100644 --- a/tradingagents/default_config.py +++ b/tradingagents/default_config.py @@ -15,6 +15,9 @@ DEFAULT_CONFIG = { "google_thinking_level": None, # "high", "minimal", etc. "openai_reasoning_effort": None, # "medium", "high", "low" "anthropic_effort": None, # "high", "medium", "low" + # Checkpoint/resume: when True, LangGraph saves state after each node + # so a crashed run can resume from the last successful step. + "checkpoint_enabled": False, # Output language for analyst reports and final decision # Internal agent debate stays in English for reasoning quality "output_language": "English",