# martinpercu/langchain-langgraph_agents-structure architecture

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

- Interactive diagram: https://gitdiagram.com/martinpercu/langchain-langgraph_agents-structure
- Repository: https://github.com/martinpercu/langchain-langgraph_agents-structure

## Overview

This repository is a LangGraph/LangChain agent template. Its main user-to-result path is a FastAPI chat request invoking the support-agent graph, which extracts customer details, routes to conversation or booking, and returns a response; an alternate API setup adds PostgreSQL checkpointing. Separate agent modules demonstrate RAG, ReAct, and other workflow patterns. The support-agent graph and API wiring are shown in source excerpts; broader example capabilities are documented in the README, so their internal flows are not inferred.

Main entry points: [`src/agents/support_agent/support_agent.py`](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/support_agent.py) (Support Graph), [`src/agents/support_agent/nodes/extractor/node.py`](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/nodes/extractor/node.py) (Customer Extractor), [`src/agents/support_agent/routes/intention/route.py`](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/routes/intention/route.py) (Intent Router), [`src/agents/support_agent/nodes/conversation/node.py`](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/nodes/conversation/node.py) (Conversation Node)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and Persistence"]
  node_api_basic["Chat API<br/>[main.py]"]
  node_api_persistent["Persistent Chat API<br/>[main-2.py]"]
  node_checkpoint["Checkpoint Lifecycle<br/>[db.py]"]
end

subgraph group_support["Support Agent"]
  node_agent["Support Graph<br/>[support_agent.py]"]
  node_state["Conversation State<br/>[state.py]"]
  node_extractor["Customer Extractor<br/>[node.py]"]
  node_extract_prompt["Extraction Prompt<br/>[prompt.py]"]
  node_router["Intent Router<br/>[route.py]"]
  node_route_prompt["Routing Prompt<br/>[prompt.py]"]
  node_conversation["Conversation Node<br/>[node.py]"]
  node_conversation_prompt["Conversation Prompt<br/>[prompt.py]"]
  node_booking["Booking Agent<br/>[node.py]"]
  node_booking_prompt["Booking Prompt<br/>[prompt.py]"]
  node_booking_tools["Appointment Tools<br/>[tools.py]"]
end

subgraph group_examples["Workflow Examples"]
  node_basic["Basic Agent<br/>[simple.py]"]
  node_messages["Message Agent<br/>[simple-message.py]"]
  node_llm["LLM Agent<br/>[simple-llm.py]"]
  node_rag["RAG Agent<br/>[rag-basic.py]"]
  node_rag_chain["RAG Chaining"]
  node_rag_structured["Structured RAG"]
  node_react["ReAct Agent<br/>[react.py]"]
  node_orchestrator["Orchestrator Workflow<br/>[orchestrator.py]"]
  node_evaluator["Evaluator Optimizer"]
  node_coder["Coder Checker<br/>[coder_checker.py]"]
end

subgraph group_integrations["External Services"]
  node_postgres[("PostgreSQL")]
  node_llm_service{{"LLM Providers"}}
end

node_user(("Chat User"))

node_user -->|"sends chat"| node_api_basic
node_api_basic -->|"invokes graph"| node_agent
node_user -->|"sends chat"| node_api_persistent
node_api_persistent -->|"builds and invokes"| node_agent
node_api_persistent -->|"requests checkpointer"| node_checkpoint
node_checkpoint -->|"persists checkpoints"| node_postgres
node_agent -->|"starts with"| node_extractor
node_agent -->|"routes after extraction"| node_router
node_agent -->|"routes to"| node_conversation
node_agent -->|"routes to"| node_booking
node_extractor -->|"reads and updates"| node_state
node_conversation -->|"reads messages"| node_state
node_extractor -->|"uses prompt"| node_extract_prompt
node_router -->|"reads messages"| node_state
node_router -->|"uses prompt"| node_route_prompt
node_conversation -->|"uses prompt"| node_conversation_prompt
node_booking -->|"registers tools"| node_booking_tools
node_booking -->|"uses prompt"| node_booking_prompt
node_extractor -.->|"calls model"| node_llm_service
node_router -.->|"calls model"| node_llm_service
node_conversation -.->|"calls model"| node_llm_service
node_basic -.->|"uses model"| node_llm_service
node_messages -.->|"uses model"| node_llm_service
node_llm -.->|"uses model"| node_llm_service
node_rag -.->|"uses model"| node_llm_service
node_rag_chain -.->|"uses model"| node_llm_service
node_rag_structured -.->|"uses model"| node_llm_service
node_react -.->|"uses model"| node_llm_service
node_orchestrator -.->|"uses model"| node_llm_service
node_evaluator -.->|"uses model"| node_llm_service
node_coder -.->|"uses model"| node_llm_service

