LangChain Tutorial for Beginners: Messages, Roles and LangSmith Setup @KGPTalkie
LangChain Tutorial for Beginners: Messages, Roles and LangSmith Setup  @KGPTalkie
Uploaded August 2026 | Updated November 2026, 2 days ago
Day 2 of the free LangChain 10 Days Bootcamp. This lesson covers the three message types every LangChain app is built on (SystemMessage, HumanMessage, AIMessage) and a free LangSmith setup so you can see exactly what your model is doing on every call.

We start with how LLM roles map to LangChain classes, then wire up LangSmith tracing so each call is logged with its full input, output, and token usage. After that we run the same question through different system prompts (pirate, calm support agent, rhyming couplets) and hit a case where the model flat out refuses to take the role. We also measure what a long system prompt actually costs you in input tokens, and close with a prompt injection attempt against a strict no-refund support agent. Everything here is self-contained, so you can follow along even if you're new to LangChain.

๐Ÿ“บ Full playlist (LangChain 10 Days Bootcamp): youtube.com/playlist?list=PLW4pPr9JCovI

โฑ Chapters:
0:00 Intro and Day 1 Recap
0:45 The Three LLM Roles: System, Human, AI
1:31 How model.invoke Maps to Human and AI Messages
2:36 Why the System Message Matters
3:49 Same Question, Three Different System Prompts
5:26 LangSmith Setup for LLM Observability
6:54 Creating Your LangSmith API Key
7:36 Adding LangSmith Keys to Your .env File
9:11 Loading the Model and Environment in the Notebook
10:51 Your First Call with System + Human Messages
12:07 Viewing the Trace Inside LangSmith
13:52 Pirate Role Test: When the LLM Ignores Your Prompt
15:49 Calm Support Agent Role
17:01 Rhyming Couplets Role
17:45 How Many Tokens Does a System Prompt Cost?
19:47 Strict System Prompt: The No-Refund Agent
20:13 Prompt Injection and Jailbreaking the LLM
22:16 Formatting Messages with pretty_print
23:45 Wrap-Up and What's Next

๐Ÿ”— Resources:
Code + slides (GitHub): github.com/laxmimerit/Langchain-10-Days-Bootcamp
LangSmith (free signup): smith.langchain.com
Free model used (Ling 3.0 Tiny): openrouter.ai/inclusionai/ling-3.0-tiny:free
LangChain install docs: docs.langchain.com/oss/python/langchain/install

๐Ÿ“บ Watch first (Day 1: Free AI API Setup with OpenRouter):
youtu.be/EMRRGr-uYkU

๐ŸŽ“ Level up with my Udemy course:
Master LangChain v1 and Ollama - Chatbot, RAG and AI Agents: kgptalkie.com/langchain

If this cleared up how messages and roles work, leave a like and tell me in the comments which system prompt gave you trouble. Subscribe so you catch the rest of the bootcamp.

#LangChain #LangSmith #GenerativeAI #PromptEngineering #LLM
LangChain Tutorial for Beginners: Messages, Roles and LangSmith SetupBuild Finance RAG in Less than 10 Minutes with OpenAI Agent Builder10 Python Crash Course for ML - Set | ML for Data ScienceMCP Tutorial 1 - Control Web Browser with Playwright MCP Server and AIHermes vs OpenClaw: Which AI Agent Is Better?Ornith 9B vs 35B: The KV Cache Puzzle #shortsConnect Hermes Agent to Discord: Control Your AI Agent From Your Phone (2026)Hermes Agent Lead Generation Automation - Unlimited Leads/Day07 Gen AI Interview Preparation: What is Tokenization in LLM  #ai #genai #generativeai #interviewBookMyShow System Design: 4 Friends, 4 Seats, 1 StrangerGemma 4 ๐Ÿ˜ฎ Qwen Killer? I Donโ€™t Think So...#10 Gen AI Interview 2026: LoRA vs QLoRA (Asked FAANG)
Laxmi Kant | KGP Talkie |

LangChain Tutorial for Beginners: Messages, Roles and LangSmith Setup

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER