Skip to main content
HS
HiSETSuccess
LeetCode Prep

Agent Engineering

From autocomplete user to superstar developer — coding agents, context, skills, MCP, hooks, spec-driven and parallel workflows, and building your own agents.

Chapter 8 · 6 lessons

LangGraph, LangChain & Agent Workflows

When to build a workflow vs an agent, LangGraph state/reducers/checkpoints, interrupts and human approval, LangChain create_agent middleware, and Deep Agents.

LangChain / LangGraph

Show all 6 lessons

Lesson 1 of 6

Workflow vs Agent

A workflow is code-defined control flow with LLM calls at certain steps. An agent lets the model choose the next step. Start with the simplest thing that works: a single call, then a chain, then a routed workflow, and only then an autonomous agent.

PatternShapeUse when
Prompt chainA → B → CFixed steps, each easier with the previous output
Routerclassify → branchDistinct input types need different handling
Parallel / map-reducefan out → mergeIndependent subtasks or voting
Orchestrator-workersplan → dispatch → combineSubtasks unknown until runtime
Evaluator-optimizergenerate ↔ critiqueClear quality criteria, iterative refinement
Autonomous agentloop with toolsOpen-ended tasks where steps cannot be predicted

Signal

Default to a workflow and justify autonomy. Interviewers reward candidates who reduce nondeterminism where they can.