Tutorial
Recap: On Day 9, LangBot became a full RAG pipeline — every chat message retrieves relevant documents and the LLM answers from them. The /search command, list-mode routing, and regular chat all coexist. But there is a problem hiding in plain sight: the routing logic is hand-coded in if/elif blocks. LangBot doesn’t decide anything — it follows a script. Today we replace that script with an agent: an LLM that reasons about which tool to use, calls it, and responds — autonomously.
Recap: On Day 8, LangBot gained a long-term memory — a vector store (Pinecone) filled with document embeddings. You can ask /search home office stipend and get relevant chunks back. But that is half the picture. You still have to type /search, read raw chunks, and synthesize the answer yourself. Today we close the loop: the retriever feeds into the chatbot automatically, so you ask “How much is the home office stipend?” and LangBot answers from your documents — no slash command, no manual lookup.
Recap: On Day 7, LangBot learned to stream — token-by-token responses that feel like a real chat app. It remembers the conversation within a session (Day 2 memory), it has a personality (Day 3 prompt templates), it returns typed data (Day 5 structured output), it handles lists (Day 6 output parsers), and it streams those replies in real time (Day 7). But ask it anything outside its training data and it either guesses, hallucinates, or apologizes. Today we fix that by giving LangBot the ability to search external documents — the retrieval half of RAG.
Recap: On Day 6, LangBot gained output parsers and now responds in two modes — chat mode returns typed LangBotResponse objects with mood and confidence, and list mode returns clean list[str] via CommaSeparatedListOutputParser. Both modes use .invoke(), which means the entire response arrives at once after the model finishes generating. Today we fix that — LangBot learns to type its replies one token at a time.
The problem: waiting for the whole answer
Every interaction so far has the same rhythm:
Recap: On Day 5, LangBot started returning typed objects — every response is now a LangBotResponse with .message, .mood, and .confidence. That is great when you need structured metadata. But structured output is not always the right tool. Sometimes you just want a clean string. Sometimes you want a parsed list. Today we add output parsers — lightweight LCEL components that transform raw AIMessage output into exactly the shape you need.