AI / LangGraph LangChain Interview questions
What are LangChain Runnables?
A Runnable is the core interface in LangChain that every composable component implements. If something is a Runnable, it can be connected with |, batched, streamed, retried, and traced — regardless of whether it's a prompt template, an LLM, a retriever, or a custom Python function.
Every Runnable exposes these standard methods:
invoke(input)— single synchronous call, returns one outputbatch([input1, input2, ...])— processes multiple inputs, returns list of outputsstream(input)— yields output chunks as they arrive (useful for token streaming)ainvoke() / abatch() / astream()— async equivalents of the aboveastream_events()— fine-grained async event stream (tool calls, LLM tokens, etc.)
LangChain ships several utility Runnables: RunnablePassthrough passes input unchanged (or adds extra fields), RunnableLambda wraps any Python function as a Runnable, RunnableParallel runs multiple branches concurrently and merges their outputs into a dict, and RunnableBranch routes input to different Runnables based on conditions. These combine with LCEL pipes to build arbitrarily complex workflows.
More Related questions...