← Back to concept explainers

Concept Fable

LangChain Expression Language

Conclusion first:LangChain Expression Language, LCEL is LangChain's declarative composition layer, using Runnable to connect prompts, models, parsers, retrievers and custom functions into runnable pipelines. It supports composition, parallelism, branching, streaming, tracing and deployment, making complex LLM applications easier to understand and maintain than hand-written glue code.

LangChain Expression Language, LCEL · LLM orchestration abstraction

Read the story first. There is no rush to give a definition here; let the question grow on its own first.

Fable

The playbook turns from verbal dispatch into a rehearsable pipeline

When the riverside theater troupe rehearsed a new play, the troupe leader always relied on shouting instructions: first get the topic, then check the old script, then ask the teacher to write, then have the organizer fix the format. When the play was small, one shout was enough.

As the plays grew more complex, verbal scheduling became a disaster. Some people could work on two old plays in parallel, some had to wait for the master to finish writing before they could revise lines, some plot devices appeared only in specific storylines, and no one could see it all at a glance.

The troupe leader first wrote a long set of instructions. The instructions could be read but not directly rehearsed; each time a segment was added, the instructions and on-stage actions quickly fell out of sync.

He then stuffed all the arrangements into one thick script. The script could run once, but was hard to break apart, hard to test, and hard to replace. The new musicians only dared to copy it, not change it.

A director turned the script into a string of composable actions: the title card goes to the storyteller, the storyteller's manuscript goes to the proofreader, excerpts from the old version can be merged into the earlier title card, and branches and parallel paths are written with clear markers.

Each action can be rehearsed on its own and also connected into a complete performance. To change the storyteller, just swap that segment; to change the closing format, swap the organizer; to check two old plays at the same time, mark both paths and then merge them. Later, the steward wrote this experience into the daily rules: first look at the scenario, then the boundaries, and finally who can take over when something fails. Only when all of these are clear does a beautiful demo become deliverable work.

The troupe also treated this sequence of actions as a living script to track, replay, pause, and resume, no longer treating it merely as explanatory text. The director also left an input and output for each action. What the old script excerpt looked like, what the prompt card the master received looked like, and what format the organizer finally delivered could all be checked separately.

The troupe leader found that what was saved was not just a few lines of dialogue, but the readability, composability, and inspectability of a complex process. This let the troupe dare to replace parts. If a certain gentleman took leave, the whole play did not need to be rewritten; if an old script section was slow to look up, it could be optimized on its own. A pipeline does not make the play rigid; it gives complex collaboration an adjustable skeleton. During reviews, they would also compare against old incidents to confirm that the new rules were not just good on paper, but could actually block the same mistakes on a busy, chaotic floor.

Reveal

This story is about: LangChain Expression Language

LangChain Expression Language, LCEL is LangChain's declarative composition layer, using Runnable to connect prompts, models, parsers, retrievers and custom functions into runnable pipelines. It supports composition, parallelism, branching, streaming, tracing and deployment, making complex LLM applications easier to understand and maintain than hand-written glue code.

What matters is that it is not just a term, but a structural problem that repeatedly appears in real AI / Agent systems. Understanding it lets you judge when to add a model, when to change a process, and when to add governance.

Metaphor mapping

  • Shouting the process out loud: ad hoc handwritten LLM scheduling logic
  • Long-form description: the document describes the process but is not executable
  • Big script: orchestration that runs but is hard to compose and test
  • A string of composable actions: LCEL Runnable pipeline
  • Prompt templates, model, parser, retrieval: prompt, model, output parser, retriever
  • Parallelism and branching: LCEL composition primitives
  • Tracing, retries, streaming output: runtime capabilities in the Runnable ecosystem
  • Final insight: LCEL expresses the data flow and execution structure of an LLM application as a declarative pipeline

Andy Ren Xu's judgment

The practical value of this concept is that it helps you break "AI features that look smart" into deliverable, verifiable, and governable units of work.

Runnablechainpipelineprompt templateoutput parser
京ICP备2026014272号