learn-langchain-with-phoebe / Builder session 1 of 10
Learn LangChain with Phoebe · Builder track · Session 1 of 10

Do you even need a framework?

The most honest way to start a LangChain course: build a working agent with NO framework at all, feel exactly where it hurts, then watch the framework earn its keep - or not. By the end you will know when LangChain is the right call and when it is overhead.

🟢 Builder track Practitioners: DA · DE · DS · engineers Python 3.10+ · Claude API or local Ollama Start here
0-3 · Welcome 3-18 · The terrain 18-42 · Build-along: agent from scratch 42-45 · Q&A
Part 0

How this track works

Ten sessions, one growing artifact: DataDesk, a data-team assistant that starts tonight as 40 lines of Python and graduates in session b10 with memory, approval gates, retrieval over your docs, a colleague agent, and an eval suite. Every session upgrades the same code. Two LLM paths run through the whole track - the Claude API for capability, a local Ollama model for zero-cost privacy - and switching between them is one line, which is itself the first thing LangChain has to prove to you.

Live - presented in session Self-study - read after class ★ Try it now prompt Official docs + Academy covered
★ What you walk out with today A tool-calling agent you wrote yourself with zero framework (so agents are never magic again), the same agent rebuilt in three lines of LangChain 1.x, a decision card for framework vs raw SDK vs the alternatives, and a map of the 2026 LangChain stack that makes every later session make sense.
Part 1 · covers Anthropic's "Building effective agents" + Academy foundations

What an agent actually is 6 min live

Strip the hype and an agent is a while-loop: a model, a list of tools, and a loop that keeps calling the model until it stops asking to use tools. Everything else - state, memory, approval gates, multi-agent - is engineering around that loop. Tonight you write the loop yourself.

1 · Model thinks 2 · Asks for a tool 3 · Tool runs 4 · Result goes back Done: answer loop exits when the model stops requesting tools The whole secret: it is a while-loop. You will have written one within the hour.
🔍 Click to zoom - the agent loop, the one diagram behind every framework
LiveWorkflow or agent - the definition that pays rent3 min

Anthropic's engineering team drew the line the whole industry now uses. A workflow is LLM steps orchestrated through predefined code paths - YOU wrote the flowchart, the model fills in text. An agent is a system where the model dynamically directs its own process and tool use - IT decides the steps.

  • Workflow example: "summarize ticket → classify → route" - three fixed steps, model inside each.
  • Agent example: "resolve this ticket" - the model decides whether to search docs, query the database, escalate, or answer.
  • The rule that saves money: agents trade latency and cost for flexibility. Start with a single LLM call; move to a workflow when steps are predictable; reach for an agent only when you genuinely cannot predict the steps. Add complexity only when it demonstrably improves outcomes.
★ Try it now (any chat AI)Here are 4 tasks from my week: [list 4 real tasks]. For each, tell me: single LLM call, fixed workflow, or agent - and WHY, in one sentence each. Be stingy: recommend the simplest thing that works.
Real world

The invoice pipeline that did not need an agent. A finance team scoped an "invoice agent". On inspection: every invoice takes the same five steps. They shipped a workflow - five fixed nodes, model in two of them - in a week. Same team's contract-review problem, where every contract needs different digging, became their first real agent. Right tool, both times.

Self-studyThe autonomy ladder - where costs and risks climb2 min read

Rules/RPA → single LLM call → workflow → agent → multi-agent. Each rung up buys flexibility and costs predictability, auditability, latency, and tokens. McKinsey's teams, after 50+ agentic builds, put it bluntly: agents aren't always the answer, and low-variance standardized processes are better served by rules or plain automation. The leader track's session a1 teaches this ladder to your boss - useful to know what they are being told.

RungRight whenWatch out
Single LLM callOne transformation: summarize, draft, classifyUsually enough - start here
WorkflowPredictable multi-step, same shape every timeHidden variance breaks fixed paths
AgentSteps genuinely unpredictable, tools neededCost, latency, compounding errors
Multi-agentDistinct specialisms or parallel workstreamsCascading errors - session b9
Part 2 · covers the 1.0 announcement + docs architecture

The LangChain stack, 2026 edition 6 min live

"LangChain" is four things wearing one trench coat. Getting the layers straight now means never being confused by a tutorial, a blog post, or a rename again.

LangGraph low-level runtime: graphs, state, persistence, HITL - sessions b5-b9 langchain · create_agent high-level agents + middleware, built ON LangGraph - sessions b2-b4 Deep Agents batteries-included harness for long-running agents - overview in b9 LangSmith the commercial layer: tracing · evals · deploy (ex "LangGraph Platform", now LangSmith Deployment) frameworks = free, MIT trust layer = the product session b10 Eject downward anytime: create_agent runs ON LangGraph, so checkpoints, streaming and HITL come free.
🔍 Click to zoom - four products, one trench coat: the 2026 LangChain stack
LiveWhat 1.0 changed - and why this course exists now3 min

