AI Hints
Home›LangChain Tutorial›Wrapping Up
LangChain · Lesson 119 of 120

Common Mistakes

And fixes.

⏱ 2 min read▶ Video at 2:15:26🎓 Free
Watch this lesson in the LangChain courseWatch on YouTube ↗Full LangChain course

Everyone makes the same few mistakes when they start with LangChain. Here they are, so you can skip them.

Common Mistakes
From the video: Common Mistakes
  • Everyone makes them
  • The same few
  • Skip them

Mistakes and fixes

Forgetting the thread ID, so memory doesn't work. Vague tool docstrings, so the model picks the wrong tool. Huge chunks, or too many of them, so prompts get slow and costly. No fallback sentence, so the bot invents answers. Letting the model choose the user ID, instead of runtime context. And never testing, so changes break things silently.

MistakeFix
No thread_idset it in config
Vague docstringssay what and when
Too much contextsmaller k, chunks
Invented answersfallback sentence
Model picks user IDruntime context
No testsa test set

Debugging habits

When something goes wrong, print the filled prompt. Look at every message the agent produced, including tool calls. Turn on tracing. And test retrieval separately from generation.

keyvalue
Printthe filled prompt
Inspectall messages
TraceLangSmith
Splitretrieval vs answer

Summary

Most problems come from a few mistakes, each with a simple fix. Print, inspect, trace, and test. Next, what to learn after this course.

Key takeaways
  • Set thread_id
  • Clear docstrings
  • Test everything
Next up: What to Learn Next — keep building