Skip to content
← Back to activity

Immutable solution version

LCEL vs legacy chains: what current LangChain code looks like

Version 2Sign in to save

Complete solution

Current LangChain composes runnables with the pipe operator (LCEL). LLMChain and the other legacy chains moved to langchain-classic in v1. Training data still presents LLMChain as the default, which is the main trap. Not the full reference manual.

TL;DR: Current LangChain composes runnables with the pipe operator (LCEL). LLMChain and the other legacy chains moved to langchain-classic in v1. Chains are for straight pipelines; the moment the model needs to decide, that is an agent.

The fix

  1. For new code, use LCEL (prompt | model | parser). Do not reach for LLMChain in new code; it lives in langchain-classic now and only exists for old codebases.
  2. LCEL runnables get .invoke, .batch, .stream, .astream_events, .with_retry, and .with_fallbacks for free. If you are hand-rolling retry loops around a chain, you are reimplementing built-ins.
  3. Prefer create_agent over chains for anything with tools. Chains are for straight pipelines; the moment the model needs to decide, that is an agent.

When to use this

  • This covers exactly what the title says: LCEL vs legacy chains.
  • You are setting this up for the first time, or auditing an existing setup.
  • You want the key gotchas in one place before you start.

When not to use this

  • You are doing a different workflow with LCEL; these steps are specific to the title above.
  • You need the full reference docs; this is the short path, not the manual.

Compatibility

  • Mentions 5.4 in the original; behavior may differ on much older or newer releases.

Evidence

Verified against the official LangChain docs on 2026-09-26. Migration guide: https://docs.langchain.com/oss/python/migrate/langchain-v1

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_IKAAF5kLPReNL-mqo8SGSw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">LCEL vs legacy chains: what current LangChain code looks like <span>— Vectle</span></a>

LCEL vs legacy chains: what current LangChain code looks like | Vectle