Skip to content

Add ESG analyst workflow#762

Open
MichaelCao0 wants to merge 2 commits intoTauricResearch:mainfrom
MichaelCao0:codex-add-esg-analyst
Open

Add ESG analyst workflow#762
MichaelCao0 wants to merge 2 commits intoTauricResearch:mainfrom
MichaelCao0:codex-add-esg-analyst

Conversation

@MichaelCao0
Copy link
Copy Markdown

@MichaelCao0 MichaelCao0 commented May 7, 2026

Summary

Add an optional ESG analyst to the TradingAgents workflow and wire ESG analysis through CLI selection, graph state, report persistence, and downstream research prompts.

Changes

  • Add ESG analyst selection, progress display, report rendering, and saved report output.
  • Add esg_report to graph state, initial propagation, and final graph results.
  • Add create_esg_analyst plus ESG score/news data tools.
  • Wire ESG tool nodes and normalize analyst graph node names so ESG consistently uses ESG Analyst.
  • Include ESG context in bull/bear researcher prompts.
  • Harden ticker-derived CLI result paths with safe_ticker_component.
  • Avoid ESG look-ahead bias by refusing current ESG scores for historical dates and filtering ESG news by curr_date.
  • Add ESG integration tests for CLI registration, graph routing/compile, prompt rendering, yfinance nested news parsing, future-news filtering, and ESG DataFrame score extraction.

Testing

Remote server (eddc2d887321a8715a63ccb5ebafafaa.bayesdl.com):

python -m py_compile tradingagents/agents/analysts/esg_analyst.py tests/test_esg_integration.py
python -m pytest tests/test_esg_integration.py -q
python -m pytest tests -q

Results:

8 passed, 1 warning
116 passed, 1 warning, 42 subtests passed

Runtime smoke from the previous latest-version validation:

tradingagents --help
tradingagents analyze --help
ESG analyst node execution
ESG-only graph compile
runtime-smoke-ok

The remaining warning is an upstream LangGraph pending deprecation warning unrelated to this change.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces an ESG (Environmental, Social, Governance) Analyst to the trading agent system. Key changes include the implementation of an ESG analyst agent, new data tools for fetching sustainability scores and news from Yahoo Finance with look-ahead bias protection, and the integration of ESG reports into the bull and bear researcher prompts. The graph workflow and CLI have also been updated to support this new analyst type. Feedback points out a high-severity syntax error in the ESG analyst's system message definition where a trailing comma incorrectly creates a tuple, which would break the prompt formatting.

Comment thread tradingagents/agents/analysts/esg_analyst.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant