AI Architecture Patterns
One continuous payment-support story, starting simple and accumulating exactly the complexity a real production system needs β in the order a real one would need it. 16 patterns total, free to run locally, grounded in real AWS services.
Grounded RAG For Payment Support
The model answers confidently with zero real data. Retrieve first β the real transaction record plus matching policy text β then generate. Require citations. Never guess.
Prompt And Context Contract
It worked for one team. The second team plugged in and got a KeyError buried two layers deep. A versioned input/output contract catches the wrong shape before the prompt ever renders.
Structured Output And Validation
The answer looks right but the downstream router rejects it because the status word isn't in the allowed list. Parse and validate model output before it touches any consumer.
Evaluator Optimizer
The answer cites the right source but still misses the point. A second model call scores faithfulness and relevance β catching what a grounding check can't.
Tool Calling
Some questions need an action, not just a lookup β checking a live balance, opening a ticket. The model requests a tool call; your code executes it and returns the result.
What's next in the story
Patterns 06β16 aren't written yet β each one adds the next layer of production complexity the payment-support agent would actually need, in order. Numbered here because the order is the point: pattern 9 assumes pattern 6 already happened.
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16