Skip to chapter content
navan✳THE BUILD LABAI ENGINEERING / GUIDE
0/21 read
COMPLETE CODE / FULL EXPLANATIONS

The AI cookbook.

Read a full workflow from its purpose to its limits. These local Python references show the engineering decisions around a model. There are no exercises, accounts, or model keys required.

← Return to the reading course
01 / 08

A model call with an honest boundary

Wrap a fallible generator in a small response contract and distinguish transport success from task success.

Model call contract · Structured output · Architecture
02 / 08

A structured routing decision

Parse JSON, validate a small schema, and keep invalid model output away from downstream actions.

Sampling and structure · Structured workflows · Evaluation
03 / 08

A tiny grounded answer pipeline

Search approved passages, construct a labelled context, and decline when evidence is absent.

Retrieval foundations · Search and ranking · Prompt design
04 / 08

An evaluation report that explains failure

Score retrieval and answer behavior by slice instead of hiding everything in one average.

Evaluation data · Judging generated answers · Search and ranking
05 / 08

A bounded tool-using workflow

Let a planner request read-only tools while software enforces permissions and a step limit.

Tools and agents · Security and trust · Conversation state
06 / 08

A prompt injection boundary

Keep retrieved content as quoted evidence and filter allowed documents before prompt construction.

Prompt design · Retrieval foundations · Security and trust
07 / 08

Measure cost and cache with context

Estimate request cost and construct a cache key that includes prompt, document, and permission versions.

Inference economics · Serving architecture · Monitoring
08 / 08

A release gate and monitoring loop

Turn task, permission, holdout, fallback, and live status into an explicit release decision.

Use-case contract · Serving architecture · Monitoring and feedback
Built with curiosity. By Navan Sami. ↗AI engineering · From model calls to reliable systems.