Hands-on companion · Chapters 04–14
One small project, grown one lesson at a time, in nothing but the Python standard library. Each note ends with a Build it section; this is where the checkpoints live. By Chapter 14 the pieces are a working knowledge-graph agent.
Isolated snippets don't show how things fit. So every chapter adds one small module to the same codebase and answers the same question flat search can't — "Who leads the company that competes with the startup Microsoft acquired?" — from a new angle. No API keys, no database, no installs: the LLM is a deterministic stub you can later swap for a real client without changing anything around it.
Clone the notes repo (you already have it), then:
# from the repo root cd Projects/atlas-build python3 run_all.py # every chapter, end to end python3 -m atlas.graph # or one lesson at a time
Each module has an if __name__ == "__main__" demo, so running it prints exactly the output shown in that note's Build it section. Type the code from the note yourself; run the checkpoint here when you want to compare.
Each row links back to its lesson. Read the note, build the module, then move on — the flow doesn't break.
A tiny property graph — nodes are nouns, edges are verbs — with ego-graph traversal and a first Graph-RAG retrieval that returns topology, not text.
Open lesson → Build it ↗A Cypher-style match and one-hop walk, plus community detection as connected components — the query layer over the graph.
Turn raw sentences into clean triples and merge aliases (MSFT → Microsoft) with entity resolution. The graph stops being hand-typed.
Open lesson → Build it ↗Put a vector on every node, jump to an entry node by cosine, walk the ego graph, and prune super-nodes — the three-phase engine.
Open lesson → Build it ↗A 60-line DSPy: a signature is a typed contract, a module renders + parses, and compile bootstraps few-shot demos. The prompt becomes a build artifact.
The engine underneath LangGraph: StateGraph with nodes, edges, and an invoke that merges each node's update into shared state.
Conditional edges make it an agent, not a pipeline — a router picks the next node, cycles become possible, and a recursion limit becomes mandatory.
Open lesson → Build it ↗Every piece so far becomes a node: retrieve → synthesize, wired with a conditional edge. The whole QA agent, expressed as State + Nodes + Edges.
Open lesson → Build it ↗Thought → Action → Observation, looping over graph tools until it can Finish — with the hard step limit every production loop needs. Answers Elena leads Nimbus.
Open lesson → Build it ↗A checkpointer snapshots state after every step, keyed by thread_id. State survives a process restart; two threads stay fully isolated.
Unbounded memory is its own bug. A custom reducer appends turns; a maintenance node keeps recent verbatim, compresses the rest into a running summary, discards the raw.
Open lesson → Build it ↗