LangChain: The Incumbent Agent Framework for Data Work
What it is: LangChain is the original general-purpose LLM application framework — prompt templates, chains, retrievers, memory, and a huge catalog of third-party integrations (vector stores, document loaders, SQL toolkits) under one API. It predates the current "agent framework" wave and is still the most widely installed package in the space, even as its own maintainers steer new agent-building work toward LangGraph.
Quick answer: Reach for LangChain when you want a document loader, a vector-store connector, or a SQL/CSV toolkit that someone has already wired up — its integration catalog is unmatched. For the actual agent control flow, most teams now build the graph in LangGraph and pull LangChain components in as tools, rather than using LangChain's own older AgentExecutor abstraction.
Why it matters for data work
Almost every "connect an LLM to a data source" problem has already been half-solved somewhere in LangChain's integration catalog: loaders for CSV, PDF, and warehouse exports, retrievers for a dozen vector databases, and toolkits that wrap SQL databases and pandas dataframes. Even teams who've moved their orchestration logic to LangGraph or a custom loop often still pip install a LangChain loader or embeddings wrapper rather than write one from scratch.
Install & configure
Install the core package plus the community integrations package:
pip install langchain langchain-community
Most real usage also needs a model provider package (langchain-openai, langchain-anthropic) and, for data work, an integration package such as langchain-community's SQL database utilities or a vector-store client. Set your provider's API key as an environment variable and instantiate the chat model class for that provider — the rest of the API (prompts, chains, retrievers) is provider-agnostic.
LangChain or LangGraph — which for data agents?
Be honest with yourself about which problem you have. If you need a single well-defined chain — retrieve documents, stuff them in a prompt, get an answer — LangChain's higher-level chain abstractions still get you there fastest. If you need an agent that loops, branches, retries, and persists state across a long-running data task (fetch, validate, fix, re-fetch), LangGraph's explicit graph model is easier to reason about and debug than LangChain's older AgentExecutor, which hides control flow inside a black-box loop that's notoriously hard to customize once you need anything beyond the default ReAct pattern. In practice, many production setups use both: LangChain for loaders/retrievers/model wrappers, LangGraph for the actual control flow.
Limits and gotchas
LangChain's biggest complaint isn't a single bug — it's surface area. The API has been reshaped multiple times (chains, LCEL, and now a stronger push toward LangGraph for anything agentic), so tutorials and Stack Overflow answers from different eras contradict each other, and it's easy to end up depending on a class that's since been marked legacy. Package fragmentation is real too: core, community, and provider-specific packages version somewhat independently, so pin versions in production rather than trusting pip install --upgrade to leave your chains working.
Troubleshooting
Most issues trace back to version drift or picking the wrong abstraction layer for the job.
- ImportError on a class you copied from a tutorial: it likely moved between
langchain,langchain-core, andlangchain-communityin a later release — check the current import path in the docs rather than the blog post. - Agent loops forever or ignores your stop condition: the legacy
AgentExecutoris hard to constrain precisely; consider moving that specific agent to LangGraph instead of fighting the executor's callback hooks. - SQL toolkit runs a destructive query: the default SQL agent has no built-in read-only guard — point it at a read-only database user or role, not application credentials.
- Version mismatch errors between packages: pin
langchain,langchain-core, and any provider packages to versions tested together in a lockfile.
Author & links
Author: LangChain, Inc.
Repo: github.com/langchain-ai/langchain
License: MIT
Related skills
For explicit, checkpointed control flow see LangGraph. For a typed, less batteries-included alternative see Pydantic-AI. If your framework choice hinges on OpenAI-only usage, compare against the OpenAI Agents SDK.
← Back to Agent Frameworks