Living system · production patterns · trade-offs before recipes
Architecture Pattern Library
A reference library for the AI architecture decisions senior engineers actually face. Every pattern names its trade-offs and the case where it's the wrong choice — no recipe without the cost. Where we run one ourselves, the page carries the as-built evidence: what shipped, what is only wired, and what it cost.
The patterns
Cost · Complexity · When not to use
How do I stop an agent from running away?
The Bounded Agentic Loop: hard turn and tool-call ceilings, least-privilege tools, and graceful escalation instead of a runaway agentic loop burning budget or taking unsafe actions.
Cost · Complexity · When not to use
How do I make retrieval answers provable?
RAG with Grounded Citations: every retrieved answer carries its source passages, so a claim can be checked instead of trusted — the difference between a demo and a system you can ship.
Cost · Complexity · When not to use
How do I stop paying Opus prices for Haiku work?
Role-Based Model Routing: route each call to the cheapest model that meets its quality bar — hints to Haiku, tutoring to Sonnet, evals to Opus — instead of one model for everything.
Cost · Complexity · When not to use
How do I know a prompt change didn't make things worse?
Eval Harness as Release Gate: a scored eval suite runs before every prompt or model change ships, so regressions get caught by a number, not a user complaint.
Which agent actions need a human sign-off?
Human-in-the-Loop Approval Boundaries: draw the line between what an agent can do autonomously and what needs a human approve step — and where to enforce it so the boundary can't be bypassed.
What should an agent remember, where, and for how long?
Agent Memory and State: separate working context, session history, and durable per-user memory, each with its own storage and lifetime, instead of one growing context window.
One safety filter isn't enough — what are the layers?
Guardrails Defense-in-Depth: stack input filtering, bounded tool scope, output checks, and monitoring, because any single guardrail layer will eventually be bypassed.
Cost · Complexity · When not to use
How do I stop a poisoned doc from triggering a write?
The Capability Latch: once a turn ingests untrusted external content, its write-capable tools are switched off for the rest of that turn — set by a pre-scan of the whole turn, so tool ordering can't bypass it.
Cost · Complexity · When not to use
A rule keeps getting skipped — how do I make it stick?
The Deterministic Gate: when a rule is mechanically checkable, stop rewording the instruction and put the invariant in a check that runs as code and fails closed on the one path to production.
Cost · Complexity · When not to use
Why did an empty state show somebody else's data?
Fail Empty: a consumer that overwrites but never clears renders absence as a result — ship the empty state, delete the placeholder, and negate floor predicates so a malformed number falls on the side you chose.
Cost · Complexity · When not to use
How do I block a call that's only unsafe given what preceded it?
Sequence-Aware Authorization: make the allow/deny decision a predicate over the session's action history — ordering, argument provenance, exhaustion — and know the retry collision it creates before you ship it.
Cost · Complexity · When not to use
Why is my prompt cache never hitting?
Cache-Aware Prompt Layout: caching is an ordering commitment, not a flag — what must stay byte-stable, why the cheapest model is the hardest to cache, and the parallel fan-out that costs 3.8× a serialised call.
Cost · Complexity · When not to use
How do I cap agent spend somewhere my code can see it?
Enforceable Spend Ceilings: a dashboard limit is a control your bill has, not one your system has — where the ceiling belongs, why every cause returns the same 429, and what the user sees when it bites.
Cost · Complexity · When not to use
Does pinning a model id actually protect me from it changing?
Pinning a Model Is Not Pinning Its Behaviour: a pinned id protects you against retirement, with notice — it does not protect you against a deprecated parameter, a different serving backend, or a heavier tokenizer on the same id. What needs pinning is an eval, not an id.
Kept current, visibly
A stale pattern page is worse than none. Every page carries a dated last reviewed kicker, and the drifty facts — model names and pricing, guardrail feature sets, exam/framework numbering, provider API shapes — get re-checked on a schedule, not left to rot. That maintenance discipline is what the membership funds.
Learn the patterns, then build the system underneath them.
The patterns are free and public. The aiArch curriculum teaches the engineering underneath them — agents, retrieval, evals, and production architecture — on a platform that runs many of these same patterns in its own build.
See how aiArch helps senior engineers become AI-native, or compare Professional Membership pricing.
Free sample — no signup · every claim cited · full curriculum is waitlist-only