Changelog
All notable changes to this project will be documented in this file.
[Phase 6] - Earnings Call Analysis Integration
Architecture
- Two-Pipeline Design: Added a new
Earnings_Agentbacked by an offline ingest pipeline and a runtime inference pipeline, following the same separation pattern as the existing 10-K RAG system. - Ingest Layer (
core/earnings_tools.py): Fetches transcripts from Alpha Vantage (premium) or SEC 8-K filings (free fallback), normalizes them intoPrepared RemarksandQ&A Sessionsegments, extracts keyword frequency counts, and embeds everything into a dedicated ChromaDB collection. - Inference Layer: Three new
@toolfunctions βsearch_earnings_call(RAG search),get_earnings_sentiment_divergence(section comparison), andget_earnings_keyword_trends(cross-quarter keyword tracking). - Graph Extension: Added
Earnings_Agentto the LangGraphmemberslist, planner capability map, supervisor dispatch edges, and summarizer prompt.
Added
core/earnings_tools.pyβ Combined ingest + inference module for earnings-call data.scripts/ingest_earnings_calls.pyβ CLI tool for batch ingestion (--tickers AAPL --quarters Q1-2025 Q2-2025).- Earnings-call example button in the Streamlit sidebar for quick testing.
ALPHA_VANTAGE_API_KEYconfig setting in.env.exampleandcore/config.py.- Earnings Call Insights section in the Investment Memo (Summarizer) when earnings data is present.
Changed
- Planner Prompt: Extended with
Earnings_Agentcapability mapping for earnings-call queries. - Summarizer Prompt: New
## Earnings Call Insightsmemo section for divergence and keyword findings. - Streamlit Sidebar: Now detects and displays
_earningsChromaDB collections alongside_10kcollections.
[Phase 4] - Multi-Agent LangGraph Integration & SEC Pipeline Hardening
Architecture Overhaul
- Transitioned to LangGraph: Replaced the legacy
whileloop with a deterministic StateGraph "Planner-Executor" architecture. - Dual-Node Governance: Separated routing logic into a stateless
Planner(generates JSON task arrays) and a statefulSupervisor(manages task queues), eliminating LLM cognitive overload and infinite routing loops. - Separation of Concerns: Split worker capabilities into three strict React Agents:
Quant_Agent,Fundamental_Agent, andSentiment_Agent.
Added
- The "Honesty Guardrail": Implemented programmatic checks in
make_worker_nodeto verifyToolMessageexecution. If an agent attempts to answer without triggering a tool, the output is blocked to prevent hallucination. - Strict Capability Matrix: Updated the Planner prompt to explicitly map query types (e.g., "Risks", "Supply Chain") to specific RAG tool workflows.
- Broad Query Protocol: Added fallback logic for the Planner to execute standard Quant/Sentiment tasks when users ask for "general info" on a ticker.
- Pydantic Enum Enforcement: Added strict
args_schemato SEC tools usingLiteraltypes to prevent the LLM from hallucinating invalid XBRL tags.
Fixed
- The SEC "2010 Bug": The SEC API returns unordered historical data. Added Pandas-based datetime sorting, filing deduplication, and a 2-year lookback filter to ensure only modern data is served.
- The SEC "Missing Revenue" Bug: Implemented recursive fallback logic to try
RevenueFromContractWithCustomerIncludingAssessedTaxif the standardRevenuesGAAP tag returns 404 (fixing data retrieval for MSFT, AAPL, etc.). - ChromaDB Deprecation: Updated imports to
langchain_chromaand improved SEC HTML<DOCUMENT>regex parsing for cleaner 10-K embeddings.
[Phase 5] - API Streaming, Web UI & Containerization
UI & Architecture
- FastAPI Backend: Exposed the LangGraph state machine via an asynchronous
GET /chat/streamutilizing Server-Sent Events (SSE). - Streamlit Frontend: Built a responsive agentic UI (
streamlit_app.py) that visually streams the intermediate ReAct reasoning blocks into dynamically expanding dropdown menus. - State Persistence: Rewrote the UI memory loop to preserve "Agent Thoughts" sequentially so historical messages contain dropdown logs linking exactly to how the agents generated their specific conclusions.
- Docker Migration: Shipped
Dockerfile.apiandDockerfile.uibridged via a custom network insidedocker-compose.yml, successfully moving the application payload off MacOS and onto standardized, immutable infrastructure. - LLM Engine Swap: Migrated the brain architecture permanently to Groq's
llama-3.1-8b-instantandllama3-70b-versatileendpoints for incredibly fast serverless inference.
Performance & Token Thrashing Fixes
- LRU Caching: Prevented the
SentenceTransformersmodel from re-instantiating on disk during every RAG pipeline call, silencing repetitive console logs and saving heavy JVM/Python CPU overhead. - Groq 'Token Ghosting' Fix: Squashed a massive token quota error ("Requested 17k tokens") by explicitly declaring
max_tokens=800. This prevented Groq's load balancer from assuming maximum context window limits and throttling free-tier TPM budgets. - ReAct Infinite Loop Resolution: The Fundamental agent historically trapped itself looping
search_10k_filingstools when ordered to strictly "only output data". Bridged the behavior by injecting a hard "Stop once data is fetched" logic trap inside the system prompt. - Docker Hot-Reloading: Injected
- ./:/appmapping masks and explicitly overrode the Uvicorn execution loop with--reloadto support real-time Python development without tearing down the containers.
Next Steps π
- Final push of the
finagentbackend/frontend images to Google Cloud Run.