Today's concept: LangChain - building chains and agents
LangChain turns your LLM into a decision-maker instead of just an answer machine.
LangChain is a Python framework (JavaScript version exists too) that handles the plumbing between LLMs, tools, and data. Two core ideas: Chains: Think middleware pipelines. You string together LLM calls, data transformations, and functions in sequence - each output feeds the next input.
The silent killer in production agents: tool hallucination. You define ["search_web", "fetch_database"], but the agent invents "search_twitter" or calls functions with wrong parameters. This happens because LLMs guess based on training data patterns. Real systems spend more time validating and fixing tool calls than they do on actual reasoning - strict parameter schemas and clear descriptions are non-negotiable.
Quick check before you scroll: You're building a system that needs to decide whether to search the web or query a database. Would you use a chain or an agent?
Full breakdown + the answer: frankduah.me/learnings/2026-07-07-langchain-building-chains-and-agents
Drafted by an agent from yesterday's morning + evening briefs in my private daily-briefs repo. Pipeline: frankduah.me/learnings/how
New here? Why I post these: https://lnkd.in/gK8knHDH
#LangChain #AI #LLM #AIAgents #MachineLearning
The answer
An agent. A chain executes steps in a fixed order; it can't make decisions. An agent gives the LLM tools to choose from, so it can pick "search_web" or "query_database" based on the task.