An LLM workflow often has several jobs: prepare input, retrieve context, call a model, and format its answer. LangChain’s Runnable interface gives chain components a common way to accept input, process it, and return output. That shared contract lets components fit together without custom glue code for every step. section 3.1.2 section 1.2.1
A Runnable chain supports several ways to execute and compose work:
- Use `invoke()` for one execution, `stream()` for streaming output, or `batch()` for multiple inputs; asynchronous versions are also available. section 4.8
- Use LCEL’s `|` operator to pass each component’s output to the next. Use `RunnableParallel` for independent operations on the same input. section 4.8
- Wrap a Python callable in `RunnableLambda` to add custom processing without writing a class that implements Runnable. section 3.1.2
Add a text-splitting step
A summarization workflow can wrap a function that splits input text into chunks. `RunnableLambda` turns that Python callable into a chain component: `text_chunks_chain = RunnableLambda(lambda x: [{'chunk': chunk} for chunk in TokenTextSplitter(chunk_size=3000, chunk_overlap=100).split_text(x)])` The step receives text and returns a list of chunk dictionaries for later processing. section 3.1.2
Pass a question into a RAG chain
A retrieval-augmented generation chain needs both retrieved context and the original question. A retriever supplies `context`, while `RunnablePassthrough()` preserves the input as `question`: `rag_chain = {"context": retriever, "question": RunnablePassthrough()} | rag_prompt | chatbot` `answer = rag_chain.invoke(question)` The dictionary prepares the prompt inputs; the pipe then connects the prompt and chat model. section 7.3.3
For a larger workflow, build separate chains for tasks such as search, fetching, extraction, and summarization, then combine them. LCEL also supports fallbacks, parallel execution, and tracing through LangSmith. The interface makes these arrangements consistent; it does not remove the need to decide which steps depend on one another. section 4.7 section 4.8

