feat: write run_config.md alongside each analysis (#752)#790
feat: write run_config.md alongside each analysis (#752)#790djconnexion77 wants to merge 4 commits into
Conversation
Adds tradingagents.__version__ resolved from installed package metadata (pyproject.toml). Used by the upcoming run-configuration report (TauricResearch#752) to record which tradingagents version produced each analysis. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pure function that renders a markdown summary of the run parameters (ticker, analyst selections, LLM provider/models, debate rounds, and provider-specific reasoning effort). Provider-specific fields render only when set, so Ollama runs don't surface empty OpenAI/Google rows. Three unit tests cover happy path, omission of unset keys, and the provider-specific section. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rch#752) save_report_to_disk() now accepts optional `selections` and `config` kwargs. When both are provided, a `run_config.md` is written at the root of the report directory capturing tradingagents version, run parameters, LLM provider/models, and provider-specific reasoning parameters (only those that are set). Backwards compatible — existing callers that don't pass selections/config get the original behaviour. The CLI's run_analysis() now threads both dicts through to the save call. Closes TauricResearch#752. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a run configuration report feature that captures the parameters used for each analysis, such as the package version, ticker, models, and provider-specific reasoning settings. The changes include a new run_config_report.py module, updates to the CLI saving logic in main.py, and the addition of unit tests. Feedback suggests moving local imports to the top of the file for PEP 8 compliance, using constants for the report filename to avoid hardcoding, and capitalizing labels in the markdown output for consistency.
| from tradingagents import __version__ as _ta_version | ||
| from cli.run_config_report import build_run_config_markdown |
There was a problem hiding this comment.
Local imports inside functions are generally discouraged unless they are necessary to avoid circular dependencies. Since tradingagents and cli.run_config_report are part of the project and don't seem to cause circularity here, moving these to the top of the file would improve readability and follow PEP 8 more closely.
| ) | ||
| console.print(f"\n[green]✓ Report saved to:[/green] {save_path.resolve()}") | ||
| console.print(f" [dim]Complete report:[/dim] {report_file.name}") | ||
| console.print(f" [dim]Run config:[/dim] run_config.md") |
There was a problem hiding this comment.
The filename run_config.md is hardcoded here and in save_report_to_disk. If the filename is ever changed in the saving logic, this print statement will become incorrect. Consider defining a constant for the filename or having save_report_to_disk return the names of all files it created to ensure consistency.
| ) or "—" | ||
|
|
||
| base_rows = [ | ||
| _row("tradingagents version", version), |
There was a problem hiding this comment.
For consistency with the other labels in the table (e.g., 'Ticker', 'Analysts', 'Research depth'), this label should be capitalized. Using 'TradingAgents version' would also match the project's branding in other parts of the CLI.
| _row("tradingagents version", version), | |
| _row("TradingAgents version", version), |
Closes #752.
Each saved analysis now includes a
run_config.mdat the report root, capturing:tradingagentspackage version (exposed viaimportlib.metadata)Why
Issue #752 describes comparing runs across LLM families (OpenAI vs Google vs Ollama) and over time as models and tradingagents itself evolve. Without persisted config, you can't tell from disk which parameters produced which report.
Implementation
tradingagents.__version__viaimportlib.metadata.version("tradingagents")cli/run_config_report.pywith one pure function:build_run_config_markdown(selections, config, version) -> strcli/main.py:save_report_to_disk()gains optionalselections/configkwargs; when both are passed, writesrun_config.md. Backwards compatible — existing callers that don't pass them still work.tests/test_run_config_report.py(@pytest.mark.unit)[Unreleased] / AddedSample output
Tests
(45 existing + 3 new for the markdown builder.)