Overview
TheRunnable interface is the foundation of LangChain.js. All major components (chat models, tools, retrievers, etc.) implement this interface, enabling seamless composition and chaining.
Core Classes
Runnable
The base class that all runnable components extend. Import:Invoke the runnable with a single input
Stream the runnable output
Process multiple inputs in parallel
Chain this runnable with another
RunnableSequence
A sequence of runnables that execute in order, passing output to the next runnable.RunnableParallel
Runs multiple runnables in parallel and combines their outputs.RunnableLambda
Wrap a function as a Runnable.RunnablePassthrough
Passes input through unchanged, optionally assigning additional fields.RunnableBranch
Conditionally routes to different runnables based on input.Configuration
RunnableConfig
Configuration options for runnable execution:Examples
Basic Chain
Streaming
Batch Processing
Related
Core Concepts: Runnables
Learn about the Runnable pattern
Chat Models
Chat models are Runnables
