Home · Designing an AI Gateway for Enterprises · Part 14 of 17
Keep the glue thin, and write down how to remove it
Every architecture has seams. What you put in them decides how it ages.
Every architecture built from good building blocks has seams: the places where one block ends, another begins, and your own requirement sits between them. Much of the interesting engineering in this product lives in those seams.
Choosing good building blocks gets you most of the way. The rest is craft, and the craft is mostly restraint.
A worked example
The metering relay from earlier in this series is the clearest case. I wanted exact accounting of every request, streamed replies included, so I put a small component on that seam. I kept it narrow, and I wrote down what it is for.
That second part matters as much as the first. A component with a stated purpose can be reviewed, tested and retired. One without becomes folklore.
What I do now
- Change the question. "How do I force this block to do X?" is often the wrong one. "What is X really for?" sometimes has a simpler answer.
- Put a thin layer in the seam. Small, single-purpose, easy to throw away.
- Guard what you can't isolate. If you can't separate two things, at least watch the place where they touch.
- Treat every piece of glue as debt, and write down the exit. You should always know exactly what to delete, and when it would be time.
The discipline
The hard part isn't building the glue. It's remembering that it is glue. A piece with no note about why it exists becomes "how it works" within a year, and then nobody dares touch it. Worse, nobody notices when it has quietly stopped being necessary.
So each piece of glue in this product has the same three things written down: what gap it fills, what would make it obsolete, and what to remove when that day comes. It's a small habit, and it's the only reason I can describe the whole thing as clean.
Keeping the layers thin
A thin layer stays thin by saying no. Every time someone suggests adding "just one more thing" to the relay, the question is whether that thing is part of the seam or part of the product. If it isn't the seam, it belongs somewhere else, in a place that can be tested and replaced on its own. Layers that grow past their purpose stop being bridges and become load-bearing walls.
The same goes for choosing where to put a guard. Prefer the narrowest place that works, and prefer a place you can observe. A guard you can't see is a belief, not a control. None of this is glamorous. It is, though, the difference between a product that ages gracefully and one that needs a rewrite.
Why seams deserve names
Because seams are where architectures quietly rot. They belong to nobody's block, so nobody's roadmap covers them. Naming each one, giving it an owner and a written exit is cheap insurance, and it makes the next person's first week far easier.
Glue without an exit plan is just architecture you didn't choose.
Want to discuss this? Connect with me on LinkedIn.
Next: what an AI gateway really costs.