Home/Interview Questions/LangChain/Infosys
InfosysLangChain

Infosys LangChain Interview Questions 2026

InfyTQ platform test + technical interview. Focus on practical implementation over theory.

Focus:PythonSQLMachine LearningCommunication
1
Beginner

What is LangChain and what problem does it solve?

LangChain is an open-source framework for building applications powered by LLMs. It solves the problem of connecting LLMs to external data, tools, and memory. Without LangChain, you write boilerplate for every: prompt formatting, chain-of-thought parsing, tool calling, memory management, and streaming. LangChain provides standardized abstractions so you can swap models (GPT-4 → Gemini) without rewriting business logic.

2
Intermediate

What is the difference between LangChain Chains and Agents?

Chains follow a fixed, predetermined sequence of steps — ideal for workflows where the path is known (query → embed → retrieve → generate). Agents are dynamic: the LLM decides at runtime which tools to call and in what order. Use chains for production stability and cost predictability. Use agents for open-ended tasks requiring reasoning. In production, most teams start with chains and only use agents where dynamic tool selection is genuinely needed.

3
Intermediate

How does LangChain Memory work and what are the types?

LangChain Memory stores conversation context to enable multi-turn conversations. Types: (1) ConversationBufferMemory — stores all messages (expensive for long conversations), (2) ConversationSummaryMemory — summarizes old messages with the LLM, (3) ConversationBufferWindowMemory — keeps last N messages, (4) VectorStoreRetrieverMemory — retrieves relevant past messages by semantic similarity. For production, use external memory (Redis/PostgreSQL) instead of in-memory solutions that reset on restart.

4
Intermediate

Explain LangChain Expression Language (LCEL) and why it matters.

LCEL is LangChain's declarative way to compose chains using the pipe operator (|). Example: chain = prompt | llm | output_parser. LCEL gives you: automatic async support, streaming by default, built-in retry logic, parallel execution (RunnableParallel), and easy debugging. Every component is a Runnable with .invoke(), .stream(), and .batch() methods. LCEL is now the recommended way to build all LangChain applications.

5
Advanced

How do you build a production-ready RAG pipeline with LangChain?

Production RAG pipeline: (1) Document loading with UnstructuredLoader, (2) Chunking with RecursiveCharacterTextSplitter (chunk_size=1000, overlap=200), (3) Embedding with OpenAIEmbeddings, (4) Storage in Pinecone/Chroma vectorstore, (5) Retrieval with similarity search (top-k=5), (6) Reranking with Cohere Reranker, (7) Answer generation with ChatOpenAI + prompt template. Monitor retrieval quality with RAGAS evaluation framework.

6
Intermediate

What is LangChain Tools and how are they used in agents?

Tools are functions that agents can call to interact with the world. Define with @tool decorator: @tool def search_web(query: str) -> str. Tools need: name (for LLM to identify), description (for LLM to know when to use), and a callable function. Common tools: web search (Tavily), code execution (Python REPL), database queries, API calls, file operations. In production, validate tool inputs, add timeouts, and handle errors gracefully.

7
Advanced

How do you handle prompt versioning and management in production LangChain apps?

Use LangSmith Hub for centralized prompt storage and versioning. Alternatively, store prompts in a database or YAML files with version tags. Key practices: (1) Never hardcode prompts in code — externalize them, (2) A/B test prompts with different versions, (3) Track which prompt version produced each response, (4) Use PromptTemplate with input_variables for reusable prompts. LangSmith provides prompt testing and comparison tools.

8
Advanced

What is LangGraph and when should you use it over LangChain agents?

LangGraph is a library built on LangChain for building stateful multi-agent workflows as graphs. Use LangGraph when: (1) You need complex branching logic and loops, (2) Multiple agents collaborate with shared state, (3) You need human-in-the-loop review steps, (4) Your workflow has conditional paths based on intermediate results. For simple single-agent tasks, standard LangChain agents are sufficient.

9
Intermediate

How do you debug and trace LangChain applications?

Use LangSmith for production tracing — it records every LLM call, tool execution, and chain step with timing and cost data. Enable with LANGCHAIN_TRACING_V2=true env variable. For local debugging: set verbose=True on any chain, use callbacks (StdOutCallbackHandler), or use the @traceable decorator. LangSmith lets you replay failed requests, compare runs, and set up automated evaluation pipelines.

10
Advanced

How do you reduce LangChain LLM costs in production?

Cost reduction strategies: (1) Caching — use LangChain's built-in cache (SQLiteCache or RedisCache) to avoid duplicate API calls, (2) Model routing — use GPT-3.5 for simple queries, GPT-4 only for complex reasoning, (3) Context compression — use ContextualCompressionRetriever to reduce tokens sent to LLM, (4) Batch processing — use .batch() instead of individual .invoke() calls, (5) Token counting — set max_tokens limits and monitor with LangSmith.

Preparing for Infosys?

Find your gaps with our free AI readiness assessment.

Take Free Assessment →
Premium Access

Unlock 3,000+ Interview Questions

Get full access to all interview questions with detailed answers, explanations, and real company context

Unlock Full Access →
Chat on WhatsApp