Zenaique

How do LlamaIndex Workflows differ from LangChain LCEL?

Short answer·Medium·4.0 · 0·~3 min·Asked atForethoughtSalesforceUnity
Attempt it

LlamaIndex Workflows and LangChain LCEL both let you compose multi-step LLM pipelines. Describe the core abstraction each one uses and call out the one structural capability LlamaIndex Workflows have that LCEL does not.

Free · 2 AI evals / day
TL;DR

LCEL pipes Runnables in a DAG; LlamaIndex Workflows dispatches events to step handlers and supports cycles natively, so agent loops do not need a separate library like LangGraph.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

Picture two ways to build a pinball machine. The first uses ramps and gates set up in a fixed path. The ball goes in one end, rolls through the gates in order, and comes out the other end. You cannot send the ball back to an earlier ramp without adding new physical hardware. The second uses lights and sensors: the ball can trigger any sensor at any time, and each sensor can light up other sensors anywhere on the board. The ball can revisit the same ramp over and over because the wiring is logical, not physical. LCEL is the first machine; Workflows is the second.

Concept explanation~2 min read

Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.

LCEL and LlamaIndex Workflows look similar from far away, both are composition layers for LLM pipelines, and very different up close. Knowing where the difference lies is what makes the choice between them coherent rather than tribal.

This deep dive walks through each framework's primitive, explains why the structural difference forces cycles into a separate library on the LangChain side, and lays out the tradeoffs that decide which bundling style fits which team.

LCEL: typed function composition with a pipe operator

LCEL is the composition layer of LangChain. The abstraction is Runnable: a class with .invoke, .batch, .stream, and their async variants. Anything that satisfies the Runnable interface composes with the pipe operator.

What a Runnable pipe looks like

A simple chain is chain = prompt | model | parser. The pipe operator stitches the right operand's input type to the left operand's output type. The runtime walks this chain when you call chain.invoke(input), passing the output of each step into the next.

Composition primitives

LCEL provides several Runnable variants for non-linear shapes:

  • RunnableSequence. What | produces under the hood.
  • RunnableParallel. Runs several Runnables on the same input and returns a dict of outputs.
  • RunnableBranch. Picks one of several Runnables based on a predicate on the input.
  • RunnableLambda. Wraps a plain function so it satisfies the Runnable interface.
  • RunnablePassthrough. Passes the input through, often used in RAG to combine retrieval output with the original query.

Why it is structurally a DAG

Every composition primitive produces a graph where every node has well-defined upstreams and downstreams. There is no syntax for a later Runnable to feed an earlier one. The runtime walks the composition from input to output and never revisits a node.

This is a deliberate design choice. DAGs are easy to reason about, easy to type-check, easy to optimize for parallelism. The cost is that anything that requires a cycle, agent loops, retries, HITL pauses, cannot be expressed in LCEL alone.

Workflows: event-driven step dispatch
Where LangChain answers with LangGraph
Tradeoffs that decide the call
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.
AxisLCEL (LangChain)Workflows (LlamaIndex)
PrimitiveRunnable + pipe operator@step methods + events
Composition shapeDAG, left to rightEvent dispatch, any topology
CyclesNot supported in pure LCELNative
BranchingRunnableBranchStep emits different event types
ParallelismRunnableParallelMultiple steps consume same event
Cycle-capable cousinLangGraph (separate library)Built in

Real products, models, and research that use this idea.

  • LlamaIndex 0.13 ships Workflows as the recommended orchestration layer for agent-style pipelines.
  • LangGraph 1.x is LangChain's separate library for cycle-capable orchestration, layered on top of LCEL.
Sign in to see more production examples.

What an interviewer would ask next. Try answering before peeking at the approach.

QHow would you express a supervisor-worker pattern in Workflows?
A

Define a SupervisorStep that consumes a TaskEvent and emits one WorkerTaskEvent per worker; multiple WorkerSteps consume WorkerTaskEvent and emit WorkerResultEvent; an AggregateStep collects WorkerResultEvent and emits FinalEvent; the cycle returns to SupervisorStep if it needs another round.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

Trying to express an agent loop in pure LCEL and getting stuck because the DAG cannot revisit earlier steps without graduating to LangGraph.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • The composition primitive each framework uses

  • Why LCEL is structurally a DAG

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
Defend the call to…
Short answer·Hard