In this paper, we present an agentic AI application to do stock research is developed. This application is built in python using langgraph and langchain. It uses OpenAI LLM for decisioning. Current application recognizes only NSE stock symbols. It uses different web sources. It has 3 AI agents. First agent is for research which calls different tools to get stock information and sector information and news. Second agent does the analysis using the information collected by research agent. Third agent generates the report. Using langgraph, another alternative workflow is implemented where we have 7 specialized autonomous agents. That flow uses LLM as a tool. It is to optimize AI cost and rely more on code. It uses AI only for decision making.
Keywords: Agentic AI, langgraph, langchain
As a part of Module 2 of Agentic AI Developer Certification, we need to build a Multi-Agent System. In this article, we will cover one of the multi-agent system built to solve a problem: stock research.
Equity research report generation is a time-intensive process requiring expert analysts to manually gather data from multiple sources, perform complex financial calculations, analyze market trends, and synthesize findings into comprehensive reports. This process can take days or weeks, limiting the ability to respond quickly to market changes and making comprehensive analysis prohibitively expensive for many investors and institutions.
Additionally, the multi-faceted nature of stock analysis—encompassing financial metrics, management quality, technical indicators, valuation models, and sector dynamics—requires specialized expertise across various domains. Integrating insights from these diverse perspectives into a coherent investment thesis presents significant challenges.
Can we use AI to make the life of equity researchers easy?
If we look traditional approach, first we collect the data about stock, sectors, economy and other domain specific knowledge as determined by the researcher. Then, collected data is analyzed using different analysis methods and tools. Once analysis is done, report is generated. As simple it seems, the process is iterative.
Here, we are trying to solve using an agentic AI system.
The Stock Report Generator addresses these challenges by automating the entire research and report generation pipeline through an autonomous multi-agent system. Each agent specializes in a particular aspect of analysis while maintaining the ability to collaborate and adapt based on emerging insights. The system combines:
This project is for learning purpose. Do not treat the output generated by the tool as stock recommendation. Please consult your investment adviser or research analysts. Any stock example shown is merely for education purpose, not investment recommendation.
This project uses yfinance python project which is intended for personal purpose only. Hence, do not use this project in production or commercial applications.
Here, we discuss the solution being implemented to solve the problem.
The Stock Report Generator tool employs a LangGraph-based orchestration framework that manages workflow state, agent coordination, and parallel execution. This generator works under two modes: Agentic AI Mode and Mixed Mode. This mode is controlled by the command line argument (-s or --skip-ai flag). By default, tool runs in Agentic AI Mode. By specifying option, it runs in Mixed Mode.
It works as follows:
Stock symbol input --> Symbol validation --> Langgraph based Orchestration Execution --> Result
Currently, only NSE symbols are supported.
Each agent in the system follows the BaseAgent architecture, which provides:
Under Agentic AI Mode, it has following langgraph structure:

In this mode, agents use iterative LLM-based reasoning to dynamically determine their research and analysis strategy:
Phase 1: AI Research (AIResearchAgent)
Phase 2: AI Analysis (AIAnalysisAgent)
Phase 3: AI Report Generation (AIReportAgent)
Mixed mode uses AI but it does tool execution on its own. It relies on its own framework to execute the tools. It uses LLM only when needed. It still uses langgraph based workflow as shown below.