For three years LangChain was famous for two things: being everywhere, and breaking your code every few months. October 2025 changed the deal:

  • One blessed entry point: create_agent replaced the zoo of AgentExecutor, create_react_agent and friends. One way to build an agent, documented everywhere.
  • The pipe chains are gone from the main package. LCEL chains, legacy retrievers and the hub moved to langchain-classic. If a tutorial shows prompt | llm | parser, it is teaching history.
  • A stability promise: no breaking changes until 2.0. The churn era is officially over - though we pin versions anyway, because two 1.x releases have been yanked for regressions. Trust, with a lockfile.
  • Middleware became the production story: summarization, PII scrubbing, human approval and retries as composable layers (session b4).
Version card for this course Python 3.10+ · pin langchain>=1.3,<2 and langgraph>=1.2,<2 · docs live at docs.langchain.com (python.langchain.com is the 0.x museum). Naming: "LangGraph Platform" is now "LangSmith Deployment" - update your mental bookmarks.
LiveThe honest alternatives card3 min

A framework you chose without knowing the alternatives is a framework you cannot defend in a design review. The 2026 field, honestly:

PickWhen it wins
Raw provider SDKSingle provider, simple call chains, zero magic wanted. Fastest to debug.
PydanticAIFastAPI-native teams, type-safety-first, built-in usage limits.
CrewAIFastest role-based multi-agent prototyping. Convenience over control.
LlamaIndexRetrieval quality over messy documents IS the product. Hybrid (LlamaIndex ingestion + LangGraph orchestration) is common.
LangChain/LangGraphCycles, persistent state, human approval, durable long-running work, provider swapping, team standardization.

The criticisms you will hear are real: abstraction overhead, the 0.x churn history, stack traces through framework internals. The 1.0 surface-area cut answers some of it; LangSmith answers the debugging pain (and is the paid product - notice the business model). The best answer is the one you build tonight: know what the framework replaces, and you will know when it earns its keep.

Real world

The team that went back to raw SDK - and the one that could not. A two-person startup shipping one OpenAI-only summarizer ripped LangChain out and was happier: fewer layers, same output. A data platform team running approval-gated agents across Claude, a local model and three databases tried the same rip-out and rebuilt half of LangGraph badly within a month - checkpointing, interrupts, retries. The difference was never taste. It was state.

Self-studyIs this worth learning? The adoption evidence2 min read
  • Money: LangChain Inc raised a $125M Series B at a $1.25B valuation (Oct 2025) - the company is not going anywhere soon.
  • Usage: the ecosystem pulls roughly 300M downloads a month; LangGraph alone ~35M. 400+ named production deployments; LangChain claims 35% of the Fortune 500 use its products.
  • Named users: Klarna (support AI, 85M users), Uber (code-migration agents, ~21,000 dev hours saved), LinkedIn (SQL Bot), Elastic, JPMorgan, BlackRock.
  • The counterweight: a real 2026 discourse of teams migrating simple apps back to raw SDKs, Gartner predicting 40%+ of agentic projects canceled by 2027, and MIT finding most GenAI pilots show no P&L impact. Both currents are true. The skill you are building - knowing WHEN the framework earns its keep - is exactly what separates the successes from the cancellations.
Part 3 · covers langchain-anthropic + langchain-ollama integration docs

Your two engines: Claude and a local model 3 min live

Every build-along in this track runs on either engine. Claude via API when you want maximum capability; a local Ollama model when you want free, private, offline. LangChain's job is to make the difference one line of code.

LiveSetup card - both engines in five minutes3 min
Claude API pathLocal Ollama path
Installpip install langchain-anthropicpip install langchain-ollama + Ollama app
Key/modelANTHROPIC_API_KEY env varollama pull llama3.1 (or your Hermes from the sibling course)
CostPer token - cents for this courseFree forever
PrivacyAnthropic ToSNothing leaves your machine
Tool callingExcellentWorks on tool-tuned models only
★ The one-line swap (the whole pitch, in code)from langchain.chat_models import init_chat_model model = init_chat_model("claude-haiku-4-5-20251001") # Claude engine # model = init_chat_model("ollama:llama3.1") # local engine - same everything else
No API key tonight? The whole session works on the Ollama path. If you took the learn-hermes course, your local Hermes model slots straight in - tool calling included.
Demo 1 of 2

Build the agent with no framework ★ 14 min · everyone builds

DataDesk v0: a raw-SDK agent that can answer one real question - "how many rows and what date range does our CSV cover?" - by deciding for itself to call a Python tool. Forty lines, no LangChain, no magic left afterwards.

Create the project: mkdir datadesk && cd datadesk, a venv, and pip install anthropic (or use the Ollama path with plain requests to localhost:11434/v1).

Write one tool: a function csv_stats(path) that returns row count, columns and date range of a CSV as a dict. Use any real, non-confidential CSV you have.

Write the loop: send the question + tool schema to the model; if the response asks for the tool, run it, append the result, call the model again; when no tool is requested, print the answer. This is the agent loop from Part 1, verbatim.

Run it and watch the two round trips: model asks for csv_stats → tool runs → model answers with real numbers. Read your own loop code once more. That is an agent. All of it.