click node_api_basic "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/api/main.py"
click node_api_persistent "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/api/main-2.py"
click node_checkpoint "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/api/db.py"
click node_agent "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/support_agent.py"
click node_state "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/state.py"
click node_extractor "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/nodes/extractor/node.py"
click node_extract_prompt "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/nodes/extractor/prompt.py"
click node_router "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/routes/intention/route.py"
click node_route_prompt "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/routes/intention/prompt.py"
click node_conversation "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/nodes/conversation/node.py"
click node_conversation_prompt "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/nodes/conversation/prompt.py"
click node_booking "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/nodes/booking/node.py"
click node_booking_prompt "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/nodes/booking/prompt.py"
click node_booking_tools "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/nodes/booking/tools.py"
click node_basic "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/simple.py"
click node_messages "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/simple-message.py"
click node_llm "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/simple-llm.py"
click node_rag "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/rag-basic.py"
click node_rag_chain "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/rag-basic-chaining.py"
click node_rag_structured "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/rag-basic-structured-message.py"
click node_react "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/react.py"
click node_orchestrator "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/orchestrator.py"
click node_evaluator "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/evaluator_optimizer_joke.py"
click node_coder "https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/coder_checker.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_api_basic,node_api_persistent,node_checkpoint,node_user toneBlue
class node_agent,node_state,node_extractor,node_extract_prompt,node_router,node_route_prompt,node_conversation,node_conversation_prompt,node_booking,node_booking_prompt,node_booking_tools toneAmber
class node_basic,node_messages,node_llm,node_rag,node_rag_chain,node_rag_structured,node_react,node_orchestrator,node_evaluator,node_coder toneMint
class node_postgres,node_llm_service toneRose
```

## Components

### API and Persistence

- [Chat API](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/api/main.py): `src/api/main.py`
- [Persistent Chat API](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/api/main-2.py): `src/api/main-2.py`
- [Checkpoint Lifecycle](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/api/db.py): `src/api/db.py`

### Support Agent

- [Support Graph](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/support_agent.py): `src/agents/support_agent/support_agent.py`
- [Conversation State](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/state.py): `src/agents/support_agent/state.py`
- [Customer Extractor](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/nodes/extractor/node.py): `src/agents/support_agent/nodes/extractor/node.py`
- [Extraction Prompt](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/nodes/extractor/prompt.py): `src/agents/support_agent/nodes/extractor/prompt.py`
- [Intent Router](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/routes/intention/route.py): `src/agents/support_agent/routes/intention/route.py`
- [Routing Prompt](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/routes/intention/prompt.py): `src/agents/support_agent/routes/intention/prompt.py`
- [Conversation Node](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/nodes/conversation/node.py): `src/agents/support_agent/nodes/conversation/node.py`
- [Conversation Prompt](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/nodes/conversation/prompt.py): `src/agents/support_agent/nodes/conversation/prompt.py`
- [Booking Agent](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/nodes/booking/node.py): `src/agents/support_agent/nodes/booking/node.py`
- [Booking Prompt](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/nodes/booking/prompt.py): `src/agents/support_agent/nodes/booking/prompt.py`
- [Appointment Tools](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/support_agent/nodes/booking/tools.py): `src/agents/support_agent/nodes/booking/tools.py`

### Workflow Examples

- [Basic Agent](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/simple.py): `src/agents/simple.py`
- [Message Agent](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/simple-message.py): `src/agents/simple-message.py`
- [LLM Agent](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/simple-llm.py): `src/agents/simple-llm.py`
- [RAG Agent](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/rag-basic.py): `src/agents/rag-basic.py`
- [RAG Chaining](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/rag-basic-chaining.py): `src/agents/rag-basic-chaining.py`
- [Structured RAG](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/rag-basic-structured-message.py): `src/agents/rag-basic-structured-message.py`
- [ReAct Agent](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/react.py): `src/agents/react.py`
- [Orchestrator Workflow](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/orchestrator.py): `src/agents/orchestrator.py`
- [Evaluator Optimizer](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/evaluator_optimizer_joke.py): `src/agents/evaluator_optimizer_joke.py`
- [Coder Checker](https://github.com/martinpercu/langchain-langgraph_agents-structure/blob/master/src/agents/coder_checker.py): `src/agents/coder_checker.py`

### External Services

- **PostgreSQL**
- **LLM Providers**

### Other components

- **Chat User**

## Connections

- Chat User → Chat API: sends chat (evidence: `src/api/main.py`)
- Chat API → Support Graph: invokes graph (evidence: `src/api/main.py`)
- Chat User → Persistent Chat API: sends chat (evidence: `src/api/main-2.py`)
- Persistent Chat API → Support Graph: builds and invokes (evidence: `src/api/main-2.py`)
- Persistent Chat API → Checkpoint Lifecycle: requests checkpointer (evidence: `src/api/main-2.py`)
- Checkpoint Lifecycle → PostgreSQL: persists checkpoints (evidence: `src/api/db.py`)
- Support Graph → Customer Extractor: starts with (evidence: `src/agents/support_agent/support_agent.py`)
- Support Graph → Intent Router: routes after extraction (evidence: `src/agents/support_agent/support_agent.py`)
- Support Graph → Conversation Node: routes to (evidence: `src/agents/support_agent/support_agent.py`)
- Support Graph → Booking Agent: routes to (evidence: `src/agents/support_agent/support_agent.py`)
- Customer Extractor → Conversation State: reads and updates (evidence: `src/agents/support_agent/nodes/extractor/node.py`)
- Conversation Node → Conversation State: reads messages (evidence: `src/agents/support_agent/nodes/conversation/node.py`)
- Customer Extractor → Extraction Prompt: uses prompt (evidence: `src/agents/support_agent/nodes/extractor/node.py`)
- Intent Router → Conversation State: reads messages (evidence: `src/agents/support_agent/routes/intention/route.py`)
- Intent Router → Routing Prompt: uses prompt (evidence: `src/agents/support_agent/routes/intention/route.py`)
- Conversation Node → Conversation Prompt: uses prompt (evidence: `src/agents/support_agent/nodes/conversation/node.py`)
- Booking Agent → Appointment Tools: registers tools (evidence: `src/agents/support_agent/nodes/booking/node.py`)
- Booking Agent → Booking Prompt: uses prompt (evidence: `src/agents/support_agent/nodes/booking/node.py`)
- Customer Extractor → LLM Providers: calls model
- Intent Router → LLM Providers: calls model
- Conversation Node → LLM Providers: calls model
- Basic Agent → LLM Providers: uses model
- Message Agent → LLM Providers: uses model
- LLM Agent → LLM Providers: uses model
- RAG Agent → LLM Providers: uses model
- RAG Chaining → LLM Providers: uses model
- Structured RAG → LLM Providers: uses model
- ReAct Agent → LLM Providers: uses model
- Orchestrator Workflow → LLM Providers: uses model
- Evaluator Optimizer → LLM Providers: uses model
- Coder Checker → LLM Providers: uses model
