# corentin-tin/langgraph-agent-templates architecture

> Architecture diagram of the GitHub repository corentin-tin/langgraph-agent-templates, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/corentin-tin/langgraph-agent-templates
- Repository: https://github.com/corentin-tin/langgraph-agent-templates

## Overview

##### Project type and purpose
- This is a full-stack microservices template repo for two AI-agent services (React Agent, RAG Agent) plus shared libraries, optimized for Docker Compose and Kubernetes deployment.
- The agents are FastAPI servers implementing LangGraph graphs (ReAct and RAG patterns) and rely on external LLMs, tool APIs, and vector stores.

##### Main components
a. Agents (Microservices)
- React Agent
- FastAPI server (server.py)
- Core graph (graph.py), state & utils (prompts, nodes, tools)
- External tool integrations: web search (Tavily), LLM providers
- RAG Agent
- FastAPI server (server.py)
- Multi-graph modules (indexing, retrieval, planning)
- Vector store connectors (Elasticsearch, Pinecone, MongoDB, FAISS), LLM providers
b. Shared Package
- packages/shared
- Logging, settings, types used by both agents
c. External Dependencies
- LLM Providers (OpenAI, Anthropic, Fireworks)
- Tool APIs (Tavily)
- Vector Stores (Elasticsearch, Pinecone, MongoDB, FAISS)
- Optional: Redis (caching)
d. Deployment Infrastructure
- Docker Compose
- react-agent, rag-agent, optional elasticsearch, redis services
- Kubernetes
- Namespace, Deployments, Services, Ingress for each agent
- CI/CD (GitHub Actions workflows)
e. Client / User Interfaces
- LangGraph Studio (web UI connecting to agents)
- Direct API clients (curl / Postman)

##### Relationships & Data Flows
- Clients → Ingress → Service (React/RAG Agent)
- Agents → Shared library (internal call)
- Agents → External LLMs & Tool APIs (HTTP/SDK calls)
- RAG Agent → Vector Stores (REST or SDK)
- Optional: Agents ↔ Redis cache
- CI/CD → Docker build & push → Kubernetes registry → Deploy
- Docker Compose orchestrates local multi-container setup

##### Architectural patterns & principles
- Microservices: each agent runs as an independent container/service
- Modular code: shared utilities extracted to a separate package
- Graph pattern: core logic expressed as LangGraph graphs (nodes, state machines)
- Infrastructure as code: docker-compose.yml and k8s manifests
- CI/CD pipeline automates testing, linting, deployment

