Concept guide · LangChain, LangGraph, and CrewAI
What is a LangChain runnable or chain?
A slower explanation for when the short interview answer is not enough. Start with the intuition, then connect it to the technical idea and the way an interviewer expects you to reason about it.
ML area
Generative AI → LangChain runnables and chains
Interview format
Core · Design
Question
GENAI-090
Start with the idea
In simple terms
A runnable or chain composes steps with a common execution shape. It lets you connect prompts, models, retrievers, parsers, and parallel or sequential operations without writing every adapter yourself.
Make it concrete
A chain can accept a user question, retrieve documents, map the documents into a prompt, call a model, and parse the answer into a typed result.
Build the answer
Structure your answer
- 1Draw the data shape entering and leaving every runnable.
- 2Check which steps can run in parallel and which must remain ordered.
- 3Test parsing, retries, cancellation, and provider failure explicitly.
Go one level deeper
The technical explanation
The abstraction makes composition and tracing easier, but it can hide data transformations, implicit retries, or accidental serial work. Inspect inputs and outputs at each boundary, define schemas, handle cancellation and errors, and test the chain with fixtures rather than only with a live provider.
Say this in the interview
A runnable or chain composes model calls, prompts, parsers, retrievers, and other steps into a callable pipeline with a common execution shape. The benefit is composition and observability; the risk is hiding important data transformations or errors behind abstraction unless the trace is inspected.
Keep preparing