AI / LangGraph LangChain Interview questions II
What are common pitfalls in LangChain/LangGraph development?
Developers new to LangChain and LangGraph frequently encounter the same set of issues. Knowing them in advance saves significant debugging time:
- Context window overflow — injecting the full conversation history into every prompt causes failures on long conversations. Fix: use
ConversationBufferWindowMemory, summarisation memory, or LangGraph's message trimming. - Agent infinite loops — an agent can keep calling tools indefinitely if it never reaches a satisfying answer. Fix: always set
max_iterationsin AgentExecutor or add a loop count check in LangGraph conditional edges. - Prompt injection from user inputs — if raw user text is inserted into system-level prompts, attackers can override your instructions. Fix: sanitise inputs, use structured message roles, never directly concatenate user text into the system message.
- Over-engineering with agents — using a 5-step agent for a task that a single RAG call handles. Agents are slower, more expensive, and less predictable. Fix: start with the simplest approach and only add agent complexity when necessary.
- Ignoring async in high-concurrency servers — using
invoke()instead ofainvoke()in FastAPI handlers blocks the event loop and degrades performance under load. - Hallucinated tool calls — ReAct agents can sometimes hallucinate tool calls or their inputs. Fix: use structured output (OpenAI Tools Agent) instead of text-parsed ReAct, and add input validation to tool functions.
- Pinning package versions — LangChain releases frequently; unpinned dependencies in production cause unexpected breaking changes. Always use a lockfile.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
