The lab notebook
Field notes on AI engineering
824 articles · page 3 of 28
LlamaIndex vs LangChain for RAG
LlamaIndex and LangChain solve overlapping problems but were built with different priorities: one for indexing and retrieval depth, one for orchestration breadth. This guide compares them with runnable code so you can pick correctly the first time.
Building Agents with LlamaIndex
A hands-on walkthrough of building LlamaIndex agents, from a single function-calling agent to multi-agent workflows backed by a RAG query engine.
LiteLLM Proxy: One API for Every Model
The LiteLLM proxy sits in front of OpenAI, Anthropic, Gemini, and self-hosted models so every app on your team calls one consistent API, with keys, budgets, and fallbacks handled in one place.
Composing Subgraphs in LangGraph
LangGraph subgraphs let you build large agent systems out of small, testable graphs. This guide covers state sharing, schema transforms, streaming, and debugging patterns for real projects.
Streaming Events from LangGraph: A Practical Guide
Learn how LangGraph streaming works end to end: the different stream modes, how to stream token-level output from inside a graph node, and how to wire it all into a FastAPI backend.
LangGraph Persistence with Postgres
Set up LangGraph persistence with Postgres so your agent's state survives restarts, supports human-in-the-loop pauses, and can resume any conversation thread on demand.
Human Interrupts and Approvals in LangGraph
A hands-on guide to LangGraph interrupts: pausing a graph mid-run for human approval, editing state, and resuming with Command, plus a full approval workflow you can copy into a real agent.
Streaming with LangChain LCEL
Learn how LangChain LCEL streaming works under the hood, when `.stream()` silently falls back to batch mode, and how to wire token-by-token output into a FastAPI endpoint.
Caching LLM Calls in LangChain
LangChain caching stores the output of a prompt so a repeated call skips the model entirely, cutting cost and latency. This guide covers in-memory, SQLite, and Redis caches, plus cache keys, TTLs, and streaming caveats.
LangChain Agents vs Chains: When to Use Each
Chains run a fixed sequence of steps every time; agents let the LLM decide what to do next. Here's how to tell which one your workflow actually needs, with runnable code for both.
Structured Output with the Instructor Library
Learn how the instructor library turns raw LLM completions into validated Pydantic objects, with runnable examples covering retries, streaming, and nested schemas.
Building RAG with Haystack
A hands-on walkthrough of building a retrieval-augmented generation pipeline with Haystack, from document indexing to a working question-answering API.
Graph RAG vs Vector RAG
Choose the right retrieval architecture by building both approaches, testing the same questions, and measuring where each one fails. This practical guide includes runnable Python, Cypher, evaluation logic, and production design advice.
A Guide to the DSPy Framework
DSPy replaces hand-tuned prompt strings with compiled, declarative modules that Python can optimize automatically. This guide walks through signatures, modules, optimizers, and a full working pipeline.
Building a RAG Application with Dify
A hands-on walkthrough for building a retrieval-augmented generation app in Dify, from knowledge base setup to a production-ready API endpoint.
OpenAI Codex vs Aider
A hands-on comparison of the OpenAI Codex CLI and Aider, covering installation, editing modes, model support, git workflow, and which one fits your terminal-based coding setup.
Large-Scale Refactoring with OpenAI Codex
A hands-on guide to running codex refactoring across large codebases with OpenAI Codex, covering planning, batching, verification, and rollback strategy so a multi-thousand-file change stays safe and reviewable.
OpenAI Codex GitHub Integration: The Complete Setup Guide
Learn how to wire Codex into GitHub so it opens pull requests, reviews diffs, and runs coding tasks straight from issues, comments, and CI. Step-by-step setup, config files, and workflow examples included.
Writing Custom Instructions for OpenAI Codex
Codex custom instructions live in AGENTS.md files and config.toml settings, and getting them right is the difference between an agent that follows your team's conventions and one that fights you on every commit.
The Codex config.toml, Explained
A hands-on walkthrough of the Codex CLI's config.toml file, covering every major setting from approval policy to MCP servers, with copy-paste examples for common setups.
Claude Code vs Aider: A 2026 Comparison
Claude Code and Aider both let you pair-program with an AI from the terminal, but they solve different problems. Here's how they compare on setup, editing style, git workflow, and cost.
Claude Code Plan Mode vs Acting Directly
Claude Code plan mode makes the agent read your codebase and propose a plan before touching a single file, while acting directly lets it edit as it goes. Here is how to pick the right one for the task in front of you.
Using Claude Code in a Monorepo
A practical guide to running Claude Code across a multi-package monorepo without it losing context, editing the wrong package, or blowing your token budget.
Setting Up MCP Servers in Claude Code
A hands-on walkthrough for adding, scoping, and debugging MCP servers in Claude Code, from your first `claude mcp add` command to writing a minimal custom server.
Claude Code for Database Work and Migrations
Claude Code can read your schema, write migrations, and run queries directly from the terminal. Here's how to set it up safely and use it for real database work without breaking production.
Integrating Claude Code into CI Pipelines
A hands-on guide to wiring Claude Code into GitHub Actions and GitLab CI for automated code review, test triage, and release notes. Covers non-interactive mode, permission scoping, and cost control so runs stay predictable.
Claude Code Checkpoints and Rewind: The Undo Button You Actually Need
Claude Code checkpoints snapshot your files before every edit so a bad refactor is one keystroke from undone. Here is how rewind works, how it differs from git, and how to build a workflow around it.
CI/CD for LLM Testing: Building Pipelines That Catch Regressions Before Users Do
A practical walkthrough of wiring LLM evals into CI/CD, from unit-style assertion checks to nightly regression suites, so prompt and model changes never ship blind.
Generating Test Data with AI
A hands-on guide to AI test data generation: how to combine Faker, Pydantic, and an LLM to produce realistic, schema-valid, edge-case-rich datasets for your test suites.
AI Agent Workflow Patterns for Automation
A practical breakdown of the AI agent workflow patterns that actually hold up in production, with runnable code for each one and guidance on when to reach for which pattern.