Architecture of langchain-ai/langchain
langchain-ai/langchain is 2,975 source files holding 20,802 symbols across 2 modules, written mainly in Python, Makefile, Shell. The largest module is libs, with 2,679 files, and 23 files are entry points into the dependency graph.
How langchain fits together
Application code starts with a chat model created by init_chat_model, which takes a provider and model name such as openai:gpt-5.5 and returns a model object. Calling its invoke method with a prompt sends the request and returns the result. The libs/core/langchain_core/__init__.py file is the entry point of the langchain_core package, which holds the shared components the other packages build on. The libs/langchain_v1/langchain/__init__.py file is the entry point of the langchain package that the quickstart imports from. Provider integrations are kept in separate packages under libs/partners, where libs/partners/openai/langchain_openai/chat_models/base.py implements chat models for OpenAI and libs/partners/anthropic/langchain_anthropic/chat_models.py does the same for Anthropic. LangGraph for agent orchestration and LangSmith for evaluation and debugging are separate products that the README describes alongside the framework.
Largest modules
- libs: 2,679 files and 328,308 lines of code
- .github: 9 files and 1,480 lines of code
Languages
By file count: Python 2,640 files, Makefile 24 files, Shell 22 files, JavaScript 2 files.
Documentation
Repowise documents langchain in 1,221 pages generated from the source.
More on langchain: summary and FAQ, codebase overview, code health.
Related guide: Best dependency graph tools for monorepos