# microsoft/langchainjs-for-beginners architecture

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

- Interactive diagram: https://gitdiagram.com/microsoft/langchainjs-for-beginners
- Repository: https://github.com/microsoft/langchainjs-for-beginners

## Overview

This repository is a hands-on LangChain.js course, not a deployed application or runtime library. Its teaching workflow progresses from model calls and conversational interactions through prompts, tools, agents, and MCP, then into document embeddings, semantic search, and RAG. The graph groups those course capabilities and highlights the agentic-RAG retrieval flow. Relationships are limited to README descriptions and shown source excerpts; unsampled examples are represented by their existing chapter directories.

Main entry points: [`08-agentic-rag-systems/code/02-agentic-rag.ts`](https://github.com/microsoft/langchainjs-for-beginners/blob/main/08-agentic-rag-systems/code/02-agentic-rag.ts) (Agentic RAG), [`07-documents-embeddings-semantic-search`](https://github.com/microsoft/langchainjs-for-beginners/tree/main/07-documents-embeddings-semantic-search) (Vector store), [`08-agentic-rag-systems/solution/knowledge-base-rag.ts`](https://github.com/microsoft/langchainjs-for-beginners/blob/main/08-agentic-rag-systems/solution/knowledge-base-rag.ts) (Retrieval tool), [`01-introduction`](https://github.com/microsoft/langchainjs-for-beginners/tree/main/01-introduction) (LangChain basics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_models["Models and prompts"]
  node_intro["LangChain basics"]
  node_chat["Chat interactions"]
  node_prompt["Prompts and outputs"]
end

subgraph group_agents["Tools and agents"]
  node_tools["Function tools"]
  node_agents_core["Autonomous agents"]
end

subgraph group_mcp["MCP integration"]
  node_mcp_clients["MCP connections"]
end

subgraph group_search["Semantic search"]
  node_documents["Document processing"]
  node_embeddings["Text embeddings"]
  node_vector_store[("Vector store")]
  node_semantic_search["Similarity search<br/>[book-search.ts]"]
end

subgraph group_rag["RAG systems"]
  node_traditional_rag["Traditional RAG"]
  node_agentic_rag["Agentic RAG<br/>[02-agentic-rag.ts]"]
  node_retrieval_tool["Retrieval tool"]
end

node_learner(("Learner"))
node_provider["Model provider"]
node_external_services["External MCP services"]
node_answer["Answer"]

node_learner -->|"learns from"| node_intro
node_intro -->|"continues into"| node_chat
node_chat -->|"continues into"| node_prompt
node_prompt -->|"continues into"| node_tools
node_tools -->|"continues into"| node_agents_core
node_agents_core -->|"continues into"| node_mcp_clients
node_mcp_clients -->|"connects to"| node_external_services
node_learner -->|"asks questions"| node_agentic_rag
node_agentic_rag -->|"invokes model"| node_provider
node_agentic_rag -->|"registers tool"| node_retrieval_tool
node_retrieval_tool -->|"searches"| node_vector_store
node_vector_store -->|"returns matches"| node_retrieval_tool
node_agentic_rag -->|"returns answer"| node_answer
node_documents -.->|"creates vectors"| node_embeddings
node_embeddings -.->|"indexes documents"| node_vector_store
node_documents -->|"provides content"| node_traditional_rag
node_traditional_rag -->|"returns answer"| node_answer
node_semantic_search -->|"queries store"| node_vector_store

click node_intro "https://github.com/microsoft/langchainjs-for-beginners/tree/main/01-introduction"
click node_chat "https://github.com/microsoft/langchainjs-for-beginners/tree/main/02-chat-models"
click node_prompt "https://github.com/microsoft/langchainjs-for-beginners/tree/main/03-prompts-messages-outputs"
click node_tools "https://github.com/microsoft/langchainjs-for-beginners/tree/main/04-function-calling-tools"
click node_agents_core "https://github.com/microsoft/langchainjs-for-beginners/tree/main/05-agents"
click node_mcp_clients "https://github.com/microsoft/langchainjs-for-beginners/tree/main/06-mcp"
click node_documents "https://github.com/microsoft/langchainjs-for-beginners/tree/main/07-documents-embeddings-semantic-search"
click node_embeddings "https://github.com/microsoft/langchainjs-for-beginners/blob/main/07-documents-embeddings-semantic-search/code/05-basic-embeddings.ts"
click node_vector_store "https://github.com/microsoft/langchainjs-for-beginners/tree/main/07-documents-embeddings-semantic-search"
click node_semantic_search "https://github.com/microsoft/langchainjs-for-beginners/blob/main/07-documents-embeddings-semantic-search/solution/book-search.ts"
click node_traditional_rag "https://github.com/microsoft/langchainjs-for-beginners/blob/main/08-agentic-rag-systems/code/01a-traditional-rag.ts"
click node_agentic_rag "https://github.com/microsoft/langchainjs-for-beginners/blob/main/08-agentic-rag-systems/code/02-agentic-rag.ts"
click node_retrieval_tool "https://github.com/microsoft/langchainjs-for-beginners/blob/main/08-agentic-rag-systems/solution/knowledge-base-rag.ts"

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_intro,node_chat,node_prompt toneBlue
class node_tools,node_agents_core toneAmber
class node_mcp_clients toneMint
class node_documents,node_embeddings,node_vector_store,node_semantic_search toneRose
class node_traditional_rag,node_agentic_rag,node_retrieval_tool,node_learner,node_provider,node_external_services,node_answer toneIndigo
```

## Components

### Models and prompts

- [LangChain basics](https://github.com/microsoft/langchainjs-for-beginners/tree/main/01-introduction): `01-introduction`
- [Chat interactions](https://github.com/microsoft/langchainjs-for-beginners/tree/main/02-chat-models): `02-chat-models`
- [Prompts and outputs](https://github.com/microsoft/langchainjs-for-beginners/tree/main/03-prompts-messages-outputs): `03-prompts-messages-outputs`

### Tools and agents

- [Function tools](https://github.com/microsoft/langchainjs-for-beginners/tree/main/04-function-calling-tools): `04-function-calling-tools`
- [Autonomous agents](https://github.com/microsoft/langchainjs-for-beginners/tree/main/05-agents): `05-agents`

### MCP integration

- [MCP connections](https://github.com/microsoft/langchainjs-for-beginners/tree/main/06-mcp): `06-mcp`

### Semantic search

- [Document processing](https://github.com/microsoft/langchainjs-for-beginners/tree/main/07-documents-embeddings-semantic-search): `07-documents-embeddings-semantic-search`
- [Text embeddings](https://github.com/microsoft/langchainjs-for-beginners/blob/main/07-documents-embeddings-semantic-search/code/05-basic-embeddings.ts): `07-documents-embeddings-semantic-search/code/05-basic-embeddings.ts`
- [Vector store](https://github.com/microsoft/langchainjs-for-beginners/tree/main/07-documents-embeddings-semantic-search): `07-documents-embeddings-semantic-search`
- [Similarity search](https://github.com/microsoft/langchainjs-for-beginners/blob/main/07-documents-embeddings-semantic-search/solution/book-search.ts): `07-documents-embeddings-semantic-search/solution/book-search.ts`

### RAG systems

- [Traditional RAG](https://github.com/microsoft/langchainjs-for-beginners/blob/main/08-agentic-rag-systems/code/01a-traditional-rag.ts): `08-agentic-rag-systems/code/01a-traditional-rag.ts`
- [Agentic RAG](https://github.com/microsoft/langchainjs-for-beginners/blob/main/08-agentic-rag-systems/code/02-agentic-rag.ts): `08-agentic-rag-systems/code/02-agentic-rag.ts`
- [Retrieval tool](https://github.com/microsoft/langchainjs-for-beginners/blob/main/08-agentic-rag-systems/solution/knowledge-base-rag.ts): `08-agentic-rag-systems/solution/knowledge-base-rag.ts`

### Other components

- **Learner**
- **Model provider**
- **External MCP services**
- **Answer**

## Connections

- Learner → LangChain basics: learns from
- LangChain basics → Chat interactions: continues into
- Chat interactions → Prompts and outputs: continues into
- Prompts and outputs → Function tools: continues into
- Function tools → Autonomous agents: continues into
- Autonomous agents → MCP connections: continues into
- MCP connections → External MCP services: connects to (evidence: `06-mcp/solution/context7-basic.ts`)
- Learner → Agentic RAG: asks questions (evidence: `08-agentic-rag-systems/code/02-agentic-rag.ts`)
- Agentic RAG → Model provider: invokes model (evidence: `08-agentic-rag-systems/code/02-agentic-rag.ts`)
- Agentic RAG → Retrieval tool: registers tool (evidence: `08-agentic-rag-systems/solution/knowledge-base-rag.ts`)
- Retrieval tool → Vector store: searches (evidence: `08-agentic-rag-systems/solution/knowledge-base-rag.ts`)
- Vector store → Retrieval tool: returns matches (evidence: `08-agentic-rag-systems/solution/knowledge-base-rag.ts`)
- Agentic RAG → Answer: returns answer (evidence: `08-agentic-rag-systems/code/02-agentic-rag.ts`)
- Document processing → Text embeddings: creates vectors
- Text embeddings → Vector store: indexes documents
- Document processing → Traditional RAG: provides content (evidence: `08-agentic-rag-systems/code/01a-traditional-rag.ts`)
- Traditional RAG → Answer: returns answer (evidence: `08-agentic-rag-systems/code/01a-traditional-rag.ts`)
- Similarity search → Vector store: queries store (evidence: `07-documents-embeddings-semantic-search/solution/book-search.ts`)
