A submission for the Agentic AI Developer Certification Program (Module 3)
Author: Chidambara Raju G
Version: 2.0
Project Repository: Capital Compass
This publication details the evolution of Capital Compass, a multi-agent financial research application, from its initial prototype (Module 2) into a robust, production-ready system. The focus is on the specific enhancements made in testing, safety, user interface design, and operational resilience to meet the demands of a real-world application.
The initial version of Capital Compass was developed as a proof-of-concept for an automated investment research tool. It was built on a sophisticated multi-agent architecture using LangGraph to orchestrate specialized AI agents that could reason, analyze, and synthesize a final investment report.
%%{init: { "theme": "dark", "themeVariables": { "primaryColor": "#0b1220", "primaryTextColor": "#E5E7EB", "primaryBorderColor": "#93C5FD", "lineColor": "#93C5FD", "tertiaryColor": "#111827", "fontSize": "12px", /* Slightly smaller text */ "padding": 12, /* More space inside nodes */ "nodeSpacing": 60, /* Wider horizontal spacing */ "rankSpacing": 60, /* Wider vertical spacing */ "fontFamily": "Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto" } }}%% graph TD A[Start:<br/>User Enters Ticker] --> B[Fetch:<br/>Financial Overview] A --> C[Fetch:<br/>News & Sentiment] A --> I[Fetch:<br/>Web Search] B --> D{Analyze:<br/>Financials} C --> E{Analyze:<br/>Sentiment} I --> J{Summarize:<br/>Web Research} D --> F[Balanced Review:<br/>Risk & Opportunity] E --> F J --> F F --> G[Final Synthesis:<br/>Generate Report] G --> H[End:<br/>Display Report] %% Dark-friendly styles classDef fetch fill:#0F172A,stroke:#818CF8,color:#E5E7EB,stroke-width:2px classDef websearch fill:#1E1B4B,stroke:#A5B4FC,color:#E5E7EB,stroke-width:2px classDef analyze fill:#111827,stroke:#60A5FA,color:#E5E7EB,stroke-width:2px classDef critic fill:#1F0A0A,stroke:#FCA5A5,color:#FEE2E2,stroke-width:2px classDef final fill:#052E2B,stroke:#34D399,color:#D1FAE5,stroke-width:2px classDef default fill:#0B1220,stroke:#93C5FD,color:#E5E7EB,stroke-width:1.5px class B,C fetch class I websearch class J analyze class D,E analyze class F critic class G final
📄 The full report on the initial design and architecture is available in the Module 2 publication: Capital Compass Publication
While functional, the prototype lacked the robustness required for deployment. The goal of this module was to bridge that gap by hardening the system for reliability, safety, and production readiness.
To transform Capital Compass into a production-ready application, the following four critical areas were addressed:
Professional-grade applications demand verifiable reliability. A pytest-based testing strategy was implemented covering both individual components and the full system.
tests/test_analysis_agents.py
ensure each agent processes its inputs and produces valid outputs.conftest.py
) is used for consistency.tests/test_e2e_workflow.py
runs the full LangGraph workflow with a real stock ticker.This layered approach ensures both component integrity and system-wide reliability.
Beyond basic error handling, the system was made robust against unpredictable input and API behavior.
# capital_compass/exceptions.py class APIClientError(Exception): """Custom exception for errors related to the API client.""" pass
Before hitting the backend, the Streamlit UI validates ticker input with a regex:
if not re.match(r"^[A-Z]{1,5}(\.[A-Z]{1,2})?$", ticker): st.error("Invalid ticker format...")
# tools/alpha_vantage_client.py def get_company_overview(ticker: str) -> dict: data = response.json() if not data or "Error Message" in data: raise APIClientError(f"Ticker '{ticker}' not found or is invalid.")
The Streamlit UI was refined for clarity, speed, and user trust.
import streamlit as st import re from capital_compass.graph import app # Import the compiled LangGraph app from capital_compass.exceptions import APIClientError # --- Page Configuration --- st.set_page_config( page_title="Capital Compass", page_icon="🧭", layout="wide", initial_sidebar_state="expanded", ) # --- Sidebar Content --- with st.sidebar: st.image("assets/logo.png", width=200) st.header("About Capital Compass") st.info( "Capital Compass is an AI-powered investment research tool that " "synthesizes financial data and market news to generate a comprehensive " "investment report for any given stock ticker." ) st.markdown("---") st.subheader("Technology Stack") st.markdown( """ - **UI:** Streamlit - **Orchestration:** LangGraph - **LLMs:** Groq (Multi-model) - **Data:** Alpha Vantage """ ) # --- Main Application UI --- st.title("Capital Compass 🧭") st.markdown("Your AI-powered co-pilot for investment research. Enter a stock ticker to begin.") st.info("This is an AI-generated report and should not be considered financial advice. Always conduct your own research and consult with a professional financial advisor.") # --- User Input --- ticker = st.text_input( "Enter a stock ticker symbol (e.g., AAPL, NVDA, TSLA)", value="NVDA", max_chars=10, help="Provide the ticker symbol for the company you want to analyze." ).upper() # --- Analysis Trigger --- if st.button("Generate Investment Report", type="primary"): # 1. Pre Validation: Check the ticker format before calling the API # This regex checks for 1-5 uppercase letters, optionally followed by a dot and 1-2 letters (for non-US exchanges) if not re.match(r"^[A-Z]{1,5}(\.[A-Z]{1,2})?$", ticker): st.error("Invalid ticker format. Please enter a valid stock symbol (e.g., 'AAPL', 'MSFT').") # 2. Validate non-empty input elif not ticker: st.warning("Please enter a stock ticker to proceed.") else: # 3. Run the LangGraph agent with a loading spinner with st.spinner(f"Analyzing {ticker}... This may take a moment."): try: # 4. Define the initial state and invoke the graph initial_state = {"company_ticker": ticker} final_state = app.invoke(initial_state, {"recursion_limit": 10}) # 5. Display the final report st.markdown("---") st.subheader(f"Investment Report for {ticker}") st.markdown(final_state.get("final_report", "No report was generated.")) except APIClientError as e: # 6. Handle specific API errors gracefully st.error(f"Failed to fetch data: {e}") except Exception as e: # 7. Handle other unexpected errors st.error(f"An unexpected error occurred: {e}")
Operational resilience is achieved with LangSmith integration, enabling:
Follow these steps to get a local copy running:
Clone the repository:
git clone https://github.com/ChidambaraRaju/capital-compass cd capital-compass
Create a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
Install dependencies:
pip install -r requirements.txt
Set up environment variables:
Create a .env
file in the project root with:
ALPHAVANTAGE_API_KEY="YOUR_ALPHA_VANTAGE_KEY" GROQ_API_KEY="YOUR_GROQ_API_KEY" TAVILY_API_KEY="YOUR_TAVILY_API_KEY" LANGSMITH_ENDPOINT="https://api.smith.langchain.com" LANGSMITH_API_KEY="YOUR_LANGSMITH_API_KEY" LANGSMITH_PROJECT="project-name"
Run the Streamlit app from the root directory:
streamlit run main.py
.
├── assets/
│ └── logo.png
├── capital_compass/
│ ├── agents/
│ │ ├── analysis_agents.py
│ │ └── data_fetcher.py
│ ├── tools/
│ │ ├── alpha_vantage_client.py
│ │ └── tavily_search_tool.py
│ ├── tests/
│ │ ├── conftest.py
│ │ ├── pytest.ini
│ │ ├── test_analysis_agents.py
│ │ └── test_e2e_workflow.py
│ ├── exceptions.py
│ ├── graph.py
│ └── state.py
├── .env
├── main.py
└── requirements.txt
This project is released under the MIT License.
Permission is granted, free of charge, to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of this software, provided that proper credit is given.
⚠️ Disclaimer: Capital Compass is an AI-powered research assistant. Reports are not financial advice. Always do independent research before making investment decisions.
Capital Compass evolved from a fragile prototype into a production-grade, resilient multi-agent system. Through structured testing, robust error handling, user-centric design, and operational monitoring, it now provides a dependable research companion for exploring financial markets.
This journey highlights the transformation from experimental agentic systems into deployable, user-ready applications — a crucial step for any real-world AI-powered product.
✨ Capital Compass is not just a proof-of-concept anymore. It’s a reliable compass for navigating complex financial data. 🧭