ReidLCaulder/agentic-equity-researcher
Equity Research Multi-Agent System
A LangGraph-based multi-agent system for comprehensive equity research, powered by Gemini 2.5 Pro. Features an adversarial research architecture with Bull and Bear teams, a Gradio web interface, and CLI.
Quick Start
Web Interface (Gradio)
uv run python -m equity_researcher.appOpens at http://127.0.0.1:7862 with a chat interface for research queries.
Command Line Interface
uv run python -m equity_researcher.mainInteractive CLI with conversation memory.
Architecture
graph TD
User[๐ค User] --> DH[๐ฉ Desk Head]
DH -->|"Send API โก"| BullTeam
DH -->|"Send API โก"| BearTeam
subgraph BullTeam["๐ Bull Team (Subgraph)"]
BullLead[๐ Lead Analyst] -->|"Delegates"| BullRes[๐ฐ Research Agent]
BullRes --> BullSEC[๐ SEC Agent]
BullSEC -->|"Returns Findings"| BullLead
BullLead -->|"Satisfied?"| BullDecision{Decision}
BullDecision -->|"No: More Research"| BullLead
BullDecision -->|"Yes"| BullThesis[๐ Bull Thesis]
end
subgraph BearTeam["๐ป Bear Team (Subgraph)"]
BearLead[๐ Lead Analyst] -->|"Delegates"| BearRes[๐ฐ Research Agent]
BearRes --> BearSEC[๐ SEC Agent]
BearSEC -->|"Returns Findings"| BearLead
BearLead -->|"Satisfied?"| BearDecision{Decision}
BearDecision -->|"No: More Research"| BearLead
BearDecision -->|"Yes"| BearThesis[๐ Bear Thesis]
end
BullThesis --> Collect[๐ Collect Theses]
BearThesis --> Collect
Collect --> Judge[๐จโโ๏ธ Warren Buffett Judge]
Judge -->|"JudgeVerdict"| Report[๐ Final Report]
Report --> Memory[(sqlite: History)]Team Internal Flow
Each team runs as a single-pass subgraph optimized for speed (4-5x faster than iteration):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ TEAM SUBGRAPH (Single-Pass) โ
โ โ
โ START โ
โ โ โ
โ โผ โ
โ Query Generator (Pro) โโโ Generate research & SEC queries โ
โ โ โ
โ โผ โ
โ Research Agent (Flash) โโโ Execute web searches โ
โ โ โ
โ โผ โ
โ SEC Agent (Flash) โโโ Retrieve & analyze filings โ
โ โ โ
โ โผ โ
โ Synthesis Node (Pro) โโโ Full FinCoT reasoning โ
โ โ โข Uses 14k/12k char analyst prompts โ
โ โ โข Quality Constitution thresholds โ
โ โ โข Named interpretation lenses โ
โ โ โข Moat/Mortality frameworks โ
โ โผ โ
โ END โ final_thesis โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโProject Structure
equity_researcher/
โโโ app.py # Gradio web interface
โโโ main.py # CLI interface
โโโ __init__.py
โโโ agents/
โ โโโ bull_team/ # ๐ Bullish research team (placeholder)
โ โโโ bear_team/ # ๐ป Bearish research team (placeholder)
โ โโโ core/ # Orchestration & evaluation
โ โโโ judge.py # Warren Buffett-style arbitrator
โ โโโ desk_head.py # Initial briefing & context extraction
โโโ tools/
โ โโโ serper_tools.py # Web search tools (Serper API)
โ โโโ sec_tools.py # SEC EDGAR API tools
โ โโโ e2b_code.py # E2B sandboxed Python execution
โ โโโ forensics.py # (Placeholder for future)
โ โโโ openbb_tools.py # (Placeholder for future)
โโโ graph/
โ โโโ workflow.py # Main workflow with parallel Send API dispatch
โ โโโ team_subgraph.py # Team subgraph factory (Bull/Bear teams)
โ โโโ state.py # MainState, TeamState, JudgeVerdict, & models
โ โโโ checkpoint.py # Memory-based state persistence
โโโ tests/
โ โโโ test_desk_head.py # Unit tests for Desk Head
โ โโโ test_database_persistence.py # Database persistence tests
โโโ utils/
โโโ database.py # Supabase long-term memory utilitiesAgent Descriptions
๐ฉ Desk Head
Role: Initial Briefing & Context Extraction
The Desk Head is the first agent in every research workflow. It:
- Uses LLM to extract ticker symbols from any company name (works for all public companies)
- Identifies focus areas when users specify particular topics
- Queries long-term memory to load previous analyses via Supabase
- Creates a structured briefing that configures the research teams
๐ Bull Team
The Bull Team builds the ownership case using Warren Buffett-Philip Fisher methodology.
๐ Bull Synthesis (14k-char Prompt)
Uses the full Buffett-Fisher Ownership Framework:
- FinCoT Protocol: Structured Signal โ Moat Interpretation โ Durability โ Integration
- Business Quality Constitution: ROIC >15%, FCF/NI >80%, Gross Margin stability
- Named Lenses: Owner, Moat, Fisher, Durability, Margin of Safety
- Moat Types: Network Effects, Switching Costs, Cost Advantages, Intangibles, Efficient Scale
๐ฐ Bull Research Agent
Searches for quality signals: competitive moats, pricing power, market position, management reputation.
๐ Bull SEC Agent
Finds financial quality: ROIC trends, margin analysis, FCF conversion, capital allocation track record.
๐ป Bear Team
The Bear Team builds the risk case using Charlie Munger-Seth Klarman methodology.
๐ Bear Synthesis (12k-char Prompt)
Uses the full Capital Guardian Framework:
- FinCoT Protocol: Signal โ Skeptical Interpretation โ Failure Mapping โ Integration
- Forensic Accounting Constitution: CFO/NI ratios, accrual analysis, EBITDA skepticism
- Named Lenses: Klarman, Munger, Marks, Forensic, Too Hard
- Mortality Mapping: Business failure, moat decay, management failure scenarios
๐ฐ Bear Research Agent
Searches for risk factors: competitive threats, regulatory risks, short seller reports, customer churn.
๐ Bear SEC Agent
Performs forensic analysis: cash flow quality, accrual trends, related party transactions, SBC burden.
๐จโโ๏ธ Judge Agent
Role: Warren Buffett-style Arbitrator
After both teams present their theses, the Judge evaluates the arguments and delivers a final verdict on the investment opportunity.
Interfaces
Gradio Web UI (app.py)
A modern chat interface with:
- Real-time progress indicators showing which step is executing during analysis
- Parallel Bull/Bear team status with completion tracking
- Persistent conversation sessions via
thread_id - Formatted markdown output with headers and sections
- Error handling with user-friendly messages
Progress Display:
## Analyzing AAPL...
**[2/5] Research Teams** (parallel execution)
| Team | Status |
|------|--------|
| Bull | [โ] Completed |
| Bear | [...] Running |Configuration:
- Server:
127.0.0.1:7860 - Model: Gemini 3.0 Pro (temperature=0)
CLI (main.py)
An interactive terminal interface with:
- Conversation memory across queries
- Real-time processing status
- Type
quit,exit, orqto exit
Example Prompts
Research Tesla and give me a comprehensive report including recent news,
SEC filings, and financial analysis.What are Apple's latest 10-K and 10-Q filings? Summarize their financial position.Analyze Palantir and tell me the bull and bear cases.Analyze NVDA and calculate its current valuation multiples.Environment Variables
Create a .env file in the project root:
# Required
GOOGLE_API_KEY=your-gemini-api-key
SERPER_API_KEY=your-serper-api-key
# Optional
SEC_USER_AGENT=YourAppName your-email@example.com
E2B_API_KEY=your-e2b-api-key # For code execution (get from https://e2b.dev)
# Long-Term Memory (Supabase)
SUPABASE_URL=your-supabase-project-url
SUPABASE_KEY=your-supabase-anon-keyDependencies
Core dependencies from pyproject.toml:
External APIs:
- SEC EDGAR API (free, no key required)
- Serper API (requires key)
- E2B API (requires key for code execution)
- Supabase (requires URL and key for long-term memory)
Technical Details
State Management
The system uses multiple state types:
AgentState (main graph):
class AgentState(TypedDict):
messages: Annotated[list[BaseMessage], add_messages]
session_id: str
briefing: Optional[DeskHeadBriefing]
bull_thesis: Optional[str]
bear_thesis: Optional[str]
verdict: Optional[str]
next_agent: strTeamState (team subgraphs):
class TeamState(TypedDict):
briefing: DeskHeadBriefing
team_bias: Literal["bull", "bear"]
research_findings: list[str]
sec_findings: list[str]
pending_requests: list[dict]
iteration_count: int
max_iterations: int
is_satisfied: bool
final_thesis: Optional[str]Memory Architecture
Short-Term Memory:
MemorySaverfor in-memory state persistence within a session- Conversations persist via
thread_id
Long-Term Memory (Supabase):
- Stores completed analyses with key facts, verdicts, and theses
- Desk Head retrieves previous analyses for context
Workflow Routing
- Desk Head processes user input โ extracts ticker via LLM โ creates briefing
- Bull Team subgraph executes (Lead Analyst iterates with Research/SEC agents)
- Bear Team subgraph executes (same pattern)
- Judge compares theses โ renders verdict
- Results saved to long-term memory
Current Status
Completed:
- Real-Time Progress Indicator (January 2026) - Streaming progress updates during analysis
- Uses
graph.stream(stream_mode="updates")with Gradio generator pattern - Shows step-by-step progress (Desk Head โ Research Teams โ Judge โ Report)
- Parallel Bull/Bear team status with completion tracking
- Analyst Architecture Fixed (January 2026) - Full FinCoT prompts now integrated
- Bull Team: 14k-char Buffett-Fisher prompt with moat frameworks, Quality Constitution
- Bear Team: 12k-char Munger-Klarman prompt with inversion methodology, Forensic Accounting Constitution
- Named interpretation lenses (Owner, Moat, Fisher, Klarman, Marks, etc.)
- Quality scorecards and mortality mapping now generated
- Database persistence (Supabase) - Analyses now persist to long-term memory
- Desk Head briefing extraction with LLM-based ticker identification
- Parallel Bull/Bear team execution via LangGraph Send API
- Judge verdict with structured output
Future Roadmap
Planned enhancements:
- Enhanced Judge Logic: Full debate-style evaluation with rebuttals
- Forensics Tool: Deep-dive financial forensics and accounting analysis
- OpenBB Tools: Integration with OpenBB terminal for market data
- RAG Knowledge Base: ChromaDB with Buffett letters for judge decisions
