The Hidden Architecture of AI Systems: Why the Best Platforms Treat Recipes, Services, and State as Composable Contracts
Hatched by Kelvin
Jul 02, 2026
10 min read
3 views
82%
The real question is not how to build AI systems, but how to make them safe to change
Most teams ask the wrong question when they start building AI products. They ask: Which model should we use? Or: Which cloud should we deploy to? Or even: How do we get this demo working fast? Those are practical questions, but they miss the deeper one: How do you design an AI system so that it can evolve without collapsing under its own complexity?
That is the quiet thread connecting modern AI recipes, embedded cloud services, and microservice platforms. All three are trying to solve the same problem from different angles: turning a fragile prototype into a system that can be changed, moved, extended, and understood.
The surprising part is this: the winning architecture is not the one that centralizes everything into one perfect framework. It is the one that splits the system into small, legible contracts. A recipe becomes a deployable starting point. A service becomes code instead of configuration. State becomes a separate capability with a clear boundary. Together, they form a design philosophy that is bigger than any individual tool.
The best AI platform is not the one with the most features. It is the one that makes change cheap.
A recipe is not a product, it is a hypothesis
There is a subtle but powerful idea behind a good AI recipe: it should not be treated as a finished artifact. It should be a pre-packaged starting point, a template that demonstrates a known pattern and then invites modification. That changes the role of infrastructure entirely.
In a traditional software project, setup often behaves like a one-way door. You spend days wiring containers, ports, model endpoints, libraries, and environment variables. By the time the application is running, the implementation has already hardened into assumptions. The result is a brittle demo that works only in one context, or a snowflake environment that nobody wants to touch.
A recipe-based approach reverses that logic. The repository is organized around repeatable building blocks: an application descriptor, a client container, a model service, perhaps a vector database. Each piece is explicit. Each piece can be swapped. The recipe is not pretending to be universal. It is making a claim about a useful shape.
This matters because AI systems fail in a special way: they often begin as a single impressive demo and then immediately need to become three different things. A chatbot becomes a support assistant. A vision demo becomes a document pipeline. A local prototype becomes a production service. If the original structure cannot survive that transition, the system was never really an architecture, only a screenshot.
A recipe, done well, is an answer to that fragility. It gives teams a way to start from a proven pattern, then mutate it deliberately.
Think of it like a mechanical watch movement. The point is not that every watch should look the same. The point is that the gears, springs, and escapements are arranged in a way that can be inspected and adjusted. A good recipe makes the invisible visible: where the app begins, where the model lives, where state is stored, and how all of it is packaged for deployment.
Embedded cloud turns infrastructure into code, and code into infrastructure
There is another shift hiding in plain sight: the move from declarative infrastructure files to embedded cloud capabilities.
At first glance, the distinction seems minor. One system describes services in YAML. Another system calls a library function like service(...) or InternalService(...) directly inside the program. But the difference is philosophical. In one model, cloud behavior is external choreography. In the other, cloud behavior is part of the application's language.
Why does that matter? Because the more layers you add between intent and behavior, the more opportunities you create for drift. YAML can be powerful, but it lives beside the application, not inside it. That often means there are two versions of reality: what the code does, and what the deployment says it should do. Over time, those diverge.
Embedding cloud capabilities directly into code creates a tighter contract. Your application declares not just what it computes, but how it should live. A service is no longer an afterthought bolted on through separate configuration. It is a callable capability that can be reasoned about, tested, and reused like any other library.
This has an important consequence for developer experience: local development and cloud deployment stop being two different worlds. If the same code can run locally and in the cloud with minimal or no changes, then the boundary between environments becomes a detail, not a design principle. That is a profound upgrade in mental model.
Instead of asking, “How do I translate this app into cloud form?” you ask, “What does the app need, and how do I express those needs as code?” The platform becomes less like a destination and more like a runtime contract.
This is the real power of embedded cloud. It eliminates the false split between application logic and infrastructure logic. The infrastructure is no longer a separate ritual performed after development. It becomes part of the programming model itself.
Microservices are useful not because they are small, but because they create clean seams
Microservices have a reputation problem. People hear the term and think of distributed complexity, network latency, and endless DevOps overhead. That reputation is deserved when microservices are treated as a default. But in a well-designed system, microservices are not about fragmentation for its own sake. They are about creating clean seams where different concerns can evolve independently.
That idea becomes much more interesting when paired with embedded cloud capabilities and modular AI recipes. Suddenly, a microservice is not just an HTTP endpoint. It is a named role in a larger composition. One service may be external, another internal. One may manage user data, another may call a model server, another may proxy requests from the outside world to the inside.
The point is not that every component should be independently deployed because that sounds modern. The point is that different kinds of change happen at different speeds. Model selection changes at one pace. UI changes at another. Data storage and retrieval change at yet another. If you force all of those concerns to move together, you create friction. If you separate them cleanly, you create room for adaptation.
Consider a simple example. A chat interface is mostly a presentation problem. A model server is mostly a reasoning or inference problem. A vector database is mostly a retrieval problem. These are related, but they are not the same problem. Keeping them distinct means you can improve retrieval without rewriting the UI, swap the model without rethinking persistence, or add a new input mode without touching the storage layer.
This is where a useful mental model emerges: each boundary should exist because it reduces the blast radius of change.
A bad boundary is one that exists only because the platform expects it. A good boundary is one that lets you ask, “If this part changes, what else breaks?” The smaller the answer, the better the boundary.
State is the hardest part, so it should be the most intentional part
Every serious application eventually becomes a state management problem. AI applications are no exception. In fact, they often make state even trickier because they add new dimensions: conversation history, embeddings, user profiles, cached outputs, retrieval indexes, and model artifacts.
That is why the clean separation of compute, interface, and state is such an important architectural pattern. A model server can be stateless in one sense, while a data store holds the memory of the system. The app can render results and forward requests, while Redis or a vector database preserves continuity between sessions. The cloud platform can expose a tunnel or internal endpoint to manage that state without collapsing the boundary between service and storage.
This separation is not merely convenient. It is a way of making the system legible.
When state lives everywhere, debugging becomes archaeology. When state is centralized into clearly named stores, you can reason about the system like a ledger. You know where identity lives. You know where cached information lives. You know where retrieval happens. And because the access method is explicit, you can recreate behavior locally and then reproduce it in the cloud.
That matters enormously for AI systems, where the difference between a great demo and a trustworthy product often comes down to whether the data path is understandable. If a user asks a question and gets the wrong answer, was the prompt wrong, the model wrong, the retrieval wrong, or the state stale? You cannot answer that unless your architecture preserves the boundaries.
In AI systems, the most expensive bugs are often not in the model. They are in the invisible pathways between model, memory, and interface.
Seen this way, a vector database is not just another dependency. It is a memory contract. A Redis instance is not just a cache. It is a shared assumption about persistence. A service tunnel is not just a convenience. It is a way of making the hidden state inspectable without breaking the deployment model.
The deeper synthesis: AI platforms are becoming composition engines
Taken together, these ideas point toward a bigger thesis: the best AI platforms are not model platforms, they are composition engines.
That sounds abstract, but it has practical consequences. A composition engine does not try to solve every problem directly. Instead, it gives you reliable ways to assemble components that already know how to cooperate. A recipe tells you how to package the application. A model server tells you how to host inference. A vector database tells you how to store semantic memory. An internal service tells you how to isolate concerns. A cloud runtime tells you how to move the same composition between local and remote environments.
This architecture is valuable because AI products are not single machines. They are ecosystems of interacting parts, each with its own lifecycle. The interface may change daily. The prompt may change weekly. The model may change monthly. The infrastructure may need to survive all of that without being rewritten every time someone wants to test a new idea.
Here is the useful mental model: treat every part of the system as a contract for change.
- The recipe contract says how to bootstrap a new idea.
- The service contract says how logic is exposed.
- The state contract says what persists and how it is accessed.
- The deployment contract says what can move from local to cloud without rewriting.
When these contracts are clear, innovation gets faster because the team spends less time reassembling basics. More importantly, the team can experiment without fear of entangling everything else.
This is especially important in AI, where uncertainty is the default. You do not know whether the model choice is final. You do not know whether retrieval will need to become multimodal. You do not know whether the UI will become a chat, a workflow, or a background agent. A composition-oriented platform accepts that uncertainty and makes it manageable.
Key Takeaways
- Design for change, not for completion. A good AI system should be easy to revise as models, interfaces, and data needs evolve.
- Keep boundaries explicit. Separate app logic, model hosting, and state storage so that each can change with minimal collateral damage.
- Treat infrastructure as part of the programming model. Embedding service definitions into code reduces drift between intention and deployment.
- Use recipes as starting points, not endpoints. The best templates are meant to be modified, not preserved.
- Measure architecture by blast radius. The best boundary is the one that localizes the impact of change.
The architecture that wins is the one you can still understand six months later
There is a temptation in AI engineering to equate sophistication with scale: more models, more YAML, more services, more orchestration, more everything. But the real sophistication is harder to see. It is the ability to make a system that remains intelligible as it grows.
That is why the convergence of recipes, embedded services, and modular state matters. It points toward a different ideal of engineering. Not maximal abstraction. Not maximal automation. Maximal adaptability with minimal confusion.
A system built this way does not ask developers to memorize a maze of special cases. It asks them to work within a small number of clear contracts, each of which makes the next change easier than the last. That is what makes a platform durable.
So the next time you evaluate an AI stack, do not just ask whether it runs a model. Ask whether it gives you a structure for evolving the whole application. Because in the end, the question is not whether you can ship an AI demo. The question is whether you can keep improving it without losing your grip on how it works.
That is the difference between a prototype and a platform.
Sources
Hatch New Ideas with Glasp AI 🐣
Glasp AI allows you to hatch new ideas based on your curated content. Let's curate and create with Glasp AI :)
Start Hatching 🐣