Your team wants an AI feature, and you’re the one who has to work out how it fits the existing codebase, data and security model. Here’s how I think about it, from context and trust boundaries to the deterministic gates that keep a non-deterministic model in check.
This video walks through the architectural decisions you need to make before writing a single line of agent code, using a real scenario (fulfilling a customer order) to show where the model’s job ends and your architecture begins.
Transcript
00:00 The model is the easy part
So, your team is about to build an AI feature, and you were tasked with figuring out how it actually connects to your system, but you don’t even know where to start. The fear of being the person in the room who is expected to have the answer for how this thing fits into the existing codebase, the existing data, and the existing security model overwhelmed you, and you started to doubt yourself. Does that sound familiar to you?
Believe it or not, in this case, the LLM model is the easy part. The hard part is the architecture around it, and here’s why. The model is just an API call. So you send text in, and you get text out. You didn’t have to train it, host it, or maintain it. Someone else spent billions of dollars making it intelligent. You’re consuming that intelligence for pennies per request. But accessing to a capable model only solves one part of the problem.
Now, think about what happens the moment you want that intelligence to do something meaningful in your system. For example, answering a simple question from a customer such as “Can you deliver 500 units by Friday?” The model might interpret the request and propose splitting the shipment between warehouses. That is useful reasoning, but fulfilling the request is a different story. It requires additional context.
The model doesn’t know who your customers are, you have to bring it that context, which may require integrating with your CRM, your ERP system, your document store, and decide how fresh that data needs to be, how much to spend, and in what shapes. That’s a staleness problem, an integration problem, and a data modeling problem. On top of that, the model doesn’t know what it’s allowed to see. If you’re in a multi-tenant system, you probably don’t want the model to answer questions about customer B using customer A data, you need to build a scoping layer.
02:05 Deterministic gates around a non-deterministic model
Now this is nothing new. This is the same trust boundary problem you already deal with in every data query path you have written. Except now the user making the queries is a non-deterministic reasoning engine. The model by itself can’t do anything meaningful. Sure, it can produce text, but for that text to become a reserved inventory line, an updated order, or a triggered workflow. You have to build the action layer, and every action introduces potential failures.
Consider what happens if the model proposes two actions, and the first commits before the second is rejected. For example, what if the reservation succeeds but the notification fails? The model doesn’t know when it’s wrong, it would confidently propose something that could violate a business rule. For example, order greater than $500 requires a human approval. So you need validation gates, authorization checks, and spending limit.
In other words, deterministic boundaries around a non-deterministic component. And where you draw that line is an architectural decision with real trade-offs in both directions. Okay, so where do you actually draw that line? That’s the next question. Your first instinct might be to try to make the AI more controlled by constraining its output, narrowing its options adding more rules to its prompt until it behaves more deterministically.
But that’s the wrong direction. If you wanted deterministic behavior, you would just write a rules engine. The whole point of using AI model is that it can handle ambiguity, interpreting vague requests, weighing options, reasoning through trade-offs that a static rule set can’t express. So here is the core model. Let the AI be open-ended where ambiguity is useful. And only put deterministic gates around the parts where business cannot tolerate improvisations.
04:11 AI proposes, your system decides
So let’s go back to our example. A customer asks, “Can you deliver 500 units to our Detroit warehouse by Friday?” This is where open-ended reasoning actually earns its keeps. The AI checks inventory across locations and see Warehouse A has 300 units, Warehouse B has 250 units. Now it can reason. Maybe we can split the shipments across both warehouses. Maybe expedite shipping on one leg. Maybe offer a substitute SKU.
Or maybe ask the customer if partial delivery by Friday with the rest on Monday is acceptable. A rules engine would need every one of those paths hard-coded. The AI can explore all those options, and that’s the beauty of the open-ended reasoning. But here’s the critical part: the AI produced a proposed plan, like reserve 300 from Warehouse A and 200 from Warehouse B, and expedite both. That proposal now hits a series of deterministic gates, the inventory service may have to check.
Are 300 units actually available in Warehouse A right now? It involves real queries against real inventory state to get the definitive yes or no answer, not the maybe. The contract service may need to check: is the customer entitled to expedited shipping under their current agreement? The pricing engine calculates actual shipping costs instead of an estimated cost by the model. And finally, the authorization policy checks: is this agent permitted to commit $7,500 of expedited shipping without human approval?
So as you can see here, each side does what it’s good at. The AI handles interpretations and planning. Your system handles validations, authorization, and executions. So, the core pattern here is: AI proposes and your system decides. Now, what we just walked through here, the context layer, the trust boundaries, the validation gate, the action layer, the industry has a name for it, and they call it AI harness.
06:26 The model is interchangeable; the architecture isn’t
Salesforce recently formalized it as a six-capability architecture. But the underlying principle that I want you to take away is this: first of all, the model is interchangeable. The architecture that connects it to your enterprise is the real product. What this means is that two companies can use the same exact model and get wildly different values from it. The difference isn’t the intelligence in the model, as they’re both calling the same API.
The difference is what each company built around it, how well they connect the model to their customer data, their business rules, their workflows, and their security model. That’s connecting architecture is unique to your organization. It’s built on decades of accumulated domain knowledge, data relationships, and business logic that no model provider ships out of the box. And when a better or cheaper model comes out next month, the company that architected a clean separation between their enterprise context and the model layer just simply swapped the model.
By contrast, the company that entangled everything with one provider’s specific API shape has a migration project on their hands, and that is what makes or breaks an architectural design. The second principle for you to take away is: the skill of designing that architecture are the same architectural thinking that you’re already familiar with, but apply to a new kind of component. The AI model is itself just a component in the system.
Yes, it has some unusual properties, like it’s non-deterministic, it needs context fed to it and it can’t enforce its own permissions. And those properties inflate certain concerns such as trust boundaries get heavier, validation gates become more critical, but the skill of identifying which concerns are inflated and choosing the right mechanism and trade-offs for them, that’s the same skill. So, I hope you find this video useful.
08:38 Wrapping up
If you’re interested in this topic, AI harness, and would like to dive more into it, like the video and drop a comment below so I know what content serves you well. Thank you and I’ll see you next time.
Loading comments…
Comments aren’t loading right now.
The post is unaffected; the comment service didn’t respond. Try again in a moment, or come back later.