Guides
In-depth practical guides on AI/ML engineering, agentic systems, and production deployments
Series overviews
Each series has a landing page with the full arc and where to start.
GenAI Architectures
There are eight architectures and seven boundaries between them. Every boundary is a yes-or-no question about the task — not a judgment call about the design.
Chat Templates
A chat template is the contract between your messages and the exact token stream the model was trained on. Get it wrong and nothing raises — the model just gets quietly worse.
Agentic AI with LangGraph
An eight-part guide to the part of agent engineering nobody demos: making the thing survive a restart, a concurrent write, a bad tool call, and a Tuesday deploy.
Harness Engineering
AI systems do not fail at the model layer. They fail in the code around it — and that code is a designable layer with its own architecture.
Harness Engineering: The Book
The harness is a control system. Every component in it is a sensor, a comparator, a gate, or a bound — and anything else is application code.
RAG Engineering
Most RAG failures happen upstream of the LLM, accumulate invisibly, and only surface as an incident. This series names each one.
Claude Code Playbook
Claude Code has four layers — context, skills, subagents, hooks — and the variable that decides which one you need is enforceability, not capability.
AI Control Plane
A fleet of agents needs a layer that is not itself an agent — observability, policy, orchestration, versioning, cost, and audit, built as infrastructure.
Agentic AI in the Data Center
In physical infrastructure, an agent’s autonomy is capped by reversibility and jurisdiction — not by how good the model is.
Codebase to Architecture Doc
A three-pass methodology for compressing any codebase into validated diagrams and decisions — and then a LangGraph pipeline that runs it for you.
Federated AI Agents
Every call that crosses from one owner to another is a seam, and a seam has five properties — contract, authority, state, failure, and accountability — that are free inside one deployment and have to be built across it.
A2A, MCP, or Subgraph? 'Deployed Separately' Is the Wrong Reason
The usual A2A rule feeds its own output back in as its input. The Federation Test asks who owns the other side first, and a CI check over the compiled graph catches the mistake in both directions.
LangGraph interrupt() Re-Sends Your A2A Task on Resume
LangGraph re-runs an interrupted node on resume, and every standard fix assumes the side effect is yours. At an A2A seam the partner's question is the reply to your send, so the fix is a record of the partner's task, and where you keep it decides who can read it.
A2A Agent Card Versioning: a Version Bump Is Not a Contract
A version bump tells callers that something changed, and a dated notice tells every caller the same thing. From the caller's side, only dated terms checked against what each caller depends on warn the right caller early.
A2A Idempotency: Your Retry Key Lives in Partner Memory
A resend under the same messageId is safe only while the partner reads the key and still remembers it. The duplicate it lets through leaves your own ledger clean, and nothing you read back from the partner except its task list shows it.
A2A Saga Compensation: Your Undo Outlives Its Authority
Across an owner line, an undo is a new task the partner may refuse, sent long after the authority that took the step has expired or been revoked. It needs authority of its own, and only the owner that took the step may send it.
A2A Contract Testing: Check the Task, Not the Call
On an A2A seam whose send returns at once, the answer is SUBMITTED whatever the task does next. A partner refactor that turns your refusals into its failures passes every check keyed to the call. Key the contract test to the task, and have the partner run it.
Harness Engineering Without an Oracle: What Transfers
The famous harness results were scored by tests your agent does not have. The hook transfers once you move it in front of the action. The oracle its check read stays behind.
LLM Trust Boundaries: Draw Them by Reach, Not by Author
Your system prompt, your runbook and your own tool results reach the model the same way a customer's ticket does. A rule written there is a measured habit of the model, not a control.
LLM Guardrails That Stop Nothing: The Role Test
A guardrail counts only if the action can fail because of it. Classify every component by that power, then make CI fail when a verdict has nothing that can refuse on the other end.
LLM Input Validation: Judge the Record, Not the Clean Input
The input failure no detector is built for needs no attacker: your own words come back under a customer's label. Split the entry point into a sensor that records what it changed and a gate that never cleans.
LLM Context Window Management: The Policy Nobody Wrote
Every fit-to-window loop runs a policy nobody wrote, and its quietest failure is a constraint summarised into a sentence that constrains nothing. Give the context budget a floor, and refuse below it before the model is called.
AI Agent Decision Logs: Catch the Refund No Control Decided
Traces and decision logs record the checks that ran. Neither can show the check that should have run and never did, until the harness declares which decisions each action is owed.
LLM Output Repair: A Re-ask That Passes Can Still Be a Guess
Re-asking with the validation error is safe for a broken JSON shape. Send a content correction back and the model learns what passes, so the next pass no longer says the answer is right.
LLM Fallback Models Inherit Authority They Never Earned
One gateway can check that the prompt fits the fallback model. None I found checks whether that model may issue the refunds your agent was allowed to make on the primary, or counts the requests it spends while it does.
AI Agent Approval Gates: Failed Checks Must Never Widen
Send every failed guardrail check to a human, and in a mode with no reviewer the suspicious refund becomes one somebody may approve while its clean twin is refused.
Strict Tool Schemas Aren't Enough: Narrow LLM Tool Calls
A strict schema makes a refund call well-formed. It does not stop the model from choosing the account and the amount, and every check after it is judging those choices.
Indirect Prompt Injection: Tool Calls Don't Say Who Asked
Once a tool is narrowed, an injection no longer needs a wrong value. It needs a real one that someone other than the customer chose, and no check that reads only the proposal can tell who chose it.
LangGraph Interrupt Resume: Approvals Run on Stale Facts
A human approval is a checkpoint resume. It restores what the agent read before the pause, and the world kept moving while the reviewer was away.
AI Agent Spend Limits Pay for the Call That Crosses Them
A budget checked against what the run has already spent fires one unit late. Reserve the declared worst case of the next call, refund or fan-out before it runs, and settle the real cost after.
Earned Autonomy for AI Agents: What a Track Record May Widen
A clean month tells you how often the agent is wrong, not what being wrong costs. Let good behaviour widen throughput, and hold the two numbers that consequence sets.
Testing AI Agent Guardrails: Green Suites Hide Dead Controls
An adversarial suite proves that something refused each bad output. It does not prove that the control claiming that output works, and two ordinary things hide the difference.
AI Agent Failure Attribution: Why the Model Gets the Blame
My book's attribution protocol never clears a layer on a missing record. It convicted the model with four questions unanswered, and its own test suite pins the behaviour.
AI Agent Guardrail Monitoring: A Refusal Is Not Proof of Life
My book's readiness check says GO on both of its own incidents: a gate that refused 406 tickets in one night, and a ceiling that a reviewed refactor stopped counting.
LangGraph Guardrails: A Node That Skips the Executor
The same refund, on an invoice the customer does not own, is refused by my book's executor and paid by its LangGraph graph, and neither an import test nor a tool-name grep can see why.
The 7 GenAI Architectures Every AI Engineer Should Know
Eight architectures, seven boundaries between them, and a decision procedure for each - so the choice stops defaulting to whoever in the design review spoke with the most conviction.
Why Your Default Branch and Your LLM Are the Same Architecture
Both answer every input. Neither is required to tell the caller which answers it invented. Until one of them is, every argument about climbing is an argument about taste.
Five Stages at 95 Percent Is Not 77 Percent
The compounding-error arithmetic is computed for the option it is used to reject, and never for the one it authorises. That is what makes it useless.
A Round Cannot Use a Fact It Has Not Received Yet
Every tool-calling schema obligates a literal value for every argument it declares. When that value depends on a fact only a sibling call's result can supply, the model does not fail to reason - the round fails to have it.
Descending: Why You Cannot Delete an Idle AI Agent Layer
Adding a layer is authorized by a proof. Removing one is authorized by a hope with a chart attached - and the chart cannot tell the difference between a layer nobody needs and a layer nobody has needed yet.
Context Engineering: The Skill That Separates Production Agents from Demos
Prompt engineering tells the model what to do. Context engineering determines whether it can actually do it.
Agent Skills Are Not Prompts. They Are Production Knowledge Infrastructure.
Every team is re-teaching their agent the same workflows on every call. Skills are how you stop paying that tax.
Subagents: How to Run Parallelism Inside a Single Agent Session Without Poisoning the Parent
Every subagent burns its own context so the parent doesn't have to. That's the entire architecture.
Hooks: The Enforcement Layer That Turns Agent Policy Into Agent Fact
Prompts suggest. Hooks enforce. Until you know the difference, your agent's safety guarantees are probabilistic.
Which Claude Code Layer Solves Your Problem? A Diagnostic Guide for AI Engineers
Reaching for a subagent when you needed a skill is the most common mistake teams make. Here is how to stop making it.
Four Habits from the Creator of Claude Code That Will Change How You Ship
Boris Cherny runs 10-15 parallel sessions, ships 20-30 PRs a day, and calls his setup 'surprisingly vanilla.' The gap is not configuration. It is operating model.
You Can't Debug What You Can't See: Observability for Claude Code Sessions
Most Claude Code failures leave no trace. Here is how to build the audit trail that tells you exactly what happened, why it went wrong, and how to stop it happening again.
How to Know Your Claude Code Setup Actually Works: Testing Beyond the Skill Level
Skill evals tell you a skill works in isolation. They do not tell you whether your agent produces consistently good code. That requires a different kind of test.
Skills vs Hooks in Claude Code: Enforceability Is the Design Variable
A skill is a suggestion the model may follow. A hook is a gate it cannot see and cannot argue with. Most production agent failures come from confusing the two.
Checkpoint Complacency: Claude Code /rewind vs Git Commits
Checkpointing feels like git. It covers a fraction of what git covers - and that gap is exactly where real work gets lost.
Headless Claude Code: When the Human Leaves the Loop, Hooks Are All You Have Left
Running Claude Code in CI strips away every safety net that needs a human - approval, rewind, reading the output. What's left is what you enforced in advance.
Claude Code Subagent Token Cost: The Preamble Never Stops
I measured 856 Claude Code subagent spawns. The preamble is not a one-time fee. It recurs on every turn, and it comes to about a quarter of the bill at every scale.
LangGraph or a While Loop? You Already Have a Runtime
A checkpointer makes the run's past readable and leaves its next-step space exactly as wide as it was. Production agents fail in that gap.
LangGraph Reducers Are a Concurrency Policy
Rename a node and the answer changes. The code that decides how concurrent writes merge lives inside a type annotation, appears on no diagram, and the docs decline to guarantee its order.
LangGraph create_agent: The Graph Isn't the Runtime
The rendered diagram now lists your tools. It still says nothing about which one may run from which state - the constraints that decide the next step live in middleware nobody draws.
LangGraph Checkpoints Restore Your Limits, Not Just Your State
Every bound the runtime gives you is re-derived from checkpointed state on entry. Resume, retry, or just take a second turn, and it arrives at full - by working exactly as designed.
LangGraph Compaction Deletes the View, Not the Record
Your summarizer removed the message from state. Seventeen checkpoints on disk still have it, and an ordinary fork puts it back.
LangGraph's recursion_limit Bounds Depth, Not Width
A limit of 4 let 1,000 workers run. The bound is real, it is enforced, and it counts the one axis the runtime knows how to count.
LangGraph Evals Test the Answer, Not the Thread
One approval decision fired the charge three times. Both output assertions passed, and every checkpoint on the thread recorded nothing about it.
LangGraph Names the Guarantee, Not the Unit
Seven parts of measurement found one recurring shape: the bound is real, it is correctly enforced, and it is scoped to something you did not assume.
Agentic AI in the Data Center: Operational Authority Gradient
Six use cases, one framework, and the uncomfortable reason 'self-healing' is the wrong goal.
Cooling Is Agentic AI's Most Mature Use Case - and Most Misread
Everyone quotes DeepMind's 40 percent. The number that actually matters is 30.
Self-Healing Infrastructure: Diagnosis, Not Action
The MTTR you save is in understanding, not action. The marketing sells you the action.
AI Workload Placement: Borrowed Reversibility, Not Owned
The scheduler gets to act because the job can be moved. Whether it can be moved is someone else's problem - until it's the scheduler's.
Data Center Power: Being Right Doesn't Grant Grid Authority
Every other use case caps autonomy on physics. This one caps it on jurisdiction - and the agent can't measure a law.
Authority Doesn't Compose: Why Coordinated Agents Need a Coordinator With Its Own Band
Two agents each acting inside their limits can commit a decision neither was allowed to make. The buildout is where that bites hardest.
AgentOps: A Band Is a Comment Until Something Enforces It
Six articles said enforce the boundary outside the agent. This is what the outside is made of - and almost nobody has built it.
Why Your RAG System Is Using the Wrong Retrieval Strategy
A practitioner's guide to vector-based, vectorless, hybrid, corrective, and agentic retrieval architectures.
Why Your RAG Chunks Are Lying to Your Retriever
Chunking strategy is the upstream failure that no retrieval optimization can fix - a practitioner's guide to fixed-size, recursive, semantic, hierarchical, late, and contextual chunking and when each one silently breaks.
Why Your Embeddings Are the Wrong Shape for Your Domain
Your embedding model was trained on the internet. Your documents are not the internet. Here is what that mismatch costs in production and how to fix it.
Why Your Reranker Is the Last Line You Forgot to Build
Retrieval gets you recall. Reranking gets you precision. Skipping it means your LLM reads the wrong documents with complete confidence - and you will not know until production.
Why Your RAG System Cannot Tell When It Is Wrong
Most RAG pipelines measure answer quality and ignore retrieval quality - which means the Retrieval Tax, Chunking Debt, and Precision Gap from Parts 1 through 4 are accumulating invisibly, query by query, until a production incident forces the question.
Why Your Agentic RAG System Costs 10x More Than It Should
Wrapping a well-built RAG pipeline in an agent loop multiplies every cost in the stack by the number of retrieval iterations - and most teams have no budget ceiling, no per-session spend tracking, and no circuit breaker.
Why Your RAG Knowledge Base Is Lying About What It Knows
The vector index is a snapshot of your documents at ingestion time. Semantic similarity has no relationship to temporal validity. A document from 18 months ago can score 0.94 cosine similarity and still be completely wrong today - and nothing in the standard RAG pipeline raises a flag.
Why Your RAG Pipeline Assembles Context Wrong
Retrieval finds the right document. Context assembly decides whether the LLM reads it. Most teams treat this as a pass-through - and pay for it in accuracy, cost, and latency.
Agent Fleet Observability: Why Dashboards Miss Running Loops
Every agent-level signal in the OpenTelemetry GenAI spec is recorded when the agent exits. An agent stuck in a loop never exits, so the agent-level dashboard stays green while it burns tokens.
Agent Policy Enforcement: Why Copied Guardrails Fail
A guardrail copied into every agent is enforced at the strength of its oldest copy, so revoking a host takes as long as your slowest release train. One policy source on the one path every tool call takes brings it down to the policy polling interval.
Multi-Agent Pipeline Orchestration and Failure Propagation: Designing for Blast Radius
Retry logic tells an agent what to do when it fails. A pipeline halt protocol tells the entire fleet what to do. Most production systems only have one of these.
Agent Versioning and Deployment Strategies: Shipping Agent Updates Without Breaking Running Pipelines
Deploying a new agent version into a live multi-agent pipeline is not a software deployment. It is a distributed state migration - and most teams treat it like the former.
Cost Governance and Budget Allocation Across Agent Types: Token Spend Is Infrastructure Spend
Most teams discover their agent fleet's true cost on the invoice. By then, three budget cycles of misconfigured pipelines have already run.
Compliance, Audit Trails, and Regulatory Requirements for Agentic Systems
EU AI Act transparency obligations are in force now. High-risk enforcement lands December 2, 2027. The gap between running agents and running auditable agents is not a documentation problem. It is an architectural one.
Harness Engineering: The Missing Layer Between LLMs and Production Systems
Why AI systems don't fail at the model layer - and how designing the right execution harness turns brittle prompts into reliable infrastructure
Normalization and Input Defense: Hardening the Entry Point of Your LLM System
Every unreliable LLM system has a porous entry point. Here's how to build the layer that shrinks what the model can see, and why it still can't be your only defense against prompt injection.
Context Engineering: What the Model Sees Is What the Model Does
Lost in the Middle and context rot aren't model bugs to wait out. They're context design failures - and fixing them requires treating the context window as managed infrastructure, not a dump bucket.
Gated Execution: Why Your Agent Should Never Act Without Permission
Valid output is not safe output. The Gated Execution layer is the firewall between what the model proposes and what the system actually does - default-deny policy, dry runs, and approvals that survive a restart.
Validation Layer Design: Building the Reflex That Catches What the Model Gets Wrong
Provider strict mode now fixes the shape of model output. It doesn't fix the meaning. The Validation Layer is what stands between a well-formed wrong answer and your downstream systems.
Retry, Fallback, and Circuit Breaking: Building LLM Infrastructure That Survives Outages
Your LLM provider will have an incident. The question is not whether your system fails when that happens - it's whether your retries, breaker and fallback were designed for it, and tested, beforehand.
State Management for Agentic Systems: How to Build Agents That Don't Start Over
A long-running agent without state management is a gamble. Checkpoints keep its work, keys written before each side effect keep it from repeating, and something outside the process has to restart it.
Deterministic Constraint Systems: Building Tool Registries That Keep Agents in Scope
The model will try to use tools it doesn't have, with parameters that don't exist. A closed, fail-closed registry is how you make every one of those calls fail in code instead of in production.
From Unknown Codebase to Architecture Document: A Complete Practitioner's Guide
A 3-pass methodology for compressing any codebase - in any language, any architecture style - into validated diagrams, debt scores, and decisions that engineering teams and stakeholders can actually act on
From Unknown Codebase to Architecture Doc, Automated - Building the LangGraph Pipeline
How ArchLens - a 12-node LangGraph pipeline - turns any Git repository into a validated architecture document: state design, chunking logic, all four validation gates, human-in-the-loop review, and production-ready error recovery