Architecture & AI patterns

How to structure a whole application, and how to build reliable systems around language models.

Architecture

Big-picture shapes for an application and its teams.

Event-Driven Architecture

Structure a system around events: components announce what happened, and other components react, instead of calling each other directly.

Hexagonal Architecture

Put the business logic at the centre with no dependencies on frameworks or databases; everything else plugs in through ports and adapters.

Layered Architecture

Organise an application into horizontal layers (presentation, business logic, data access) where each layer only talks to the one below it.

Microservices

Build a system as small, independently deployable services, each owning one business capability and its own data, run by one team.

Modular Monolith

One deployable application split internally into modules by business capability, each with its own code, data and public interface.

AI systems

Proven shapes for products built on large language models.

AI Agent

Let a language model work in a loop: decide the next action, call a tool, look at the result, and repeat until the goal is reached.

Evaluator–Optimizer

One model call produces a draft, another evaluates it against clear criteria, and the draft is revised until it passes or a limit is reached.

Guardrails

Check what goes into and comes out of a language model with separate, independent rules, so unsafe input and bad output are stopped before they cause harm.

Prompt Chaining

Break a task into fixed steps, each a focused model call whose output feeds the next, with ordinary code checking results in between.

Retrieval-Augmented Generation

Before asking a language model to answer, look up the most relevant passages from your own documents and give them to the model as context.