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 site
npm install
npm run devOpen http://localhost:4321.
cd scripts
npm install
cd ..
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/
├── site/ # Astro + Starlight documentation site
│ ├── src/
│ │ ├── components/ # PatternGraph interactive visualization
│ │ ├── content/docs/
│ │ │ ├── patterns/ # 14 patterns across 10 pillar directories
│ │ │ ├── graph.mdx # Interactive pattern relationship graph
│ │ │ └── guides/ # Getting started, decision guide, glossary
│ │ └── styles/
│ └── astro.config.mjs
├── schema/ # JSON Schema for pattern frontmatter validation
├── scripts/ # validate-schema.js
├── .github/ # Actions (deploy, validate), issue templates, PR template
├── CONTRIBUTING.md
├── CODE_OF_CONDUCT.md
└── LICENSE
MIT