##### Final checklist
- Grouping boundaries for Docker Compose and Kubernetes environments

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Clients Layer
    subgraph "Clients"
        LGStudio["LangGraph Studio"]:::external
        APIClient["API Clients (curl/Postman)"]:::external
    end
    LGStudio -->|HTTP| Ingress
    APIClient -->|HTTP| Ingress

    %% Ingress Points
    Ingress["Ingress"]:::infra

    %% Local Development Environment
    subgraph "Docker Compose Environment"
        direction TB
        Compose["docker-compose.yml"]:::infra
        ReactDocker["react-agent"]:::service
        RAGDocker["rag-agent"]:::service
        Elasticsearch["Elasticsearch"]:::external
        Redis["Redis (optional)"]:::external

        Compose --> ReactDocker
        Compose --> RAGDocker
        Compose --> Elasticsearch
        Compose --> Redis
    end

    %% Kubernetes Production Cluster
    subgraph "Kubernetes Cluster"
        direction TB
        Namespace["Namespace"]:::infra

        subgraph "Deployments"
            RAdep["React Agent Deployment"]:::infra
            RAGdep["RAG Agent Deployment"]:::infra
        end
        subgraph "Services"
            RAserv["React Agent Service"]:::infra
            RAGserv["RAG Agent Service"]:::infra
        end
        subgraph "Ingress"
            RAing["React Agent Ingress"]:::infra
            RAGing["RAG Agent Ingress"]:::infra
        end

        Namespace --> RAdep --> RAserv --> RAing
        Namespace --> RAGdep --> RAGserv --> RAGing
    end

    %% React Agent Components
    subgraph "React Agent Components"
        ReactServer["React Agent Server"]:::service
        ReactGraph["React Agent Graph"]:::service
        ReactState["React Agent State"]:::service
        ReactUtils["React Agent Utils"]:::service

        ReactServer --> ReactGraph
        ReactServer --> ReactState
        ReactServer --> ReactUtils
        ReactServer --> SharedPackage
        ReactServer --> Tavily["Tavily API"]:::external
        ReactServer --> LLM["LLM Providers"]:::external
    end
    Ingress --> ReactServer

    %% RAG Agent Components
    subgraph "RAG Agent Components"
        RAGServer["RAG Agent Server"]:::service
        RAGGraph["RAG Agent Graph"]:::service
        RAGUtils["RAG Agent Utils"]:::service

        RAGServer --> RAGGraph
        RAGServer --> RAGUtils
        RAGServer --> SharedPackage
        RAGServer --> LLM
        RAGServer --> Elastic["Elasticsearch"]:::external
        RAGServer --> Pinecone["Pinecone"]:::external
        RAGServer --> Mongo["MongoDB"]:::external
        RAGServer --> FAISS["FAISS"]:::external
    end
    Ingress --> RAGServer

    %% Shared Package
    subgraph "Shared Package" 
        SharedPackage["packages/shared"]:::shared
        Logging["Logging Utilities"]:::shared
        Settings["Application Settings"]:::shared
        Types["Common Types"]:::shared

        SharedPackage --> Logging
        SharedPackage --> Settings
        SharedPackage --> Types
    end

    %% CI/CD Pipeline
    CI["CI/CD Workflows"]:::infra
    Registry["Container Registry"]:::infra
    CI -->|build & push| Registry
    Registry -->|deploy| Namespace

    %% Click Events
    click ReactServer "https://github.com/corentin-tin/langgraph-agent-templates/blob/main/apps/react_agent/src/react_agent/server.py"
    click ReactGraph "https://github.com/corentin-tin/langgraph-agent-templates/blob/main/apps/react_agent/src/react_agent/graph.py"
    click ReactState "https://github.com/corentin-tin/langgraph-agent-templates/blob/main/apps/react_agent/src/react_agent/state.py"
    click ReactUtils "https://github.com/corentin-tin/langgraph-agent-templates/tree/main/apps/react_agent/src/react_agent/utils/"
    click RAGServer "https://github.com/corentin-tin/langgraph-agent-templates/blob/main/apps/rag_agent/src/rag_agent/server.py"
    click RAGGraph "https://github.com/corentin-tin/langgraph-agent-templates/blob/main/apps/rag_agent/src/rag_agent/graph.py"
    click RAGUtils "https://github.com/corentin-tin/langgraph-agent-templates/tree/main/apps/rag_agent/src/rag_agent/utils/"
    click Logging "https://github.com/corentin-tin/langgraph-agent-templates/blob/main/packages/shared/src/shared/logging.py"
    click Settings "https://github.com/corentin-tin/langgraph-agent-templates/blob/main/packages/shared/src/shared/settings.py"
    click Types "https://github.com/corentin-tin/langgraph-agent-templates/blob/main/packages/shared/src/shared/types.py"
    click Compose "https://github.com/corentin-tin/langgraph-agent-templates/blob/main/docker-compose.yml"
    click Namespace "https://github.com/corentin-tin/langgraph-agent-templates/blob/main/k8s/namespace.yaml"
    click RAdep "https://github.com/corentin-tin/langgraph-agent-templates/blob/main/k8s/react-agent/deployment.yaml"
    click RAserv "https://github.com/corentin-tin/langgraph-agent-templates/blob/main/k8s/react-agent/service.yaml"
    click RAing "https://github.com/corentin-tin/langgraph-agent-templates/blob/main/k8s/react-agent/ingress.yaml"
    click RAGdep "https://github.com/corentin-tin/langgraph-agent-templates/blob/main/k8s/rag-agent/deployment.yaml"
    click RAGserv "https://github.com/corentin-tin/langgraph-agent-templates/blob/main/k8s/rag-agent/service.yaml"
    click RAGing "https://github.com/corentin-tin/langgraph-agent-templates/blob/main/k8s/rag-agent/ingress.yaml"
    click CI "https://github.com/corentin-tin/langgraph-agent-templates/blob/main/.github/workflows/claude.yml"

    %% Styles
    classDef service fill:#E3F2FD,stroke:#90CAF9;
    classDef shared fill:#FFF3E0,stroke:#FFB74D;
    classDef external fill:#E8F5E9,stroke:#66BB6A;
    classDef infra fill:#E0E0E0,stroke:#BDBDBD;
```
