# maysamsgx/fagenllm_2026_semmmrr architecture

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

- Interactive diagram: https://gitdiagram.com/maysamsgx/fagenllm_2026_semmmrr
- Repository: https://github.com/maysamsgx/fagenllm_2026_semmmrr

## Overview

FAgentLLM is a finance intelligence application with a React dashboard and a FastAPI/LangGraph backend. Users inspect finance domains, submit or process invoices, run reconciliation and related assessments, and review governed decisions and their traces. The backend routes domain requests into a shared multi-agent graph, which coordinates specialized agents and persists decisions and causal links. The README documents additional OCR, memory, evaluation, and dispute-resolution capabilities; these are included where the tree supports them. Some frontend-to-backend endpoint mappings and unsampled subsystem internals are not verified, so those links are dashed.

Main entry points: [`orchestration/agents/graph.py`](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/orchestration/agents/graph.py) (Agent Graph), [`App.tsx`](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/App.tsx) (Dashboard Shell), [`lib/api.ts`](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/lib/api.ts) (API Client), [`execution/db/supabase_client.py`](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/execution/db/supabase_client.py) (Supabase Data Access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Finance Dashboard"]
  node_app["Dashboard Shell<br/>[App.tsx]"]
  node_invoice_ui["Invoice Workspace<br/>[InvoiceView.tsx]"]
  node_recon_ui["Reconciliation Workspace"]
  node_cash_budget_ui["Cash and Budget<br/>[CashView.tsx]"]
  node_credit_ui["Credit and Disputes<br/>[CreditView.tsx]"]
  node_eval_ui["Evaluation Dashboard<br/>[EvaluationView.tsx]"]
  node_governance_ui["Governance Workspace<br/>[GovernanceView.tsx]"]
  node_trace_ui["Decision Traces<br/>[TracePanel.tsx]"]
  node_api_client["API Client<br/>[api.ts]"]
  node_realtime["Realtime Updates<br/>[useRealtime.ts]"]
end

subgraph group_api["API Routing"]
  node_service["FastAPI Application<br/>[main.py]"]
  node_invoice_route["Invoice Routes<br/>[invoice.py]"]
  node_finance_routes["Finance Domain Routes"]
  node_governance_route["Governance Routes<br/>[governance.py]"]
end

subgraph group_agents["Finance Agents"]
  node_graph["Agent Graph<br/>[graph.py]"]
  node_state["Shared Financial State<br/>[state.py]"]
  node_invoice_agent["Invoice Agent<br/>[invoice_agent.py]"]
  node_budget_cash_agents["Budget and Cash Agents"]
  node_recon_agent["Reconciliation Agent"]
  node_credit_agent["Credit Agent<br/>[credit_agent.py]"]
  node_governance_agent["Governance Auditor"]
end

subgraph group_policy["Reasoning Controls"]
  node_directive["Policies and Prompts<br/>[policies.py]"]
  node_llm["LLM and OCR Services<br/>[llm.py]"]
end

subgraph group_platform["Data and Evaluation"]
  node_db_client["Supabase Data Access<br/>[supabase_client.py]"]
  node_supabase[("Supabase Database<br/>[config.py]")]
  node_evaluation["Evaluation Metrics<br/>[evaluator.py]"]
end

node_user(("Finance User"))
node_external_models(("LLM and OCR Providers"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_invoice_ui
node_app -->|"renders"| node_cash_budget_ui
node_app -->|"renders"| node_recon_ui
node_app -->|"renders"| node_credit_ui
node_app -->|"renders"| node_eval_ui
node_app -->|"renders"| node_governance_ui
node_invoice_ui -->|"requests"| node_api_client
node_recon_ui -->|"requests"| node_api_client
node_cash_budget_ui -->|"requests"| node_api_client
node_credit_ui -->|"requests"| node_api_client
node_eval_ui -->|"requests"| node_api_client
node_credit_ui -->|"uses"| node_trace_ui
node_recon_ui -->|"uses"| node_trace_ui
node_invoice_ui -->|"uses"| node_trace_ui
node_api_client -.->|"HTTP requests"| node_invoice_route
node_api_client -.->|"HTTP requests"| node_finance_routes
node_service -->|"registers"| node_invoice_route
node_service -->|"registers"| node_finance_routes
node_service -->|"registers"| node_governance_route
node_invoice_route -->|"invokes"| node_graph
node_finance_routes -->|"invokes"| node_graph
node_graph -->|"dispatches"| node_invoice_agent
node_graph -->|"dispatches"| node_budget_cash_agents
node_graph -->|"dispatches"| node_recon_agent
node_graph -->|"dispatches"| node_credit_agent
node_graph -->|"dispatches"| node_governance_agent
node_graph -->|"routes with"| node_state
node_invoice_agent -->|"reads and writes"| node_db_client
node_budget_cash_agents -->|"reads and writes"| node_db_client
node_recon_agent -->|"reads and writes"| node_db_client
node_invoice_agent -->|"uses policies"| node_directive
node_budget_cash_agents -->|"uses policies"| node_directive
node_invoice_agent -->|"calls"| node_llm
node_recon_agent -->|"calls"| node_llm
node_llm -.->|"requests inference"| node_external_models
node_db_client -->|"queries"| node_supabase
node_realtime -->|"subscribes"| node_supabase
node_evaluation -->|"evaluates"| node_graph
node_evaluation -->|"reads data"| node_db_client
node_governance_route -->|"reads data"| node_db_client

click node_app "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/App.tsx"
click node_invoice_ui "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/components/InvoiceView.tsx"
click node_recon_ui "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/components/ReconciliationView.tsx"
click node_cash_budget_ui "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/components/CashView.tsx"
click node_credit_ui "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/components/CreditView.tsx"
click node_eval_ui "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/components/EvaluationView.tsx"
click node_governance_ui "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/components/GovernanceView.tsx"
click node_trace_ui "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/components/TracePanel.tsx"
click node_api_client "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/lib/api.ts"
click node_realtime "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/lib/useRealtime.ts"
click node_service "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/main.py"
click node_invoice_route "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/orchestration/routers/invoice.py"
click node_finance_routes "https://github.com/maysamsgx/fagenllm_2026_semmmrr/tree/main/orchestration/routers"
click node_governance_route "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/orchestration/routers/governance.py"
click node_graph "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/orchestration/agents/graph.py"
click node_state "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/orchestration/agents/state.py"
click node_invoice_agent "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/orchestration/agents/invoice_agent.py"
click node_budget_cash_agents "https://github.com/maysamsgx/fagenllm_2026_semmmrr/tree/main/orchestration/agents"
click node_recon_agent "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/orchestration/agents/reconciliation_agent.py"
click node_credit_agent "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/orchestration/agents/credit_agent.py"
click node_governance_agent "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/orchestration/agents/governance_agent.py"
click node_directive "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/directive/policies.py"
click node_llm "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/execution/llm.py"
click node_db_client "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/execution/db/supabase_client.py"
click node_supabase "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/config.py"
click node_evaluation "https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/evaluation/evaluator.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_invoice_ui,node_recon_ui,node_cash_budget_ui,node_credit_ui,node_eval_ui,node_governance_ui,node_trace_ui,node_api_client,node_realtime,node_user toneBlue
class node_service,node_invoice_route,node_finance_routes,node_governance_route toneAmber
class node_graph,node_state,node_invoice_agent,node_budget_cash_agents,node_recon_agent,node_credit_agent,node_governance_agent toneMint
class node_directive,node_llm toneRose
class node_db_client,node_supabase,node_evaluation,node_external_models toneIndigo
```

## Components

### Finance Dashboard

- [Dashboard Shell](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/App.tsx): `App.tsx`
- [Invoice Workspace](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/components/InvoiceView.tsx): `components/InvoiceView.tsx`
- [Reconciliation Workspace](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/components/ReconciliationView.tsx): `components/ReconciliationView.tsx`
- [Cash and Budget](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/components/CashView.tsx): `components/CashView.tsx`
- [Credit and Disputes](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/components/CreditView.tsx): `components/CreditView.tsx`
- [Evaluation Dashboard](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/components/EvaluationView.tsx): `components/EvaluationView.tsx`
- [Governance Workspace](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/components/GovernanceView.tsx): `components/GovernanceView.tsx`
- [Decision Traces](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/components/TracePanel.tsx): `components/TracePanel.tsx`
- [API Client](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/lib/api.ts): `lib/api.ts`
- [Realtime Updates](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/lib/useRealtime.ts): `lib/useRealtime.ts`

### API Routing

- [FastAPI Application](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/main.py): `main.py`
- [Invoice Routes](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/orchestration/routers/invoice.py): `orchestration/routers/invoice.py`
- [Finance Domain Routes](https://github.com/maysamsgx/fagenllm_2026_semmmrr/tree/main/orchestration/routers): `orchestration/routers`
- [Governance Routes](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/orchestration/routers/governance.py): `orchestration/routers/governance.py`

### Finance Agents

- [Agent Graph](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/orchestration/agents/graph.py): `orchestration/agents/graph.py`
- [Shared Financial State](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/orchestration/agents/state.py): `orchestration/agents/state.py`
- [Invoice Agent](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/orchestration/agents/invoice_agent.py): `orchestration/agents/invoice_agent.py`
- [Budget and Cash Agents](https://github.com/maysamsgx/fagenllm_2026_semmmrr/tree/main/orchestration/agents): `orchestration/agents`
- [Reconciliation Agent](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/orchestration/agents/reconciliation_agent.py): `orchestration/agents/reconciliation_agent.py`
- [Credit Agent](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/orchestration/agents/credit_agent.py): `orchestration/agents/credit_agent.py`
- [Governance Auditor](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/orchestration/agents/governance_agent.py): `orchestration/agents/governance_agent.py`

### Reasoning Controls

- [Policies and Prompts](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/directive/policies.py): `directive/policies.py`
- [LLM and OCR Services](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/execution/llm.py): `execution/llm.py`

### Data and Evaluation

- [Supabase Data Access](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/execution/db/supabase_client.py): `execution/db/supabase_client.py`
- [Supabase Database](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/config.py): `config.py`
- [Evaluation Metrics](https://github.com/maysamsgx/fagenllm_2026_semmmrr/blob/main/evaluation/evaluator.py): `evaluation/evaluator.py`

### Other components

- **Finance User**
- **LLM and OCR Providers**

## Connections

- Finance User → Dashboard Shell: uses (evidence: `App.tsx`)
- Dashboard Shell → Invoice Workspace: renders (evidence: `App.tsx`)
- Dashboard Shell → Cash and Budget: renders (evidence: `App.tsx`)
- Dashboard Shell → Reconciliation Workspace: renders (evidence: `App.tsx`)
- Dashboard Shell → Credit and Disputes: renders (evidence: `App.tsx`)
- Dashboard Shell → Evaluation Dashboard: renders (evidence: `App.tsx`)
- Dashboard Shell → Governance Workspace: renders (evidence: `App.tsx`)
- Invoice Workspace → API Client: requests (evidence: `components/InvoiceView.tsx`)
- Reconciliation Workspace → API Client: requests (evidence: `components/ReconciliationView.tsx`)
- Cash and Budget → API Client: requests (evidence: `components/CashView.tsx`)
- Credit and Disputes → API Client: requests (evidence: `components/CreditView.tsx`)
- Evaluation Dashboard → API Client: requests (evidence: `components/EvaluationView.tsx`)
- Credit and Disputes → Decision Traces: uses (evidence: `components/CreditView.tsx`)
- Reconciliation Workspace → Decision Traces: uses (evidence: `components/ReconciliationView.tsx`)
- Invoice Workspace → Decision Traces: uses (evidence: `components/InvoiceView.tsx`)
- API Client → Invoice Routes: HTTP requests
- API Client → Finance Domain Routes: HTTP requests
- FastAPI Application → Invoice Routes: registers (evidence: `main.py`)
- FastAPI Application → Finance Domain Routes: registers (evidence: `main.py`)
- FastAPI Application → Governance Routes: registers (evidence: `main.py`)
- Invoice Routes → Agent Graph: invokes (evidence: `orchestration/routers/invoice.py`)
- Finance Domain Routes → Agent Graph: invokes (evidence: `orchestration/routers/budget.py`)
- Agent Graph → Invoice Agent: dispatches (evidence: `orchestration/agents/graph.py`)
- Agent Graph → Budget and Cash Agents: dispatches (evidence: `orchestration/agents/graph.py`)
- Agent Graph → Reconciliation Agent: dispatches (evidence: `orchestration/agents/graph.py`)
- Agent Graph → Credit Agent: dispatches (evidence: `orchestration/agents/graph.py`)
- Agent Graph → Governance Auditor: dispatches (evidence: `orchestration/agents/graph.py`)
- Agent Graph → Shared Financial State: routes with (evidence: `orchestration/agents/graph.py`)
- Invoice Agent → Supabase Data Access: reads and writes (evidence: `orchestration/agents/invoice_agent.py`)
- Budget and Cash Agents → Supabase Data Access: reads and writes (evidence: `orchestration/agents/cash_agent.py`)
- Reconciliation Agent → Supabase Data Access: reads and writes (evidence: `orchestration/agents/reconciliation_agent.py`)
- Invoice Agent → Policies and Prompts: uses policies (evidence: `orchestration/agents/invoice_agent.py`)
- Budget and Cash Agents → Policies and Prompts: uses policies (evidence: `orchestration/agents/cash_agent.py`)
- Invoice Agent → LLM and OCR Services: calls (evidence: `orchestration/agents/invoice_agent.py`)
- Reconciliation Agent → LLM and OCR Services: calls (evidence: `orchestration/agents/reconciliation_agent.py`)
- LLM and OCR Services → LLM and OCR Providers: requests inference
- Supabase Data Access → Supabase Database: queries (evidence: `execution/db/supabase_client.py`)
- Realtime Updates → Supabase Database: subscribes (evidence: `lib/useRealtime.ts`)
- Evaluation Metrics → Agent Graph: evaluates (evidence: `evaluation/evaluator.py`)
- Evaluation Metrics → Supabase Data Access: reads data (evidence: `evaluation/evaluator.py`)
- Governance Routes → Supabase Data Access: reads data (evidence: `orchestration/routers/governance.py`)