This mode follows a traditional research pipeline with ordered execution:
Phase 1: Research Planning (ResearchPlannerAgent)
Phase 2: Data Gathering (ResearchAgent)
Phase 3: Parallel Analysis (4 Agents run concurrently)
Phase 4: Report Synthesis (ReportAgent)
This mode is introduced to save the LLM token.
The system uses a MultiAgentState (Pydantic model) that tracks:
LangGraph's StateGraph ensures consistent state updates across concurrent and sequential agent executions, with automatic state merging and conflict resolution.
Tools are implemented as LangChain-compatible callables that agents can autonomously invoke. Tools are categorized as:
The system implements multiple layers of error resilience:
The orchestrator leverages LangGraph's parallel execution capabilities to run analysis agents concurrently, significantly reducing total execution time. State updates are safely merged using reducer functions that handle list concatenation and conflict resolution.
Before installing the Stock Report Generator, ensure you have:
This method installs the package in editable mode, allowing code modifications to be immediately reflected:
# Clone the repository git clone https://github.com/devendermishra/stock-report-generator # or use ssh url. cd stock-report-generator # Create and activate virtual environment (highly recommended) python3 -m venv venv source venv/bin/activate # On macOS/Linux # venv\Scripts\activate # On Windows # Install in editable mode pip install -e .
For standard installation without editable mode:
# Clone the repository git clone https://github.com/devendermishra/stock-report-generator # or use ssh url cd stock-report-generator # Create virtual environment python3 -m venv venv source venv/bin/activate # On macOS/Linux # venv\Scripts\activate # On Windows # Upgrade pip pip install --upgrade pip # Install dependencies pip install -r requirements.txt
cp env.example .env
.env file with your API keys:# On macOS/Linux: nano .env # or vim .env # On Windows: notepad .env
OPENAI_API_KEY=sk-your-actual-api-key-here
DEFAULT_MODEL=gpt-4o-mini MAX_TOKENS=4000 TEMPERATURE=0.1 OUTPUT_DIR=reports TEMP_DIR=temp MAX_REQUESTS_PER_MINUTE=60 REQUEST_DELAY=1.0
mkdir -p reports temp data/inputs data/outputs
# Check CLI help python3 src/main.py --help
python3 src/main.py RELIANCE
After installation, you can use the CLI command:
# Generate report stock-report RELIANCE # Or use Python directly python src/main.py RELIANCE # With all parameters python src/main.py RELIANCE "Reliance Industries Limited" "Oil & Gas" # Using structured workflow (skip AI agents) python src/main.py RELIANCE --skip-ai
For any issue encountered during installation and issues, please raise using github issue using link
We generated multiple stock reports (10 reports) using this tool.
SBIN Report in agentic mode
% python3 src/main.py SBIN 2025-11-02 17:18:06,142 - graph.multi_agent_graph - INFO - Building graph with use_ai_research=True, use_ai_analysis=True 2025-11-02 17:18:06,142 - graph.multi_agent_graph - INFO - Adding AI Research Agent node 2025-11-02 17:18:06,142 - graph.multi_agent_graph - INFO - Adding AI Analysis Agent node 2025-11-02 17:18:06,148 - __main__ - INFO - Stock Report Generator initialized successfully (Research: AI Research Agent, Analysis: AI Analysis Agent) 2025-11-02 17:18:06,148 - __main__ - INFO - Using AI Research Agent (iterative LLM-based research) 2025-11-02 17:18:06,148 - __main__ - INFO - Using AI Analysis Agent (iterative LLM-based comprehensive analysis) Generating report for SBIN (SBIN) in unknown sector... This may take a few minutes as the AI agents gather and analyze data... 2025-11-02 17:18:06,148 - __main__ - INFO - Starting report generation for SBIN 2025-11-02 17:18:06,148 - tools.stock_data_tool - INFO - Validating symbol SBIN.NS 2025-11-02 17:18:07,282 - tools.stock_data_tool - INFO - Fetching company info for SBIN.NS 2025-11-02 17:18:07,378 - tools.stock_data_tool - INFO - Successfully retrieved company info for SBIN.NS 2025-11-02 17:18:07,378 - graph.multi_agent_graph - INFO - Starting multi-agent workflow for SBIN 2025-11-02 17:18:07,380 - graph.multi_agent_graph - INFO - Executing AI research agent for SBIN 2025-11-02 17:18:09,978 - httpx - INFO - HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK" 2025-11-02 17:18:09,996 - agents.base_agent.ai_research_agent - INFO - Iteration 1: Executing 4 tool(s): get_stock_metrics, get_company_info, search_sector_news, search_company_news 2025-11-02 17:18:09,998 - tools.stock_data_tool - INFO - Fetching company info for SBIN.NS 2025-11-02 17:18:09,999 - tools.stock_data_tool - INFO - Fetching stock metrics for SBIN.NS 2025-11-02 17:18:09,999 - tools.web_search_tool - INFO - Searching for sector news: Financial Services sector news India NSE market trends last week recent analysis outlook 2025-11-02 17:18:10,002 - tools.web_search_tool - INFO - Searching for company news: State Bank of India SBIN news India NSE announcements last week recent 2025-11-02 17:18:10,003 - tools.web_search_tool - INFO - Search attempt 1/3 for query: Financial Services sector news India NSE market trends last week recent analysis outlook 2025-11-02 17:18:10,003 - tools.web_search_tool - INFO - Search attempt 1/3 for query: State Bank of India SBIN news India NSE announcements last week recent 2025-11-02 17:18:10,003 - tools.web_search_tool - INFO - Trying search engine: mullvad_google 2025-11-02 17:18:10,003 - tools.web_search_tool - INFO - Trying search engine: mullvad_google 2025-11-02 17:18:10,411 - tools.stock_data_tool - INFO - Successfully retrieved company info for SBIN.NS 2025-11-02 17:18:10,542 - tools.stock_data_tool - INFO - Successfully retrieved metrics for SBIN.NS 2025-11-02 17:18:10,969 - primp - INFO - response: https://leta.mullvad.net/search/__data.json?q=Financial+Services+sector+news+India+NSE+market+trends+last+week+recent+analysis+outlook&engine=google&x-sveltekit-invalidated=001&country=us&lang=en 200 2025-11-02 17:18:10,972 - tools.web_search_tool - INFO - Successfully got 10 results using mullvad_google 2025-11-02 17:18:10,973 - tools.web_search_tool - INFO - Search completed successfully 2025-11-02 17:18:11,314 - primp - INFO - response: https://leta.mullvad.net/search/__data.json?q=State+Bank+of+India+SBIN+news+India+NSE+announcements+last+week+recent&engine=google&x-sveltekit-invalidated=001&country=us&lang=en 200 2025-11-02 17:18:11,316 - tools.web_search_tool - INFO - Successfully got 10 results using mullvad_google 2025-11-02 17:18:11,316 - tools.web_search_tool - INFO - Search completed successfully 2025-11-02 17:18:21,155 - httpx - INFO - HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK" 2025-11-02 17:18:21,164 - agents.base_agent.ai_research_agent - INFO - Agent decided to finish after 2 iterations 2025-11-02 17:18:21,164 - agents.base_agent.ai_research_agent - INFO - AI Research Agent completed research for SBIN using 4 tools in 4 iterations 2025-11-02 17:18:21,165 - graph.multi_agent_graph - INFO - AI research agent completed for SBIN 2025-11-02 17:18:21,183 - graph.multi_agent_graph - INFO - Executing AI analysis agent for SBIN 2025-11-02 17:18:21,184 - graph.multi_agent_graph - INFO - Including research results for AI analysis agent 2025-11-02 17:18:21,184 - agents.base_agent.ai_analysis_agent - INFO - Extracted data from research: ['get_stock_metrics', 'get_company_info', 'search_company_news', 'search_market_trends'] 2025-11-02 17:18:21,184 - agents.base_agent.ai_analysis_agent - INFO - Stock metrics available: True 2025-11-02 17:18:21,184 - agents.base_agent.ai_analysis_agent - INFO - Company info available: True 2025-11-02 17:18:31,845 - httpx - INFO - HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK" 2025-11-02 17:18:31,850 - agents.base_agent.ai_analysis_agent - INFO - Agent decided to finish after 1 iterations 2025-11-02 17:18:34,303 - httpx - INFO - HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK" 2025-11-02 17:18:36,924 - httpx - INFO - HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK" 2025-11-02 17:18:39,358 - httpx - INFO - HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK" 2025-11-02 17:18:39,362 - agents.base_agent.ai_analysis_agent - INFO - AI Analysis Agent completed analysis for SBIN using 0 tools in 0 iterations 2025-11-02 17:18:39,365 - graph.multi_agent_graph - INFO - Executing report agent for SBIN 2025-11-02 17:18:39,365 - graph.multi_agent_graph - INFO - Report agent received results from 4/4 analysis agents 2025-11-02 17:18:57,506 - httpx - INFO - HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK" 2025-11-02 17:18:57,527 - tools.pdf_generator_tool - INFO - Starting PDF generation... 2025-11-02 17:18:57,539 - tools.pdf_generator_tool - INFO - Generating PDF: reports/stock_report_SBIN_20251102_171857.pdf 2025-11-02 17:18:57,656 - tools.pdf_generator_tool - INFO - PDF generated successfully: reports/stock_report_SBIN_20251102_171857.pdf 2025-11-02 17:18:57,658 - agents.base_agent.ai_report_agent - INFO - AI Report Agent completed report generation for SBIN 2025-11-02 17:18:57,659 - graph.multi_agent_graph - INFO - Report agent completed for SBIN 2025-11-02 17:18:57,756 - graph.multi_agent_graph - INFO - Completed multi-agent workflow for SBIN in 50.28s 2025-11-02 17:18:57,758 - __main__ - INFO - Successfully generated report for SBIN 2025-11-02 17:18:57,759 - __main__ - INFO - PDF report saved to: reports/stock_report_SBIN_20251102_171857.pdf ============================================================ REPORT GENERATION COMPLETED ============================================================ ✅ Successfully generated report for SBIN 📊 Company: State Bank of India 🏢 Sector: Financial Services ⏱️ Duration: 50.28 seconds 📄 PDF Report: reports/stock_report_SBIN_20251102_171857.pdf 📋 Report Preview (first 500 characters): ---------------------------------------- # State Bank of India (SBIN) Stock Research Report **Generated on:** 2025-11-02 **Report Type:** Comprehensive Equity Research Analysis **Sector:** Financial Services ## Executive Summary State Bank of India (SBIN) is a leading player in the Indian banking sector, providing a wide range of financial services both domestically and internationally. The bank has demonstrated resilience and growth potential, supported by a strong market position and diversified offerings. ### Key Highlights... ---------------------------------------- ============================================================
When the symbol is invalid:
% python3 src/main.py SBI 2025-11-02 17:16:38,747 - graph.multi_agent_graph - INFO - Building graph with use_ai_research=True, use_ai_analysis=True 2025-11-02 17:16:38,748 - graph.multi_agent_graph - INFO - Adding AI Research Agent node 2025-11-02 17:16:38,748 - graph.multi_agent_graph - INFO - Adding AI Analysis Agent node 2025-11-02 17:16:38,753 - __main__ - INFO - Stock Report Generator initialized successfully (Research: AI Research Agent, Analysis: AI Analysis Agent) 2025-11-02 17:16:38,753 - __main__ - INFO - Using AI Research Agent (iterative LLM-based research) 2025-11-02 17:16:38,753 - __main__ - INFO - Using AI Analysis Agent (iterative LLM-based comprehensive analysis) Generating report for SBI (SBI) in unknown sector... This may take a few minutes as the AI agents gather and analyze data... 2025-11-02 17:16:38,753 - __main__ - INFO - Starting report generation for SBI 2025-11-02 17:16:38,753 - tools.stock_data_tool - INFO - Validating symbol SBI.NS 2025-11-02 17:16:40,065 - yfinance - ERROR - $SBI.NS: possibly delisted; no price data found (period=1d) 2025-11-02 17:16:40,065 - __main__ - ERROR - Report generation failed for SBI: No price data available ============================================================ REPORT GENERATION COMPLETED ============================================================ ❌ Report generation failed for SBI Errors encountered: - No price data available ============================================================
Using mixed for IRCTC, we got the following output:
% python3 src/main.py IRCTC -s 2025-11-02 17:12:41,471 - graph.multi_agent_graph - INFO - Building graph with use_ai_research=False, use_ai_analysis=False 2025-11-02 17:12:41,471 - graph.multi_agent_graph - INFO - Adding Research Planner and Research Agent nodes 2025-11-02 17:12:41,471 - graph.multi_agent_graph - INFO - Adding separate analysis agent nodes 2025-11-02 17:12:41,481 - __main__ - INFO - Stock Report Generator initialized successfully (Research: Research Planner + Research Agent, Analysis: Separate Analysis Agents) 2025-11-02 17:12:41,481 - __main__ - INFO - Using Research Planner + Research Agent (structured workflow) 2025-11-02 17:12:41,481 - __main__ - INFO - Using separate Financial, Management, Technical, Valuation Analysis Agents Generating report for IRCTC (IRCTC) in unknown sector... This may take a few minutes as the AI agents gather and analyze data... 2025-11-02 17:12:41,481 - __main__ - INFO - Starting report generation for IRCTC 2025-11-02 17:12:41,482 - tools.stock_data_tool - INFO - Validating symbol IRCTC.NS 2025-11-02 17:12:42,579 - tools.stock_data_tool - INFO - Fetching company info for IRCTC.NS 2025-11-02 17:12:42,689 - tools.stock_data_tool - INFO - Successfully retrieved company info for IRCTC.NS 2025-11-02 17:12:42,689 - graph.multi_agent_graph - INFO - Starting multi-agent workflow for IRCTC 2025-11-02 17:12:42,691 - graph.multi_agent_graph - INFO - Executing research planner agent for IRCTC 2025-11-02 17:12:42,691 - agents.base_agent.research_planner_agent - INFO - Starting research planning for Indian Railway Catering & Tourism Corporation Limited (IRCTC) 2025-11-02 17:12:47,307 - httpx - INFO - HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK" 2025-11-02 17:12:47,319 - agents.base_agent.research_planner_agent - INFO - Generated research plan with 6 tool calls 2025-11-02 17:12:47,319 - agents.base_agent.research_planner_agent - INFO - Step 1: get_company_info (order: 1) 2025-11-02 17:12:47,319 - agents.base_agent.research_planner_agent - INFO - Step 2: get_stock_metrics (order: 2) 2025-11-02 17:12:47,319 - agents.base_agent.research_planner_agent - INFO - Step 3: search_sector_news (order: 3) 2025-11-02 17:12:47,319 - agents.base_agent.research_planner_agent - INFO - Step 4: search_company_news (order: 4) 2025-11-02 17:12:47,319 - agents.base_agent.research_planner_agent - INFO - Step 5: search_market_trends (order: 5) 2025-11-02 17:12:47,319 - agents.base_agent.research_planner_agent - INFO - Step 6: generic_web_search (order: 6) 2025-11-02 17:12:47,320 - agents.base_agent.research_planner_agent - INFO - Agent research_planner_agent completed task 'research_planning' for IRCTC in 4.63s (confidence: 0.80, tools: 0) 2025-11-02 17:12:47,320 - graph.multi_agent_graph - INFO - Research planner agent completed for IRCTC 2025-11-02 17:12:47,325 - graph.multi_agent_graph - INFO - Executing research agent for IRCTC 2025-11-02 17:12:47,325 - graph.multi_agent_graph - INFO - Including research plan for research agent 2025-11-02 17:12:47,325 - agents.base_agent.research_agent - INFO - Starting research for IRCTC (Indian Railway Catering & Tourism Corporation Limited) using research plan with 6 tools 2025-11-02 17:12:47,326 - agents.base_agent.research_agent - INFO - Executing research plan with 6 tool calls 2025-11-02 17:12:47,326 - agents.base_agent.research_agent - INFO - Queuing tool 1: get_company_info with parameters {'symbol': 'IRCTC'} 2025-11-02 17:12:47,326 - agents.base_agent.research_agent - INFO - Queuing tool 2: get_stock_metrics with parameters {'symbol': 'IRCTC'} 2025-11-02 17:12:47,326 - agents.base_agent.research_agent - INFO - Queuing tool 3: search_sector_news with parameters {'sector': 'Industrials', 'days_back': 7, 'include_analysis': True} 2025-11-02 17:12:47,326 - agents.base_agent.research_agent - INFO - Queuing tool 4: search_company_news with parameters {'company_name': 'Indian Railway Catering & Tourism Corporation Limited', 'stock_symbol': 'IRCTC', 'days_back': 7} 2025-11-02 17:12:47,326 - agents.base_agent.research_agent - INFO - Queuing tool 5: search_market_trends with parameters {'query': 'Indian Industrials sector trends', 'max_results': 5} 2025-11-02 17:12:47,326 - agents.base_agent.research_agent - INFO - Queuing tool 6: generic_web_search with parameters {'query': 'IRCTC peer comparison', 'search_type': 'web', 'max_results': 5} 2025-11-02 17:12:47,327 - agents.base_agent.research_agent - INFO - Executing planned tool [1]: get_company_info 2025-11-02 17:12:47,328 - tools.stock_data_tool - INFO - Fetching company info for IRCTC.NS 2025-11-02 17:12:47,537 - tools.stock_data_tool - INFO - Successfully retrieved company info for IRCTC.NS 2025-11-02 17:12:47,537 - agents.base_agent.research_agent - INFO - Executing planned tool [2]: get_stock_metrics 2025-11-02 17:12:47,538 - tools.stock_data_tool - INFO - Fetching stock metrics for IRCTC.NS 2025-11-02 17:12:47,720 - tools.stock_data_tool - INFO - Successfully retrieved metrics for IRCTC.NS 2025-11-02 17:12:47,721 - agents.base_agent.research_agent - INFO - Executing planned tool [3]: search_sector_news 2025-11-02 17:12:47,721 - tools.web_search_tool - INFO - Searching for sector news: Industrials sector news India NSE market trends last week recent analysis outlook 2025-11-02 17:12:47,722 - tools.web_search_tool - INFO - Search attempt 1/3 for query: Industrials sector news India NSE market trends last week recent analysis outlook 2025-11-02 17:12:47,722 - tools.web_search_tool - INFO - Trying search engine: mullvad_google 2025-11-02 17:12:48,405 - primp - INFO - response: https://leta.mullvad.net/search/__data.json?q=Industrials+sector+news+India+NSE+market+trends+last+week+recent+analysis+outlook&engine=google&x-sveltekit-invalidated=001&country=us&lang=en 200 2025-11-02 17:12:48,406 - tools.web_search_tool - INFO - Successfully got 10 results using mullvad_google 2025-11-02 17:12:48,407 - tools.web_search_tool - INFO - Search completed successfully 2025-11-02 17:12:48,407 - agents.base_agent.research_agent - INFO - Executing planned tool [4]: search_company_news 2025-11-02 17:12:48,407 - tools.web_search_tool - INFO - Searching for company news: Indian Railway Catering & Tourism Corporation Limited IRCTC news India NSE announcements last week recent 2025-11-02 17:12:48,407 - tools.web_search_tool - INFO - Search attempt 1/3 for query: Indian Railway Catering & Tourism Corporation Limited IRCTC news India NSE announcements last week recent 2025-11-02 17:12:48,407 - tools.web_search_tool - INFO - Trying search engine: mullvad_google 2025-11-02 17:12:48,784 - primp - INFO - response: https://leta.mullvad.net/search/__data.json?q=Indian+Railway+Catering+%26+Tourism+Corporation+Limited+IRCTC+news+India+NSE+announcements+last+week+recent&engine=google&x-sveltekit-invalidated=001&country=us&lang=en 200 2025-11-02 17:12:48,785 - tools.web_search_tool - INFO - Successfully got 10 results using mullvad_google 2025-11-02 17:12:48,785 - tools.web_search_tool - INFO - Search completed successfully 2025-11-02 17:12:48,785 - agents.base_agent.research_agent - INFO - Executing planned tool [5]: search_market_trends 2025-11-02 17:12:48,785 - tools.web_search_tool - INFO - Searching for market trends: Indian Industrials sector trends India NSE market analysis trends 2025-11-02 17:12:48,785 - tools.web_search_tool - INFO - Search attempt 1/3 for query: Indian Industrials sector trends India NSE market analysis trends 2025-11-02 17:12:48,786 - tools.web_search_tool - INFO - Trying search engine: mullvad_google 2025-11-02 17:12:48,955 - primp - INFO - response: https://leta.mullvad.net/search/__data.json?q=Indian+Industrials+sector+trends+India+NSE+market+analysis+trends&engine=google&x-sveltekit-invalidated=001&country=us&lang=en 200 2025-11-02 17:12:48,958 - tools.web_search_tool - INFO - Successfully got 10 results using mullvad_google 2025-11-02 17:12:48,958 - tools.web_search_tool - INFO - Search completed successfully 2025-11-02 17:12:48,958 - agents.base_agent.research_agent - INFO - Executing planned tool [6]: generic_web_search 2025-11-02 17:12:48,958 - agents.base_agent.research_agent - INFO - Peer data missing or empty in planned results, initializing structure 2025-11-02 17:12:48,959 - agents.base_agent.research_agent - INFO - Peer data missing after planned research, gathering peer data as fallback 2025-11-02 17:12:48,959 - agents.base_agent.research_agent - INFO - Gathering peer data for IRCTC in Industrials 2025-11-02 17:12:48,959 - agents.base_agent.research_agent - WARNING - No peer symbols found for sector: Industrials 2025-11-02 17:12:48,959 - agents.base_agent.research_agent - WARNING - No peer symbols found for sector Industrials 2025-11-02 17:12:48,959 - agents.base_agent.research_agent - INFO - Agent research_agent completed task 'planned_research' for IRCTC in 1.63s (confidence: 1.00, tools: 6) 2025-11-02 17:12:48,959 - graph.multi_agent_graph - INFO - Research agent completed for IRCTC 2025-11-02 17:12:48,961 - graph.multi_agent_graph - INFO - Executing financial analysis agent for IRCTC 2025-11-02 17:12:48,961 - agents.base_agent.financial_analysis_agent - INFO - Starting financial analysis for IRCTC (Indian Railway Catering & Tourism Corporation Limited) 2025-11-02 17:12:48,961 - agents.base_agent.financial_analysis_agent - INFO - Performing financial analysis for IRCTC 2025-11-02 17:12:48,961 - agents.base_agent.financial_analysis_agent - INFO - Reusing stock_metrics from ResearchAgent 2025-11-02 17:12:48,962 - graph.multi_agent_graph - INFO - Executing management analysis agent for IRCTC 2025-11-02 17:12:48,962 - agents.base_agent.management_analysis_agent - INFO - Starting management analysis for IRCTC (Indian Railway Catering & Tourism Corporation Limited) 2025-11-02 17:12:48,962 - agents.base_agent.management_analysis_agent - INFO - Performing management analysis for IRCTC 2025-11-02 17:12:48,962 - agents.base_agent.management_analysis_agent - INFO - Reusing company_info from ResearchAgent 2025-11-02 17:12:48,962 - agents.base_agent.management_analysis_agent - INFO - Reusing company_news from ResearchAgent 2025-11-02 17:12:48,962 - agents.base_agent.management_analysis_agent - INFO - Agent management_analysis_agent completed task 'management_analysis' for IRCTC in 0.00s (confidence: 0.70, tools: 0) 2025-11-02 17:12:48,962 - graph.multi_agent_graph - INFO - Management analysis agent completed for IRCTC 2025-11-02 17:12:48,962 - graph.multi_agent_graph - INFO - Executing technical analysis agent for IRCTC 2025-11-02 17:12:48,962 - agents.base_agent.technical_analysis_agent - INFO - Starting technical analysis for IRCTC (Indian Railway Catering & Tourism Corporation Limited) 2025-11-02 17:12:48,962 - agents.base_agent.technical_analysis_agent - INFO - Performing technical analysis for IRCTC 2025-11-02 17:12:48,962 - agents.base_agent.technical_analysis_agent - INFO - Reusing stock_metrics from ResearchAgent for technical analysis 2025-11-02 17:12:48,962 - agents.base_agent.technical_analysis_agent - INFO - Agent technical_analysis_agent completed task 'technical_analysis' for IRCTC in 0.00s (confidence: 0.70, tools: 0) 2025-11-02 17:12:48,962 - graph.multi_agent_graph - INFO - Technical analysis agent completed for IRCTC 2025-11-02 17:12:48,962 - graph.multi_agent_graph - INFO - Executing valuation analysis agent for IRCTC 2025-11-02 17:12:48,962 - agents.base_agent.valuation_analysis_agent - INFO - Starting valuation analysis for IRCTC (Indian Railway Catering & Tourism Corporation Limited) 2025-11-02 17:12:48,962 - agents.base_agent.valuation_analysis_agent - INFO - Performing valuation analysis for IRCTC 2025-11-02 17:12:48,963 - agents.base_agent.valuation_analysis_agent - INFO - Reusing stock_metrics from ResearchAgent for valuation analysis 2025-11-02 17:12:48,963 - agents.base_agent.valuation_analysis_agent - INFO - Reusing market_trends from ResearchAgent 2025-11-02 17:12:48,963 - agents.base_agent.valuation_analysis_agent - INFO - Agent valuation_analysis_agent completed task 'valuation_analysis' for IRCTC in 0.00s (confidence: 0.70, tools: 0) 2025-11-02 17:12:48,963 - graph.multi_agent_graph - INFO - Valuation analysis agent completed for IRCTC 2025-11-02 17:12:51,780 - httpx - INFO - HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK" 2025-11-02 17:12:51,783 - agents.base_agent.financial_analysis_agent - INFO - Agent financial_analysis_agent completed task 'financial_analysis' for IRCTC in 2.82s (confidence: 0.70, tools: 0) 2025-11-02 17:12:51,783 - graph.multi_agent_graph - INFO - Financial analysis agent completed for IRCTC 2025-11-02 17:12:51,784 - graph.multi_agent_graph - INFO - Executing report agent for IRCTC 2025-11-02 17:12:51,784 - graph.multi_agent_graph - INFO - Report agent received results from 4/4 analysis agents 2025-11-02 17:12:51,784 - agents.base_agent.report_agent - INFO - Starting report generation for IRCTC (Indian Railway Catering & Tourism Corporation Limited) 2025-11-02 17:12:51,784 - agents.base_agent.report_agent - INFO - Generating executive summary for IRCTC 2025-11-02 17:12:51,784 - agents.base_agent.report_agent - INFO - Generating stock details for IRCTC 2025-11-02 17:12:51,784 - agents.base_agent.report_agent - INFO - Generating analysis sections 2025-11-02 17:12:51,784 - agents.base_agent.report_agent - INFO - Generating sector outlook section for sector: Industrials 2025-11-02 17:12:51,785 - agents.base_agent.report_agent - INFO - Generating peer analysis section for IRCTC 2025-11-02 17:12:51,785 - agents.base_agent.report_agent - WARNING - No peer data found for IRCTC 2025-11-02 17:12:51,785 - agents.base_agent.report_agent - INFO - Generating recommendations section 2025-11-02 17:12:51,785 - agents.base_agent.report_agent - INFO - Generating technical analysis section 2025-11-02 17:12:57,604 - httpx - INFO - HTTP Request: POST https://api.openai.com/v1/chat/completions "HTTP/1.1 200 OK" 2025-11-02 17:12:57,608 - agents.base_agent.report_agent - INFO - Generating final report for IRCTC 2025-11-02 17:12:57,609 - agents.base_agent.report_agent - INFO - Generating PDF report for IRCTC 2025-11-02 17:12:57,610 - tools.pdf_generator_tool - INFO - Starting PDF generation... 2025-11-02 17:12:57,616 - tools.pdf_generator_tool - INFO - Generating PDF: reports/stock_report_IRCTC_20251102_171257.pdf 2025-11-02 17:12:57,660 - tools.pdf_generator_tool - INFO - PDF generated successfully: reports/stock_report_IRCTC_20251102_171257.pdf 2025-11-02 17:12:57,660 - agents.base_agent.report_agent - INFO - Agent report_agent completed task 'comprehensive_report_generation' for IRCTC in 5.88s (confidence: 0.70, tools: 0) 2025-11-02 17:12:57,660 - graph.multi_agent_graph - INFO - Report agent completed for IRCTC 2025-11-02 17:12:57,661 - graph.multi_agent_graph - INFO - Completed multi-agent workflow for IRCTC in 14.97s 2025-11-02 17:12:57,661 - __main__ - INFO - Successfully generated report for IRCTC 2025-11-02 17:12:57,662 - __main__ - INFO - PDF report saved to: reports/stock_report_IRCTC_20251102_171257.pdf ============================================================ REPORT GENERATION COMPLETED ============================================================ ✅ Successfully generated report for IRCTC 📊 Company: Indian Railway Catering & Tourism Corporation Limited 🏢 Sector: Industrials ⏱️ Duration: 14.97 seconds 📄 PDF Report: reports/stock_report_IRCTC_20251102_171257.pdf 📋 Report Preview (first 500 characters): ---------------------------------------- # Stock Research Report: Indian Railway Catering & Tourism Corporation Limited (IRCTC) **Generated on:** 2025-11-02 17:12:57 **Report Type:** Comprehensive Equity Research Analysis --- ## Executive Summary **Indian Railway Catering & Tourism Corporation Limited (IRCTC)** is a Industrials sector company trading at ₹718.70 with a market capitalization of ₹575,399,985,152. **Key Metrics:** - Current Price: ₹718.70 - Market Cap: ₹575,399,985,152 - P/E Ratio: 42.91 - Target Price: ₹646.83 - Recomme... ---------------------------------------- ============================================================
Some of the report samples are attached. However, please note that these are not actual investment analysis or any recommendation. These are only for educational and personal purpose, not for commercial purpose.
The system uses OpenAI's GPT models with configurable parameters that can be adjusted in src/config.py or through environment variables:
DEFAULT_MODEL = "gpt-4o-mini" # Cost-effective, high-performance model MAX_TOKENS = 4000 # Maximum tokens per LLM request TEMPERATURE = 0.1 # Low temperature for consistent outputs
GPT-4o-mini: Selected as the default model for optimal balance between cost and performance
Alternative Models: The system can be configured to use other OpenAI models:
gpt-4o: Higher quality but increased cost and latencygpt-4-turbo: Enhanced reasoning for complex analysisgpt-3.5-turbo: Lower cost option with reduced qualityCurrent Setting: 0.1
Temperature controls the randomness of LLM outputs:
Recommendation: Keep temperature at 0.1-0.2 for financial analysis to ensure:
Current Setting: MAX_TOKENS = 4000
This parameter controls the maximum response length:
Adjustment Guidelines:
ResearchPlannerAgent:
AIResearchAgent (Iterative Mode):
In this project, we have implemented an agentic AI system consisting of multiple AI agents (3) and uses multiple tools (at least 5) to generate the stock research report. Using langgraph, clear communication and co-ordination between the agents is established.
As the submission requirement, it meets every requirement.
ResearchPlannerAgentResearchAgentFinancialAnalysisAgentManagementAnalysisAgentTechnicalAnalysisAgentValuationAnalysisAgentReportAgentAIResearchAgentAIAnalysisAgentAIReportAgentAIResearch → AIAnalysis → AIReportPlanner → Research → Analysis Agents (4) → ReportStatus: ✅ Meets requirement
MultiAgentState (Pydantic model)multi_agent_graph.py (lines 43–601)Status: ✅ Meets — Clear state-based coordination with structured data flow
MultiAgentOrchestrator class handles dynamic workflows (AI vs Structured)Status: ✅ Meets — Advanced orchestration using LangGraph
get_stock_metricsget_company_infovalidate_symbolsearch_sector_newssearch_company_newssearch_market_trendsgeneric_web_searchsearch_web_genericTechnicalAnalysisFormatterStockDataCalculatorPDFGeneratorToolReportFormatterToolSummarizerToolextract_insightssummarize_textPDFParserToolReportFetcherToolreport_formatter_helpersreport_formatter_utilsstock_data_modelsstock_data_validatorStatus: ✅ Meets — 5+ tools integrated (well beyond 3 minimum)
@tool decoratorPDFGeneratorTool, ReportFormatterTool, SummarizerTool, TechnicalAnalysisFormatter, StockDataCalculatorStatus: ✅ Meets — Hybrid approach (custom + built-in)
All tools extend functionality beyond standard LLM responses:
Status: ✅ Meets — Tools enhance LLM with live data, computation, and I/O operations
All system requirements are met.
This document provides comprehensive coverage of the Stock Report Generator system, from high-level architecture to detailed parameter configuration. The system's flexibility allows for extensive customization while maintaining robust default settings optimized for most use cases. This tool is to make life of research analysts easy. Report generated by this tool can be used as a starting point. This tool can be modified to improve the quality of research report.
For additional information, refer to:
README.md for quick start guideThe complete system is available as open-source software at:
Repository: https://github.com/devendermishra/stock-report-generator
Documentation: Comprehensive README and API documentation
License: MIT License for academic and commercial use
Support: Active community support and issue tracking
Acknowledgments: We thank the LangChain community, the open-source contributors who have made this work possible. Special thanks to OpenAI for providing access to their LLM APIs for research and development.
Funding: This work was supported by the open-source community and individual contributions.
Conflicts of Interest: The authors declare no conflicts of interest.
Data Availability: All code and documentation are publicly available under the MIT License.