Now break it: ask a question needing TWO tool calls, add a second tool, imagine retries, streaming, memory, approval gates. Count the code you are about to write. Hold that feeling for Demo 2.

★ The scratch loop, condensed (Claude path)import anthropic, json client = anthropic.Anthropic() messages = [{"role": "user", "content": "How many rows and what date range does data.csv cover?"}] tools = [{"name": "csv_stats", "description": "Row count, columns, date range of a CSV", "input_schema": {"type": "object", "properties": {"path": {"type": "string"}}, "required": ["path"]}}] while True: r = client.messages.create(model="claude-haiku-4-5-20251001", max_tokens=1024, messages=messages, tools=tools) if r.stop_reason != "tool_use": print(r.content[0].text); break tu = next(b for b in r.content if b.type == "tool_use") result = csv_stats(**tu.input) # your function messages.append({"role": "assistant", "content": r.content}) messages.append({"role": "user", "content": [{"type": "tool_result", "tool_use_id": tu.id, "content": json.dumps(result)}]})
Data tip Use a public or synthetic CSV for the demo. Real confidential data belongs on the local-engine path only - that discipline starts in session 1 and never relaxes.
Demo 2 of 2

The same agent in three lines of LangChain ★ 8 min · build your own

Same tool, same question, framework edition. Watch what disappears - and check what you gained is worth the layer you added.

pip install "langchain>=1.3,<2" langchain-anthropic (and/or langchain-ollama).

Decorate your existing function: @tool above csv_stats - the schema you hand-wrote in Demo 1 is now generated from the signature and docstring.

Replace your whole loop with create_agent - three lines below. Run the same question. Same answer, two round trips, zero loop code.

The swap test: change the model line to the other engine (Claude ↔ Ollama) and re-run. One line. Your Demo 1 code would have needed a rewrite of every API call.

Decision minute: write ONE sentence in your notes - "for DataDesk, the framework is/is not worth it because ...". You will revisit that sentence in b10 with an eval suite in hand.

★ DataDesk v0.1 - the whole filefrom langchain.agents import create_agent from langchain.chat_models import init_chat_model from langchain.tools import tool @tool def csv_stats(path: str) -> dict: """Row count, columns and date range of a CSV file.""" ... # your Demo 1 function body, unchanged model = init_chat_model("claude-haiku-4-5-20251001") # or "ollama:llama3.1" agent = create_agent(model=model, tools=[csv_stats], system_prompt="You are DataDesk, a data team assistant. Be precise.") print(agent.invoke({"messages": [{"role": "user", "content": "How many rows and what date range does data.csv cover?"}]}))
Real world

What you just did is the course. Sessions b2-b10 are this exact move repeated at higher altitude: meet a real production need (memory, approval, retrieval, evals), feel what it costs by hand, then let the framework carry it - or consciously decide it should not.

Homework

Try it yourself - this week ◐ 30-45 min total

Source material

Official sources covered

This track teaches from the official docs and the free LangChain Academy curricula (login required for lesson content; certificates stay with the Academy - all free). This page covers:

Anthropic "Building effective agents"Part 1 · workflow vs agent definitions + the start-simple hierarchy
LangChain 1.0 announcement + migration guidePart 2 · create_agent, langchain-classic split, stability promise
Academy: Intro to LangChain (M1)Demo 2 covers the create_agent foundations; full module depth lands in b2-b3
langchain-anthropic + langchain-ollama docsPart 3 setup card + the one-line swap
The "do you need a framework" discoursePart 2 alternatives card · both sides, sourced in the course map
Check yourself

Three questions before you go 🎯 ◐ 90 seconds

1 · The difference between a workflow and an agent is...

Anthropic's definition, and the one that pays rent: predefined code paths vs model-directed process. It decides cost, risk, and whether you need an agent at all.

2 · A tutorial shows chains built with the pipe operator: prompt | llm | parser. What do you know?

LCEL chains left the main package in 1.0. Reading a tutorial's LangChain era at a glance is a real 2026 skill.

3 · When does the framework genuinely earn its keep over a raw SDK?

Both extremes fail design reviews. The honest answer is the list in A - and you now know it from writing the raw loop yourself.

Builder session 1 cheat sheet · pin this

An agent ismodel + tools + a while-loop that runs until the model stops asking for tools. No magic.
Workflow vs agentYou fix the steps vs the model directs them. Start simple; climb the ladder only when variance demands it.
The 2026 stackLangGraph (runtime) → langchain create_agent (high level) → Deep Agents (harness). LangSmith = paid trust layer.
Version cardPython 3.10+ · pin langchain>=1.3,<2 · docs.langchain.com · pipe chains = legacy (langchain-classic).
The one-line swapinit_chat_model("claude-haiku-4-5-20251001") ↔ init_chat_model("ollama:llama3.1").
create_agent minimumcreate_agent(model=..., tools=[...], system_prompt=...) - your Demo 2 file is the template.
Alternatives cardRaw SDK: simple + single provider · PydanticAI: types-first · CrewAI: fast multi-agent · LlamaIndex: retrieval-first.
Running projectDataDesk v0.1 lives. Next: b2 teaches it messages, content blocks, and structured output.