The lab notebook
Field notes on AI engineering
824 articles · page 7 of 28
Using Claude Code on Python Projects
A practical guide to running Claude Code on Python codebases: setup, CLAUDE.md conventions, virtual environments, test loops, and the permission rules that keep it safe.
Configuring Claude Code Permissions: A Practical Guide
Learn exactly how Claude Code permissions work, from allow/ask/deny rules to settings.json scopes and Bash glob patterns, so your agent runs fast without silently touching files it shouldn't.
CLAUDE.md and Memory Files in Claude Code
Claude Code memory is not one file, it is a hierarchy of CLAUDE.md files, local overrides, and imports that decide what your agent knows before it types a single command. Here is how to structure it so it helps instead of bloating context.
Automating Your Workflow with Claude Code Hooks
Claude Code hooks let you run your own shell commands at specific points in Claude's workflow, turning a coding assistant into a fully scripted, auditable part of your pipeline. Here is how they work and how to build real ones.
Adding Custom Tools to Claude Code with MCP
A practical, code-first walkthrough of building and wiring up Claude Code custom tools with the Model Context Protocol, from your first server to production-ready scoping and security.
AI Workflow Versioning: A Practical Guide for Engineering Teams
Your prompts changed, your model changed, and nobody knows which version produced last week's output. Here is how to set up ai workflow versioning that actually holds up in production.
AI Supply Chain Security
A hands-on guide to AI supply chain security for engineers: how to lock down models, datasets, and ML dependencies with real commands, signing, and provenance you can verify.
Secrets Management for LLM Applications
A hands-on guide to LLM secrets management: keeping API keys, tokens, and connection strings out of prompts, logs, code, and model context, with runnable code and real commands.
A Guide to Prompt Injection Defense
Prompt injection is the top security risk for LLM apps, and no single trick stops it. Here is a layered, code-first playbook working engineers can ship this week.
Preventing LLM Jailbreaks
A working engineer's guide to LLM jailbreak prevention: the attack classes that actually get through, layered defenses you can ship, and runnable code for input screening, output checks, and red-team testing.
Preventing Data Exfiltration in AI Agents
A working engineer's guide to agent data exfiltration: how untrusted content turns your tool-using LLM into a leak channel, and the concrete controls, code, and commands that stop it.
Tool Error Recovery in AI Agents
Agent tool errors are inevitable in production, not exceptional. Here is how to design retries, structured error feedback, and fallback logic so your agents recover instead of crashing.
Streaming Agent Responses to Users: A Practical Implementation Guide
Learn how agent streaming turns a silent multi-second wait into a live feed of tokens, tool calls, and reasoning steps, with working SSE and WebSocket code you can drop into a production agent.
Agent State Persistence: How to Keep AI Agents Remembering Across Sessions
Your agent forgets everything the moment the process exits. Here is how to design agent state persistence that survives restarts, deploys, and crashes without turning into a debugging nightmare.
Retry and Backoff Patterns for AI Agents
A rate limit or a flaky tool call shouldn't take down your whole agent run. Here's how to build agent retry logic with exponential backoff, jitter, idempotency, and circuit breakers that actually holds up in production.
Handling Multimodal Inputs in AI Agents
A practical guide to accepting images, audio, PDFs, and screenshots in your agent loop without breaking your context window or your tool-calling logic.
Long-Term Memory Systems for AI Agents
A hands-on guide to building agent long-term memory that actually survives context resets, with working Python code, retrieval scoring, and the pitfalls that quietly wreck production agents.
Human Approval Gates in Agent Workflows
Learn how to add human approval gates to agent workflows so an LLM can propose actions but a person confirms anything risky, with working code for tool interception, LangGraph interrupts, and MCP elicitation.
Tracking AI Agent Costs Per Run
A working pattern for attributing token spend to a single agent run, tool call, and subagent, so you can answer "what did that run cost" without guessing.
Managing the Context Window in Long Agent Runs
Long agent runs die from context bloat, not bad prompts. Here is how to compact, externalize, and delegate so an agent context window survives thousands of tool calls without losing the thread.
XML vs Markdown for Structuring Prompts
XML tags and Markdown headings both organize a prompt, but they solve different problems. Here's how to pick the right one, with runnable examples for each.
Building Voice AI Agents in 2026
A practical guide to building voice AI agents in 2026: the architecture choices, latency budget, and tool-calling patterns that separate a demo from something people actually use.
Visual AI Workflow Builders Compared
A hands-on comparison of the leading visual AI builders, what each one is actually good at, and how to pick the right one before you spend a weekend building the wrong workflow.
Tracking Token Usage Across an Organization
Your LLM bill is growing and nobody can say which team, feature, or prompt is causing it. Here is how to build token usage tracking that actually answers that question.
System Prompt Design That Holds Up in Production
Most system prompts fall apart the moment real users show up. Here is how to structure, test, and version a system prompt so it survives contact with production traffic.
Getting Reliable JSON and Structured Output from LLMs
Stop regex-parsing broken JSON out of model responses. Here's how structured output and forced tool calls actually guarantee a schema, with working code and the failure modes each approach still leaves open.
Self-Hosting Open LLMs: A Practical Guide
Self hosting LLMs cuts your per-token cost to near zero but shifts the cost to your own time. Here is what actually breaks, what hardware you need, and when to skip it entirely.
Rubric-Based Scoring with LLM Judges
A pass/fail eval tells you something broke, not why. Rubric scoring with an LLM judge turns vague quality checks into consistent, debuggable numbers you can actually track over time.
Regression Evals in CI: Catching Model Drift
A prompt tweak or a silent model upgrade can quietly tank quality. Here is how to wire regression evals into CI so you catch drift before your users do.
Extracting Tables for RAG: Parsing PDFs and Spreadsheets
Naive PDF-to-text pipelines mangle tables into unreadable noise. Here is how to extract, structure, and chunk tabular data so your RAG system can actually answer questions about it.