AIEP

Decision Guide

Start from the problem you have today and find the two or three patterns worth reading first.

Nobody needs all 50 patterns. Find the problem that sounds most like yours below, read the patterns it points to, and run their examples. Each one is a single pytest command.

"Our LLM bill is too high"

Measure before you optimize. Put an LLM Gateway in front of your model calls so you know which feature is spending what. Then:

"The provider had a bad day and so did we"

"The RAG answers are wrong"

Work through these in order. Each one fixes a different layer.

  1. The right document isn't retrieved (exact terms, IDs, error codes) → Hybrid Search
  2. Irrelevant chunks get in, or the bot answers when it should say "I don't know" → Retrieval Quality Gate
  3. Old versions of documents win → Retrieval Freshness Watermark
  4. The top-5 results all say the same thing → Semantic Deduplication
  5. Good context, but the answer adds details that aren't in it → Grounding Verifier. If the facts can be read by code (numbers, names, statuses), go further with the Extract–Explain Split so the model never produces them.
  6. Users search a structured catalogue, and an invented result is worse than none → Intent-Only Retrieval
  7. The question is about relationships ("who owns what depends on X") → GraphRAG, with Entity Resolution Graph to keep the graph clean
  8. Upstream data keeps changing shape under you → Data Contract

"We changed a prompt and something broke"

"We can't see what's going on"

"We're building agents"

A reasonable starting stack, in the order you'll need it:

  1. Loop Termination: every loop needs a stop rule before it needs anything else.
  2. Guardrails with a tool policy: decide what the agent may do in code.
  3. Human-in-the-Loop for anything irreversible.
  4. Tool Output Firewall as soon as the agent reads web pages, emails or user-written data.
  5. Span-Level Tracing, because you can't debug agents without it.
  6. Context Compaction once sessions get long.

When agents start doing real work unattended:

"Security or compliance is asking questions"

"Long conversations go off the rails"