CodeVetter · Repo Unpack · System map
langchain-ai/langchain
A uv-managed Python monorepo of independently versioned packages under libs/. langchain-core defines provider-agnostic abstractions; langchain (langchain_v1) is the user-facing orchestration layer built on LangGraph's StateGraph; langchain-classic is a frozen legacy package; libs/partners/ contains per-provider integrations released individually. There is no server or CLI entrypoint — the 'entrypoints' are library factories (create_agent, init_chat_model, init_embeddings) plus the langchain-profiles CLI. Build is hatchling, tests are pytest, and CI is a set of reusable GitHub Actions workflows.
- The repo is a monorepo of independently versioned packages: langchain-core v1.6.4 (libs/core), langchain v1.4.2 (libs/langchain_v1), langchain-classic v1.0.8 (libs/langchain), plus text-splitters, standard-tests (langchain-tests), and model-profiles.
- The actively maintained `langchain` package depends only on langchain-core>=1.6.3, langgraph>=1.2.11, and pydantic>=2.7.4; all provider integrations (openai, anthropic, mcp/fastmcp, etc.) are optional extras.
- langchain-core is the abstraction layer housing runnables, language_models, messages, tools, callbacks, vectorstores, output_parsers, prompts, tracers, and a _security subpackage; its own deps are langsmith, httpx, tenacity, pydantic, jsonpatch, PyYAML.
- The primary public entrypoint is `create_agent`, re-exported from `langchain.agents`, which builds and compiles a LangGraph `StateGraph` into a `CompiledStateGraph`.
- `init_chat_model` resolves provider strings like 'openai:gpt-5.5' through the `_BUILTIN_PROVIDERS` registry (~28 entries mapping provider key -> (module_path, class_name, creator_func)) and lazily imports the partner package.
- Provider integrations live in libs/partners/ (anthropic, chroma, deepseek, exa, fireworks, groq, huggingface, mistralai, nomic, ollama, openai, openrouter, perplexity, qdrant, xai) each with its own pyproject.toml and uv.lock, and each implementing langchain-core abstractions (e.g. ChatOpenAI in langchain_openai/chat_models/base.py).
- langchain-classic is the legacy package: `initialize_agent` is decorated @deprecated since 0.1.0 pointing users to `create_agent`, and its chains/agents tree (AgentExecutor, chains/*) is maintained for backward compatibility only.
- All packages build with hatchling and are developed via uv; local cross-package deps use editable `[tool.uv.sources]` path references (e.g. langchain-core -> ../core).
- Per-package Makefiles define the dev surface: `make test` (pytest with docker compose postgres+redis services), `make lint` (ruff check + ruff format --diff + mypy), `make format`, `make benchmark`.
- CI is organized as reusable workflows: `_test.yml` runs unit tests then re-runs them against computed minimum dependency versions via `.github/scripts/get_min_versions.py`.
- Releases are per-package and manually dispatched through `_release.yml` (workflow_call/workflow_dispatch), which resolves a working-directory dropdown value to a PyPI package name (langchain->langchain-classic, langchain_v1->langchain).
- The `langchain.mcp` namespace is beta-gated (importing it emits LangChainBetaWarning) and adapts MCP servers via the optional `fastmcp` extra.
- openwiki/ contains generated architecture documentation (e.g. architecture.md) that mirrors the three-layer design and is refreshed by the openwiki-update workflow. (inferred)