# brescou/langgraph-agent-stack architecture

> Architecture diagram of the GitHub repository brescou/langgraph-agent-stack, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/brescou/langgraph-agent-stack
- Repository: https://github.com/brescou/langgraph-agent-stack

## Overview

This repository is a self-hosted FastAPI/LangGraph agent-stack template. Its main workflow accepts a client run request, routes it to a versioned domain pack, executes agent/LLM work, and returns structured or streamed results. The README also describes sessions, human reviews, retrieval connectors, policy enforcement, and operational observability. Several links below follow the README’s architecture description; unsampled modules are represented by their documented responsibilities, without inferring unshown calls.

Main entry points: [`api/app.py`](https://github.com/brescou/langgraph-agent-stack/blob/main/api/app.py) (FastAPI App), [`domain_packs`](https://github.com/brescou/langgraph-agent-stack/tree/main/domain_packs) (Domain Packs), [`pack_kernel/registry.py`](https://github.com/brescou/langgraph-agent-stack/blob/main/pack_kernel/registry.py) (Pack Registry), [`api/endpoints/pipeline.py`](https://github.com/brescou/langgraph-agent-stack/blob/main/api/endpoints/pipeline.py) (Pipeline Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP API"]
  node_app["FastAPI App<br/>[app.py]"]
  node_pipeline["Pipeline Routes<br/>[pipeline.py]"]
  node_pack_routes["Pack Routes<br/>[router_factory.py]"]
  node_execution["Pack Execution<br/>[pack_execution.py]"]
  node_sessions["Session Routes<br/>[sessions.py]"]
  node_reviews["Review Routes<br/>[reviews.py]"]
  node_review_store[("Review Queue<br/>[review_store.py]")]
end

subgraph group_workflow["Pack Workflows"]
  node_kernel["Pack Registry<br/>[registry.py]"]
  node_packs["Domain Packs"]
end

subgraph group_foundation["Agent Foundation"]
  node_agents["Research &amp; Analysis Agents"]
  node_llm["LLM Factory<br/>[llm.py]"]
  node_memory[("Session Memory<br/>[memory.py]")]
  node_cost["Cost Tracking<br/>[cost.py]"]
  node_observability["Observability<br/>[observability.py]"]
end

subgraph group_governance["Controls"]
  node_policies["Pack Policies"]
  node_security["Security &amp; Guardrails<br/>[security.py]"]
end

subgraph group_integrations["Integrations"]
  node_connectors["Retrieval Connectors"]
end

node_client(("API Client"))
node_provider{{"LLM Provider"}}

node_client -->|"sends requests"| node_app
node_app -->|"routes requests"| node_pipeline
node_app -->|"registers pack routes"| node_pack_routes
node_app -->|"registers routes"| node_sessions
node_app -->|"registers routes"| node_reviews
node_pipeline -->|"selects workflow"| node_kernel
node_pack_routes -->|"executes runs"| node_execution
node_pack_routes -->|"selects version"| node_kernel
node_execution -->|"runs pack"| node_packs
node_kernel -->|"routes to pack"| node_packs
node_packs -->|"uses agents"| node_agents
node_agents -->|"invokes model"| node_llm
node_llm -->|"calls provider"| node_provider
node_packs -.->|"optional retrieval"| node_connectors
node_kernel -->|"applies limits"| node_policies
node_pipeline -->|"uses session history"| node_memory
node_sessions -.->|"reads session data"| node_memory
node_packs -->|"tracks run cost"| node_cost
node_app -->|"configures metrics"| node_observability
node_app -->|"adds API controls"| node_security
node_reviews -.->|"manages reviews"| node_review_store
node_execution -.->|"queues review"| node_review_store

click node_app "https://github.com/brescou/langgraph-agent-stack/blob/main/api/app.py"
click node_pipeline "https://github.com/brescou/langgraph-agent-stack/blob/main/api/endpoints/pipeline.py"
click node_pack_routes "https://github.com/brescou/langgraph-agent-stack/blob/main/api/router_factory.py"
click node_execution "https://github.com/brescou/langgraph-agent-stack/blob/main/api/pack_execution.py"
click node_sessions "https://github.com/brescou/langgraph-agent-stack/blob/main/api/endpoints/sessions.py"
click node_reviews "https://github.com/brescou/langgraph-agent-stack/blob/main/api/endpoints/reviews.py"
click node_review_store "https://github.com/brescou/langgraph-agent-stack/blob/main/core/review_store.py"
click node_kernel "https://github.com/brescou/langgraph-agent-stack/blob/main/pack_kernel/registry.py"
click node_packs "https://github.com/brescou/langgraph-agent-stack/tree/main/domain_packs"
click node_agents "https://github.com/brescou/langgraph-agent-stack/tree/main/agents"
click node_llm "https://github.com/brescou/langgraph-agent-stack/blob/main/core/llm.py"
click node_memory "https://github.com/brescou/langgraph-agent-stack/blob/main/core/memory.py"
click node_cost "https://github.com/brescou/langgraph-agent-stack/blob/main/core/cost.py"
click node_observability "https://github.com/brescou/langgraph-agent-stack/blob/main/core/observability.py"
click node_policies "https://github.com/brescou/langgraph-agent-stack/tree/main/control_plane"
click node_security "https://github.com/brescou/langgraph-agent-stack/blob/main/core/security.py"
click node_connectors "https://github.com/brescou/langgraph-agent-stack/tree/main/connectors"

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_pipeline,node_pack_routes,node_execution,node_sessions,node_reviews,node_review_store,node_client toneBlue
class node_kernel,node_packs toneAmber
class node_agents,node_llm,node_memory,node_cost,node_observability toneMint
class node_policies,node_security toneRose
class node_connectors,node_provider toneIndigo
```

## Components

### HTTP API

- [FastAPI App](https://github.com/brescou/langgraph-agent-stack/blob/main/api/app.py): `api/app.py`
- [Pipeline Routes](https://github.com/brescou/langgraph-agent-stack/blob/main/api/endpoints/pipeline.py): `api/endpoints/pipeline.py`
- [Pack Routes](https://github.com/brescou/langgraph-agent-stack/blob/main/api/router_factory.py): `api/router_factory.py`
- [Pack Execution](https://github.com/brescou/langgraph-agent-stack/blob/main/api/pack_execution.py): `api/pack_execution.py`
- [Session Routes](https://github.com/brescou/langgraph-agent-stack/blob/main/api/endpoints/sessions.py): `api/endpoints/sessions.py`
- [Review Routes](https://github.com/brescou/langgraph-agent-stack/blob/main/api/endpoints/reviews.py): `api/endpoints/reviews.py`
- [Review Queue](https://github.com/brescou/langgraph-agent-stack/blob/main/core/review_store.py): `core/review_store.py`

### Pack Workflows

- [Pack Registry](https://github.com/brescou/langgraph-agent-stack/blob/main/pack_kernel/registry.py): `pack_kernel/registry.py`
- [Domain Packs](https://github.com/brescou/langgraph-agent-stack/tree/main/domain_packs): `domain_packs`

### Agent Foundation

- [Research & Analysis Agents](https://github.com/brescou/langgraph-agent-stack/tree/main/agents): `agents`
- [LLM Factory](https://github.com/brescou/langgraph-agent-stack/blob/main/core/llm.py): `core/llm.py`
- [Session Memory](https://github.com/brescou/langgraph-agent-stack/blob/main/core/memory.py): `core/memory.py`
- [Cost Tracking](https://github.com/brescou/langgraph-agent-stack/blob/main/core/cost.py): `core/cost.py`
- [Observability](https://github.com/brescou/langgraph-agent-stack/blob/main/core/observability.py): `core/observability.py`

### Controls

- [Pack Policies](https://github.com/brescou/langgraph-agent-stack/tree/main/control_plane): `control_plane`
- [Security & Guardrails](https://github.com/brescou/langgraph-agent-stack/blob/main/core/security.py): `core/security.py`

### Integrations

- [Retrieval Connectors](https://github.com/brescou/langgraph-agent-stack/tree/main/connectors): `connectors`

### Other components

- **API Client**
- **LLM Provider**

## Connections

- API Client → FastAPI App: sends requests (evidence: `README.md`)
- FastAPI App → Pipeline Routes: routes requests (evidence: `api/app.py`)
- FastAPI App → Pack Routes: registers pack routes (evidence: `api/app.py`)
- FastAPI App → Session Routes: registers routes (evidence: `api/app.py`)
- FastAPI App → Review Routes: registers routes (evidence: `api/app.py`)
- Pipeline Routes → Pack Registry: selects workflow (evidence: `README.md`)
- Pack Routes → Pack Execution: executes runs (evidence: `api/router_factory.py`)
- Pack Routes → Pack Registry: selects version (evidence: `api/router_factory.py`)
- Pack Execution → Domain Packs: runs pack (evidence: `README.md`)
- Pack Registry → Domain Packs: routes to pack (evidence: `README.md`)
- Domain Packs → Research & Analysis Agents: uses agents (evidence: `README.md`)
- Research & Analysis Agents → LLM Factory: invokes model (evidence: `README.md`)
- LLM Factory → LLM Provider: calls provider (evidence: `core/llm.py`)
- Domain Packs → Retrieval Connectors: optional retrieval (evidence: `domain_packs/common/structured_llm.py`)
- Pack Registry → Pack Policies: applies limits (evidence: `README.md`)
- Pipeline Routes → Session Memory: uses session history (evidence: `README.md`)
- Session Routes → Session Memory: reads session data
- Domain Packs → Cost Tracking: tracks run cost (evidence: `README.md`)
- FastAPI App → Observability: configures metrics (evidence: `api/app.py`)
- FastAPI App → Security & Guardrails: adds API controls (evidence: `README.md`)
- Review Routes → Review Queue: manages reviews
- Pack Execution → Review Queue: queues review
