The lab notebook
Field notes on AI engineering
824 articles · page 5 of 28
Role-Based Prompt Design
Role based prompting is the difference between an LLM that guesses at your intent and one that behaves like the specific expert you actually need. Here is how to design roles that hold up under real workloads.
Prompt Injection Detection: A Practical Guide for Engineers Shipping LLM Apps
Prompt injection detection is the difference between an LLM app that quietly leaks data to a malicious webpage and one that catches the attack before it does damage. Here is how to actually build it.
Prompt Guardrails and Output Validation: A Practical Guide
Prompt guardrails stop bad inputs and bad outputs from reaching production. Here is how to build input filters, schema validation, and retry loops that actually hold up.
Chain-of-Thought Prompting in 2026
Chain of thought prompting still moves accuracy on real tasks in 2026, but the technique has changed shape now that models reason internally by default. Here's what actually works now, with runnable examples.
pgvector in Production: A PostgreSQL Vector Search Guide
A hands-on pgvector guide for engineers running vector search in Postgres: index choice, distance operators, query tuning, and the operational traps that bite in production.
Using n8n Vector Store Nodes for RAG
A practical walkthrough of n8n's vector store nodes: how to wire up ingestion and retrieval workflows for RAG without writing a custom backend.
Building a Slack AI Bot with n8n
A step-by-step guide to wiring an n8n Slack bot that answers questions, calls tools, and posts back into threads, without writing a backend.
Scheduling AI Jobs in n8n
A practical guide to running n8n scheduled jobs that call an LLM, from cron syntax to retries, cost control, and monitoring, so unattended AI workflows do not fail silently.
Building AI Agent Tools in n8n
A hands-on guide to wiring HTTP, code, and sub-workflow tools into n8n's AI Agent node so your agent can actually take action, not just chat.
Building Multimodal LLM Applications: A Practical Guide
Learn how to design, build, and evaluate multimodal LLM applications that handle images, documents, audio, and video, with runnable code and real architecture decisions.
MCP Transports Compared: stdio, HTTP, and SSE
stdio, Streamable HTTP, and legacy SSE all move JSON-RPC messages for MCP, but they behave very differently under load, across networks, and in production. Here is how to pick the right one.
MCP Tool Annotations and Behavioral Hints
MCP tool annotations tell an agent whether a tool reads or writes, whether it is safe to retry, and whether it touches the outside world, before it ever runs. Here is how to set them correctly and what clients actually do with them.
Deploying MCP Servers to the Cloud
A practical, code-first walkthrough of how to deploy MCP server to production: picking a transport, containerizing it, choosing a host, and handling auth, scaling, and observability along the way.
MCP Resource Subscriptions and Live Updates
MCP resources let a client poll for data, but subscriptions turn that into a push model, so an agent finds out the moment a file, ticket, or dataset changes instead of asking again and again.
MCP Prompts: Reusable Prompt Templates for Agents
MCP prompts let you ship tested, parameterized prompt templates from a server instead of pasting instructions into every agent you build. Here's how the primitive works and when to actually use it.
Building an MCP Client from Scratch
A step-by-step guide to writing your own MCP client in Python, from the stdio handshake through tool calls, resources, and a working chat loop.
Caching Strategies for MCP Servers
Slow MCP tool calls burn agent context and money. Here's how to design MCP caching that actually holds up: cache keys, TTLs, invalidation, and the traps that make cached data lie to your agent.
How to Batch Requests in MCP Without Blowing Up Your Latency Budget
MCP batch requests let you fire multiple tool calls or JSON-RPC messages in one round trip instead of one at a time, cutting agent latency when a client needs several tool results before it can move forward.
LoRA Fine-Tuning: A Practical Guide
A hands-on LoRA fine-tuning guide for engineers: what the low-rank trick actually does, how to run it with Hugging Face PEFT, and how to pick rank, alpha, and target modules without wrecking your GPU budget.
Streaming LLM Responses with SSE in Production
A working engineer's guide to LLM streaming with SSE: the wire format, a runnable Node and browser example, and the proxy, cancellation, and backpressure traps that only show up in production.
Retries and Idempotency for LLM Calls
LLM APIs fail, time out, and get rate limited constantly. Here is how to build llm retry idempotency that survives real traffic without double-charging users or duplicating side effects.
Rate Limiting Strategies for LLM APIs
A practical guide to LLM rate limiting: handle 429s, respect token and request budgets, and keep your app up when a provider throttles you.
Defending Against Prompt Injection in Production
Prompt injection in production is not a prompt-wording problem, it is an architecture problem. Here is how to actually contain it with untrusted-data boundaries, tool allowlists, and output filtering that runs on real traffic.
PII Redaction for LLM Applications
A working engineer's guide to LLM PII redaction: where to strip personal data, which detectors actually catch it, and runnable code for a redact-then-restore pipeline.
Multi-Region LLM Deployment
A working engineer's guide to running LLM inference across regions: routing, failover, prompt-cache locality, and the data-residency traps that break naive setups.
Generating Synthetic Data for LLM Evaluation
You need a labeled eval set but have no production traffic yet. Learn how to generate synthetic eval data that actually catches regressions, with runnable code and the traps to avoid.
Safety Testing for LLM Applications
A hands-on guide to LLM safety testing: build a probe suite, run red-team attacks, wire up automated judges, and gate every deploy on measured safety, not vibes.
Evaluating Multi-Turn Conversations
Single-turn scores lie about chatbots. Learn how multi-turn evaluation actually works, with runnable Python, judge prompts, and metrics that catch the failures users hit.
Human-in-the-Loop LLM Evaluation
A practical guide to human in the loop evaluation for LLM systems: how to sample outputs, write rubrics, collect labels, calibrate an LLM judge, and turn ratings into decisions you can ship on.
Embedding-Similarity Metrics for LLM Evaluation
Word-overlap scores punish good LLM answers that use different words. Embedding similarity metrics score meaning instead. Here is how to build them, calibrate them, and know when they lie.