A structured pattern library for engineers building AI systems in production. Named patterns with trade-offs, when-to-use guides, and code examples for every layer of a production AI system.
The same way the Gang of Four gave software engineers a shared vocabulary for code design, AI Engineering Patterns gives AI engineers a shared vocabulary for shipping reliable, cost-effective, and trustworthy AI systems.
- A curated set of named patterns organized into 10 pillars.
- Every pattern includes: how it works, when to use it, when NOT to use it, trade-offs, and implementation examples.
- Opinionated and practical. Written for practitioners, not researchers.
- Framework-agnostic, model-agnostic, vendor-neutral.
- Not an awesome list of links.
- Not vendor documentation.
- Not a research paper collection.
- Not AI-generated content without human review.
| # | Pillar | Covers |
|---|---|---|
| 1 | Inference & Serving | Gateways, model routing, caching, fallback, batch inference |
| 2 | Data Patterns for AI | Data contracts, feature stores, training pipelines, eval datasets |
| 3 | Reliability & Resilience | Circuit breakers, graceful degradation, canary deployments, rollback |
| 4 | Retrieval & Memory | RAG variants, hybrid search, reranking, contextual memory |
| 5 | Observability & Monitoring | Tracing, cost attribution, quality drift, SLOs for AI |
| 6 | Security & Trust | Input sanitization, output validation, PII handling, audit trails |
| 7 | Cost & Efficiency | Token budgets, model tiering, prompt compression, cost breakers |
| 8 | Governance & Compliance | Model cards, data lineage, policy-as-code, human-in-the-loop |
| 9 | Graph Patterns | GraphRAG, graph-of-thoughts reasoning, entity resolution |
| 10 | Evaluation & Testing | LLM-as-Judge, eval pipelines, regression testing, benchmarking |
Every pattern follows the same structure:
- What It Is — Plain language description
- The Problem It Solves — What breaks without this
- How It Works — Step-by-step with diagrams
- When to Use It — Specific conditions
- When NOT to Use It — Explicit anti-use-cases
- Trade-offs — Honest costs of the pattern
- Implementation Example — Minimal working code
- Tool Landscape — Tools that support the pattern
- Related Patterns — Adjacent patterns
- Further Reading — External references
Visit prajwalamte.github.io/AI-Engineering-Patterns to read patterns with full-text search, navigation, dark mode, and an interactive pattern graph showing how patterns relate across pillars.
cd web
npm install
npm run devOpen http://localhost:3000.
node scripts/validate-schema.jsSee CONTRIBUTING.md for how to propose and write patterns.
Every pattern must include a "When NOT to Use It" section. This is what makes the knowledge base opinionated.
| Status | Meaning |
|---|---|
proposed |
Identified, not yet validated |
emerging |
Used by early adopters |
validated-in-production |
Widely used, trade-offs well understood |
ai-engineering-patterns/
├── web/ # Next.js 16 site (App Router)
│ ├── app/ # Pages and layouts
│ ├── components/ # PatternHeader, Sidebar, TOC, ArticleBody, etc.
│ ├── lib/ # patterns.ts helpers
│ ├── public/diagrams/ # Excalidraw SVG exports
│ └── velite.config.ts # Content pipeline (Zod schema + markdown)
├── content/
│ ├── patterns/ # 20 patterns across 10 pillar directories
│ ├── case-studies/ # Production case studies
│ └── guides/ # Getting started, decision guide, glossary
├── schema/ # JSON Schema for pattern frontmatter (reference)
├── scripts/ # validate-schema.js (runs Velite, checks pillar alignment)
├── .github/ # Actions (deploy to GitHub Pages, validate on PR)
├── CONTRIBUTING.md
├── CODE_OF_CONDUCT.md
└── LICENSE
MIT