LangChain chain
LangChain chain is a reusable pipeline that strings together prompts, models, memory, and custom logic in the LangChain framework. Each chain exposes a single invoke method: it ingests an input dict, runs the defined sequence—calling an LLM, querying a vector store, parsing JSON, or triggering a tool—and returns an output dict. The older built-in classes for these patterns—LLMChain, SequentialChain, RetrievalQA—are deprecated and, since LangChain 1.0, live in the separate langchain-classic package; the same patterns are now written by composing Runnables with the pipe operator, as in prompt | model | output parser. Developers can subclass chain to add validation, streaming callbacks, or parallel branches, enabling complex agentic behavior without boilerplate. Conversation history is passed explicitly into the prompt or held in a LangGraph checkpointer rather than in a memory object shared by every step; a chain built this way carries context across turns, supports token counting for cost control, and logs events for observability. In production you compose chains inside a Runnable graph, serialize them to JSON for versioning, and deploy behind FastAPI or AWS Lambda—cutting time-to-market for chatbots, copilots, and automation scripts.
Related terms
Related services: LangChain development company, Agentic AI consulting.
Ready to put agentic AI to work?
Book a free 45-minute consultation. We'll map one real process worth automating with production-grade AI.