AI / LangGraph LangChain Interview questions
How does LangChain differ from traditional LLM integration?
Traditional LLM integration means calling an LLM's HTTP API directly: you construct a prompt string by hand, send a requests.post(), parse the JSON response, and manage conversation history as a list you track yourself. Each provider has a different SDK, different error codes, and different retry behaviour. When you need RAG, you wire vector store calls separately; when you need tools, you parse the model's text output to decide what to call next.
| Concern | Traditional API Integration | LangChain |
|---|---|---|
| Provider switching | Rewrite code per provider SDK | Swap model class, keep same chain |
| Prompt management | Manual string concatenation | PromptTemplate with typed variables |
| Conversation history | Manual list tracking | Memory classes handle automatically |
| Tool/function calling | Custom parsing logic per use case | Agents + Tools framework |
| RAG pipeline | Separate vector DB code + manual retrieval | Retriever + LCEL pipe |
| Retry & fallback | Custom retry logic | Built-in .with_retry() / .with_fallbacks() |
| Observability | Custom logging | LangSmith tracing built-in |
The key difference is composability. LangChain treats every component — model, prompt, retriever, parser — as a Runnable with a consistent interface. You can swap, chain, parallelize, or add fallbacks without touching unrelated code.
More Related questions...