Practical AI/LLM Engineering
Tutorials, debugging guides, and honest comparisons for developers building real things with LLMs — agents, retrieval, structured output, evaluation, cost, and deployment. Every code sample here has actually been run, not just written.
- Why Your AI Agent Forgets Things Mid-Task (and Three Memory Patterns That Fix It)
LLM agents don't have memory — they have a context window. Here's what actually breaks, and three concrete patterns to fix it, with code.
- MCP vs. Tool Calling vs. Function Calling: What's the Difference?
MCP, tool calling, and function calling get used interchangeably and shouldn't be. The one-paragraph answer, then a working code example of each layer.
- MCP Servers Explained: What They Are, and When You Shouldn't Bother
MCP solves a real portability problem. It also adds real overhead. Here's how to tell which situation you're in before you reach for it.
- Multi-Agent Orchestration: When One Smart Agent Beats Five Specialized Ones
Multi-agent architectures are the default answer in a lot of tutorials. They're also the more expensive, more fragile option in most real cases. Here's how to tell which situation you're in.
- Debugging an Agent That 'Hallucinates' a Tool Call: A Field Guide
'The model hallucinated' is where most debugging stops and where it should start. Five concrete causes, in the order to check them.
- Self-Hosted vs. API-Based Agents: Real Cost and Latency Numbers, Not Vibes
Actual August 2026 pricing for API providers and GPU instances, with a real breakeven calculation instead of a hand-wave toward 'it depends.'
- How to Stop an Autonomous Agent From Doing Something Destructive
A practical permission-boundary pattern: classify actions before you build the agent, not after something irreversible happens.
- Context Window Management for Long-Running Agents: Compaction Strategies Compared
Four ways to keep a long-running agent inside its context window, what each one costs you, and how to pick.
- What 'Agentic' Actually Means vs. the Marketing Use of the Word
'Agentic' has been stretched to cover everything from a single API call to a genuine autonomous loop. Here's the actual line, with code on both sides of it.
- Prompt Injection in Agent Tool Results: What It Looks Like and How to Guard Against It
The most common agent security hole isn't the prompt you write — it's the data your tools bring back. Here's the concrete shape of the attack and three real mitigations.
- Evaluating Agent Reliability: A Lightweight Eval Harness You Can Build in an Afternoon
You don't need an eval platform to know if your agent got worse after a prompt change. Here's the minimum harness that actually catches regressions.
- Agent Observability: What to Log So You Can Debug Failures After the Fact
By the time an agent fails in production, the conversation that caused it is usually gone. Here's the minimum logging schema that fixes that.
- How to Version-Control Prompts Without Losing Your Mind
Prompts drift, get edited in five different places, and nobody remembers which version is live. A minimal versioning scheme fixes it.
- What Breaks First When You Scale an Agent From a Demo to Production
A demo working reliably on the three inputs you tried it on tells you almost nothing about production. Here's the order things actually fail in.
- Getting Reliable Structured Output From LLMs: What Actually Works
JSON mode still breaks in production. Four layers of defense, from cheapest to most robust, and why you probably need more than one.
- Fine-Tuning vs. RAG vs. Better Prompting: An Honest Decision Framework
All three fix different problems. Reaching for the wrong one is the most expensive mistake in applied LLM work — here's how to tell which one you actually need.