AI Wisdom
Patterns

AI Engineering Patterns

Reusable architectural patterns for production AI systems. Each pattern includes a problem statement, solution blueprint, trade-offs, and when-to-use guidance.

17 patterns documented

Pattern 01

Circuit Breaker for LLMs

Solves

Prevent cascading failures by temporarily stopping requests to a failing LLM provider and automatically recovering when it stabilises.

ai engineeringsystem designmodel servingllm monitoring
Read the patternOpen →

Pattern 02

Context Compression

Solves

Compress conversation history or retrieved documents to fit within context window limits while preserving critical information.

ai engineeringragagentic workflowscontext windows
Read the patternOpen →

Pattern 03

Evaluation-Driven Development (EDD)

Solves

Build eval suites before building AI features, then measure quality continuously — the test-driven development of AI systems.

ai engineeringai observabilityllm evaluationoffline evals
Read the patternOpen →

Pattern 04

Fallback Chain

Solves

Route LLM requests through a prioritised list of models/providers, falling back to alternatives on rate limits, errors, or latency SLO violations.

ai engineeringmodel servinginference
Read the patternOpen →

Pattern 05

GraphRAG

Solves

Augment vector search RAG with a knowledge graph layer to enable multi-hop reasoning over entity relationships.

ai engineeringragvector search
Read the patternOpen →

Pattern 06

Guardrail Sandwich

Solves

Wrap every LLM call with input validation and output validation layers to enforce safety, quality, and schema compliance.

ai engineeringguardrailsprompt engineering
Read the patternOpen →

Pattern 07

Human-in-the-Loop (HITL)

Solves

Insert human approval checkpoints in agent workflows for high-stakes, irreversible, or high-uncertainty actions.

agentic systemsagent architecturemulti agent orchestration
Read the patternOpen →

Pattern 08

Intent Router

Solves

Classify user intent first, then route to specialised handlers — cheaper models for simple tasks, expensive models for complex ones.

Read the patternOpen →

Pattern 09

Plan and Execute

Solves

Separate planning (powerful model) from execution (cheaper models) for complex multi-step tasks, reducing cost while maintaining quality.

agentic systemsplanning loopsagent architecture
Read the patternOpen →

Pattern 10

Prompt Versioning

Solves

Manage prompts as code artifacts with version control, review, and rollback — treating prompt changes with the same rigour as code changes.

ai engineeringprompt engineeringllm evaluation
Read the patternOpen →

Pattern 11

ReAct Agent

Solves

Interleave Thought → Action → Observation cycles so the LLM reasons before invoking tools and adapts based on results.

agentic systemsagent architectureplanning loops
Read the patternOpen →

Pattern 12

Reflection Pattern

Solves

Have the agent critique its own output and iteratively refine it before returning the final result.

agentic systemsai engineeringagent architectureagent evaluation
Read the patternOpen →

Pattern 13

Semantic Cache

Solves

Cache LLM responses by semantic similarity of the prompt rather than exact string match, reducing cost and latency for similar queries.

Read the patternOpen →

Pattern 14

Streaming Pipeline

Solves

Stream LLM tokens through a processing pipeline to the client, showing output progressively and enabling real-time safety checks.

ai engineeringllm streamingmodel serving
Read the patternOpen →

Pattern 15

Tenant Isolator

Solves

Ensure strict data isolation between tenants in multi-tenant LLM applications through namespace partitioning and context boundaries.

Read the patternOpen →

Pattern 16

Tiered Retrieval

Solves

Combine keyword search (BM25), semantic search (vectors), and re-ranking in a multi-stage pipeline for optimal RAG quality.

Read the patternOpen →

Pattern 17

Token Budget Gate

Solves

Enforce per-user, per-tenant, or per-request token limits to prevent runaway costs in multi-tenant LLM systems.

Read the patternOpen →