Architecture & Engineering Patterns
Reusable patterns for production AI systems. Architecture patterns show system shapes; engineering patterns show implementation techniques.
Architecture Patterns
· 11 patternsEngineering Patterns
· 14 patternsRetry failed requests with exponentially increasing delay, full jitter (randomised), a max attempt c…
View implementationDefine an ordered fallback chain of models. On failure (after retries), fall through to the next mod…
View implementationClassify query complexity and route to the cheapest model that can handle it, with fallback to stron…
View implementationCache LLM responses keyed by a hash of the canonical prompt. For semantic similarity, embed the quer…
View implementationStream tokens from the LLM to the client via Server-Sent Events as they are generated, so the user s…
View implementationConstrain decoding with a JSON schema (where supported), then validate the output with a strict sche…
View implementationRun an input guard before the model and an output guard before the response. Block, redact, or fall …
View implementationApply per-user, per-IP and global rate limits using a token bucket or sliding window, with a cost-ba…
View implementationTrack failures per downstream. When failures exceed a threshold, open the circuit and fail fast for …
View implementationSubmit work to a queue. Workers process jobs asynchronously. Clients poll or receive a webhook/SSE w…
View implementationVersion prompts as code. Tag, evaluate and deploy prompt versions through the same pipeline as appli…
View implementationPause the agent before destructive actions, persist state, request human approval, resume on approva…
View implementationTreat all untrusted text as data, not instructions. Use structured prompts with clear delimiters, sy…
View implementationStore secrets in a vault (HashiCorp Vault, AWS Secrets Manager). Fetch at startup or per-request wit…
View implementation