Home › Key concepts › Ports and adapters

Key concept · Run (advanced) · the same on every platform

Ports and adapters

Code to an interface, so you can swap a vendor without a rewrite.

What it is

A port is an interface your code depends on, such as 'store a file' or 'call a model'. An adapter implements it for one product: S3, Blob Storage, Bedrock, Gemini. Your core logic never names the vendor.

Why it matters

Clouds, models and tools change fast. Swapping one should mean writing one adapter, not rewriting the system.

An example

The same agent runs on Azure and AWS; only the model and storage adapters differ, and the same tests pass on both.

The common mistake

Calling one vendor's SDK from fifty places in the code.

Where you meet it on each platform

The idea stays the same; only the product name changes.

JobAWSAzureGoogle CloudDatabricksOpen source
A language, properlyPython first: functions, classes, tests, packagingPythonPythonPythonPythonPython

Related ideas

Where it shows up

Part of the Run level on these paths: AI Engineering (engineering basics) · Software Engineering (running services) · Forward Deployed Engineering (scale).