System Architecture & Context

🤖 AI Context Prompt

Copy this to your LLM when working on AI Hedge Fund:

Prompt
"I'm working on AI Hedge Fund project - a multi-agent investment simulation system.
 
ARCHITECTURE:
- src/agents/ = 18 AI agents (12 investor styles + 6 functional)
- src/graph/state.py = AgentState (shared memory between agents)
- src/backtester.py = Historical performance testing
- app/backend/ = FastAPI server (routes/, services/, database/)
- app/frontend/ = React visual builder (components/, contexts/)
 
KEY CONCEPTS:
- AgentState = shared data structure with messages/data/metadata
- Data flow: Market Data → Agents → AgentState → Risk Manager → Portfolio Manager → Decision
- Risk Manager always runs before final decisions (mandatory)
- Visual builder lets users drag/drop agents to create strategies
 
CORE FILES:
- Agent logic: src/agents/[name].py
- Web UI: app/frontend/src/components/Flow.tsx
- API routes: app/backend/routes/
- Data fetching: src/tools/api.py
- LLM calls: src/utils/llm.py
 
COMMON TASKS:
- New agent: Copy existing agent file, modify analysis + prompt
- UI changes: Edit app/frontend/src/components/
- API changes: Edit app/backend/routes/
- Risk rules: Edit src/agents/risk_manager.py
 
Please help me with [SPECIFIC TASK]."

📖 User Guide

Core Architecture

src/agents/          # 18 AI agents (Warren Buffett, Michael Burry, etc.)
src/graph/state.py   # AgentState - shared memory between agents
src/backtester.py    # Historical performance testing
src/tools/api.py     # Financial data fetching
app/backend/         # FastAPI server (routes/, services/, database/)
app/frontend/        # React visual builder (components/, contexts/)

Code Map - Where to Find What

Want to understand…Look at…
How agents worksrc/agents/*.py
Agent coordinationsrc/graph/state.py
Web UI componentsapp/frontend/src/components/
API endpointsapp/backend/routes/
Data fetchingsrc/tools/api.py
Backtesting logicsrc/backtester.py
Database modelsapp/backend/database/models.py
LLM integrationsrc/utils/llm.py