LangChain/Core Concepts
Beginner10 min

LCEL: The Pipe Operator

The pipe operator (|) composes Runnables into chains. Lazy evaluation, type safety, and the full Runnable interface.

Quick Reference

  • chain = step_a | step_b | step_c — reads left to right
  • Every step is a Runnable with .invoke(), .stream(), .batch()
  • Chains are lazy — | just wires steps, .invoke() executes them
  • RunnablePassthrough and RunnableLambda let you inject custom logic
  • LCEL replaces LLMChain, ConversationChain, and all legacy chain classes

LCEL in LangChain v1

LCEL is still supported but de-emphasized in v1

In LangChain v1, the primary abstraction is create_agent (for agents) and LangGraph (for workflows). LCEL/Runnables remain in langchain-core for composing model calls, prompt templates, and parsers — but you no longer need LCEL chains for most agent tasks. Use LCEL for simple model pipelines (prompt → model → parser). Use create_agent or LangGraph for anything involving tool calling, memory, or multi-step reasoning.