# pani62172/antinomai architecture

> Architecture diagram of the GitHub repository pani62172/antinomai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pani62172/antinomai
- Repository: https://github.com/pani62172/antinomai

## Overview

Antinomai is an investment-research chat platform: users submit questions, chart images, or portfolio details; the API invokes a LangGraph agent that routes requests to specialized research flows and returns a report (and, for portfolio analysis, structured holdings data). The React interface also supports voice transcription and a session-scoped research-document vault. Route coverage follows the README; some agent implementations and UI-to-vault requests were not fully excerpted, so those relationships are shown only where documented or visible.

Main entry points: [`backend/agents.py`](https://github.com/pani62172/antinomai/blob/main/backend/agents.py) (Intent router), [`backend/main.py`](https://github.com/pani62172/antinomai/blob/main/backend/main.py) (FastAPI endpoints), [`frontend/src/useChat.ts`](https://github.com/pani62172/antinomai/blob/main/frontend/src/useChat.ts) (Chat session), [`frontend/src/App.jsx`](https://github.com/pani62172/antinomai/blob/main/frontend/src/App.jsx) (Chat application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Research interface"]
  node_app["Chat application<br/>[App.jsx]"]
  node_input["Chat and uploads<br/>[ChatInput.tsx]"]
  node_chatstate["Chat session<br/>[useChat.ts]"]
  node_chatview["Conversation view<br/>[ChatWindow.tsx]"]
  node_message["Message rendering<br/>[MessageBubble.tsx]"]
  node_portfolio_view["Portfolio table<br/>[PortfolioTable.tsx]"]
  node_sidebar["Session controls<br/>[Sidebar.tsx]"]
  node_vault_ui["Vault panel<br/>[VaultPanel.jsx]"]
end

subgraph group_api["API and state"]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_state["Agent state and models<br/>[state.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
end

subgraph group_research["Research routes"]
  node_orchestrator{{"Intent router<br/>[agents.py]"}}
  node_debate["Debate panel<br/>[agents.py]"]
  node_vision["Chart analysis<br/>[agents.py]"]
  node_trivia["Quick lookups<br/>[agents.py]"]
  node_fundamental["Fundamental analysis<br/>[agents.py]"]
  node_portfolio["Portfolio analysis<br/>[agents.py]"]
  node_research_agent["Vault research<br/>[agents.py]"]
  node_tools["Market and search tools<br/>[tools.py]"]
end

subgraph group_vault["Research vault"]
  node_vault["Document ingestion and retrieval<br/>[vault.py]"]
  node_vector_store[("Vector store")]
end

node_user(("Researcher"))
node_groq["Groq models"]
node_tavily["Tavily search"]
node_market_data["Market data providers"]
node_whisper["Groq transcription"]

node_user -->|"enters query"| node_input
node_app -->|"uses state"| node_chatstate
node_app -->|"renders"| node_input
node_app -->|"renders"| node_chatview
node_app -->|"renders"| node_sidebar
node_input -->|"sends query"| node_chatstate
node_chatstate -->|"calls chat and upload"| node_api
node_chatstate -->|"checks health and clears"| node_api
node_input -->|"requests transcription"| node_whisper
node_chatview -->|"renders messages"| node_message
node_chatview -->|"renders portfolio"| node_portfolio_view
node_sidebar -->|"controls session"| node_chatstate
node_vault_ui -.->|"uses vault endpoints"| node_api
node_api -->|"invokes graph"| node_orchestrator
node_api -->|"ingests and clears documents"| node_vault
node_orchestrator -->|"uses schemas"| node_state
node_orchestrator -.->|"routes to"| node_debate
node_orchestrator -.->|"routes to"| node_vision
node_orchestrator -.->|"routes to"| node_trivia
node_orchestrator -.->|"routes to"| node_fundamental
node_orchestrator -.->|"routes to"| node_portfolio
node_orchestrator -.->|"routes to"| node_research_agent
node_debate -->|"uses research tools"| node_tools
node_trivia -.->|"uses lookup tools"| node_tools
node_fundamental -->|"fetches company data"| node_market_data
node_portfolio -->|"fetches prices and beta"| node_market_data
node_tools -.->|"queries market data"| node_market_data
node_tools -.->|"searches web"| node_tavily
node_debate -.->|"generates theses"| node_groq
node_vision -.->|"analyzes chart"| node_groq
node_research_agent -->|"retrieves context"| node_vault
node_vault -->|"stores and retrieves chunks"| node_vector_store
node_api -->|"returns SSE events"| node_chatstate
node_api -.->|"returns portfolio data"| node_portfolio_view

click node_app "https://github.com/pani62172/antinomai/blob/main/frontend/src/App.jsx"
click node_input "https://github.com/pani62172/antinomai/blob/main/frontend/src/components/ChatInput.tsx"
click node_chatstate "https://github.com/pani62172/antinomai/blob/main/frontend/src/useChat.ts"
click node_chatview "https://github.com/pani62172/antinomai/blob/main/frontend/src/components/ChatWindow.tsx"
click node_message "https://github.com/pani62172/antinomai/blob/main/frontend/src/components/MessageBubble.tsx"
click node_portfolio_view "https://github.com/pani62172/antinomai/blob/main/frontend/src/components/PortfolioTable.tsx"
click node_sidebar "https://github.com/pani62172/antinomai/blob/main/frontend/src/components/Sidebar.tsx"
click node_vault_ui "https://github.com/pani62172/antinomai/blob/main/frontend/src/components/VaultPanel.jsx"
click node_api "https://github.com/pani62172/antinomai/blob/main/backend/main.py"
click node_state "https://github.com/pani62172/antinomai/blob/main/backend/state.py"
click node_config "https://github.com/pani62172/antinomai/blob/main/backend/config.py"
click node_orchestrator "https://github.com/pani62172/antinomai/blob/main/backend/agents.py"
click node_debate "https://github.com/pani62172/antinomai/blob/main/backend/agents.py"
click node_vision "https://github.com/pani62172/antinomai/blob/main/backend/agents.py"
click node_trivia "https://github.com/pani62172/antinomai/blob/main/backend/agents.py"
click node_fundamental "https://github.com/pani62172/antinomai/blob/main/backend/agents.py"
click node_portfolio "https://github.com/pani62172/antinomai/blob/main/backend/agents.py"
click node_research_agent "https://github.com/pani62172/antinomai/blob/main/backend/agents.py"
click node_tools "https://github.com/pani62172/antinomai/blob/main/backend/tools.py"
click node_vault "https://github.com/pani62172/antinomai/blob/main/backend/vault.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_input,node_chatstate,node_chatview,node_message,node_portfolio_view,node_sidebar,node_vault_ui toneBlue
class node_api,node_state,node_config toneAmber
class node_orchestrator,node_debate,node_vision,node_trivia,node_fundamental,node_portfolio,node_research_agent,node_tools toneMint
class node_vault,node_vector_store toneRose
class node_user,node_groq,node_tavily,node_market_data,node_whisper toneIndigo
```

## Components

### Research interface

- [Chat application](https://github.com/pani62172/antinomai/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Chat and uploads](https://github.com/pani62172/antinomai/blob/main/frontend/src/components/ChatInput.tsx): `frontend/src/components/ChatInput.tsx`
- [Chat session](https://github.com/pani62172/antinomai/blob/main/frontend/src/useChat.ts): `frontend/src/useChat.ts`
- [Conversation view](https://github.com/pani62172/antinomai/blob/main/frontend/src/components/ChatWindow.tsx): `frontend/src/components/ChatWindow.tsx`
- [Message rendering](https://github.com/pani62172/antinomai/blob/main/frontend/src/components/MessageBubble.tsx): `frontend/src/components/MessageBubble.tsx`
- [Portfolio table](https://github.com/pani62172/antinomai/blob/main/frontend/src/components/PortfolioTable.tsx): `frontend/src/components/PortfolioTable.tsx`
- [Session controls](https://github.com/pani62172/antinomai/blob/main/frontend/src/components/Sidebar.tsx): `frontend/src/components/Sidebar.tsx`
- [Vault panel](https://github.com/pani62172/antinomai/blob/main/frontend/src/components/VaultPanel.jsx): `frontend/src/components/VaultPanel.jsx`

### API and state

- [FastAPI endpoints](https://github.com/pani62172/antinomai/blob/main/backend/main.py): `backend/main.py`
- [Agent state and models](https://github.com/pani62172/antinomai/blob/main/backend/state.py): `backend/state.py`
- [Runtime configuration](https://github.com/pani62172/antinomai/blob/main/backend/config.py): `backend/config.py`

### Research routes

- [Intent router](https://github.com/pani62172/antinomai/blob/main/backend/agents.py): `backend/agents.py`
- [Debate panel](https://github.com/pani62172/antinomai/blob/main/backend/agents.py): `backend/agents.py`
- [Chart analysis](https://github.com/pani62172/antinomai/blob/main/backend/agents.py): `backend/agents.py`
- [Quick lookups](https://github.com/pani62172/antinomai/blob/main/backend/agents.py): `backend/agents.py`
- [Fundamental analysis](https://github.com/pani62172/antinomai/blob/main/backend/agents.py): `backend/agents.py`
- [Portfolio analysis](https://github.com/pani62172/antinomai/blob/main/backend/agents.py): `backend/agents.py`
- [Vault research](https://github.com/pani62172/antinomai/blob/main/backend/agents.py): `backend/agents.py`
- [Market and search tools](https://github.com/pani62172/antinomai/blob/main/backend/tools.py): `backend/tools.py`

### Research vault

- [Document ingestion and retrieval](https://github.com/pani62172/antinomai/blob/main/backend/vault.py): `backend/vault.py`
- **Vector store**

### Other components

- **Researcher**
- **Groq models**
- **Tavily search**
- **Market data providers**
- **Groq transcription**

## Connections

- Researcher → Chat and uploads: enters query (evidence: `frontend/src/components/ChatInput.tsx`)
- Chat application → Chat session: uses state (evidence: `frontend/src/App.jsx`)
- Chat application → Chat and uploads: renders (evidence: `frontend/src/App.jsx`)
- Chat application → Conversation view: renders (evidence: `frontend/src/App.jsx`)
- Chat application → Session controls: renders (evidence: `frontend/src/App.jsx`)
- Chat and uploads → Chat session: sends query (evidence: `frontend/src/App.jsx`)
- Chat session → FastAPI endpoints: calls chat and upload (evidence: `frontend/src/useChat.ts`)
- Chat session → FastAPI endpoints: checks health and clears (evidence: `frontend/src/useChat.ts`)
- Chat and uploads → Groq transcription: requests transcription (evidence: `frontend/src/components/ChatInput.tsx`)
- Conversation view → Message rendering: renders messages (evidence: `frontend/src/components/ChatWindow.tsx`)
- Conversation view → Portfolio table: renders portfolio (evidence: `frontend/src/components/ChatWindow.tsx`)
- Session controls → Chat session: controls session (evidence: `frontend/src/App.jsx`)
- Vault panel → FastAPI endpoints: uses vault endpoints
- FastAPI endpoints → Intent router: invokes graph (evidence: `backend/main.py`)
- FastAPI endpoints → Document ingestion and retrieval: ingests and clears documents (evidence: `backend/main.py`)
- Intent router → Agent state and models: uses schemas (evidence: `backend/agents.py`)
- Intent router → Debate panel: routes to (evidence: `README.md`)
- Intent router → Chart analysis: routes to (evidence: `README.md`)
- Intent router → Quick lookups: routes to (evidence: `README.md`)
- Intent router → Fundamental analysis: routes to (evidence: `README.md`)
- Intent router → Portfolio analysis: routes to (evidence: `README.md`)
- Intent router → Vault research: routes to (evidence: `backend/agents.py`)
- Debate panel → Market and search tools: uses research tools (evidence: `backend/agents.py`)
- Quick lookups → Market and search tools: uses lookup tools (evidence: `README.md`)
- Fundamental analysis → Market data providers: fetches company data (evidence: `backend/agents.py`)
- Portfolio analysis → Market data providers: fetches prices and beta (evidence: `backend/agents.py`)
- Market and search tools → Market data providers: queries market data (evidence: `README.md`)
- Market and search tools → Tavily search: searches web (evidence: `README.md`)
- Debate panel → Groq models: generates theses (evidence: `README.md`)
- Chart analysis → Groq models: analyzes chart (evidence: `README.md`)
- Vault research → Document ingestion and retrieval: retrieves context (evidence: `backend/agents.py`)
- Document ingestion and retrieval → Vector store: stores and retrieves chunks (evidence: `backend/vault.py`)
- FastAPI endpoints → Chat session: returns SSE events (evidence: `frontend/src/useChat.ts`)
- FastAPI endpoints → Portfolio table: returns portfolio data (evidence: `backend/main.py`)
