LCEL is a declarative syntax for composing LangChain Runnables into executable chains. You describe the workflow, and LangChain optimizes execution; each resulting chain remains a Runnable that can be invoked, batched, or streamed. section 6.5.1 section 6.1.1
Build LCEL workflows from reusable composition primitives:
- Use RunnableSequence when each step consumes the previous step’s output. section 6.5.1
- Use RunnableParallel when several Runnables should process the same input concurrently and return keyed results. section 6.5.1
- Use RunnableLambda to wrap ordinary JavaScript functions and add custom logic to a chain. section 6.5.1
Sequential text-processing chain
A runnable chain can uppercase input, count its vowels, format a prompt, call ChatOpenAI, and parse the response with StringOutputParser. The same workflow can be expressed with pipe composition or RunnableSequence.from([...]). section 6.1.1 section 6.1.1
const chain = new RunnableSequence({
first: runnable1,
last: runnable2,
});
Use the supplied RunnableSequence pattern to inspect the compact structure of a sequential LCEL chain. section 6.5.1
const chain = new RunnableParallel({
key1: runnable1,
key2: runnable2,
});
Use the supplied RunnableParallel pattern to compare concurrent branches that share one input. section 6.5.1
const someFunc = RunnableLambda.from((input) => {
return input;
});
const chain = someFunc.pipe(runnable1);
Use the supplied RunnableLambda pattern to connect custom JavaScript functions with existing Runnables. section 6.5.1

