Modularity and Component Design in AI Applications
Observability means understanding how a system fails, designing metrics and alerts around those failures, and building the system so failures are detectable and traceable.
A Launch That Starts Going Wrong
Imagine you have built an application that sends user requests to a foundation model and returns the model's answers. It works well in your tests. Then, a few weeks after launch, users start reporting responses that seem wrong, slow, or unsafe. The first question is not how to fix the problem. The first question is how you would have known about it at all. Could you see that something had gone wrong, find where it went wrong, and tell the difference between a single odd answer and a real pattern?
This article follows that question step by step. You will watch a failure move through the components of an AI application, see how it can be made detectable and traceable, and learn why every added component brings new ways to fail. The idea that answers the question is called observability, and it asks you to think about failure before failure happens.
Following a Failure Through the Pipeline
An AI application is usually separated into components, and each component has a clear job that you can reason about on its own. The boundaries between components are rarely as clean as a diagram suggests, but a simplified chain is enough to trace how a fault spreads. In the example below, which is an illustrative design rather than a fixed architecture, a request passes through a retriever, a prompt builder, a model call, and a guardrail before the answer reaches the user.
Suppose the retriever returns documents that do not match the question. The prompt builder does not check the relevance of those documents; it assembles a prompt from what it receives. The model call then produces an answer grounded in the wrong material. Nothing in that chain necessarily raises an error, so the bad output first becomes visible at the end of the chain, to the user, unless something upstream recorded what happened. The place where a failure starts and the place where it is seen can be far apart. That gap is the central problem observability is designed to close.
Three Parts of Observability
Observability means understanding how a system fails, designing metrics and alerts around those failures, and building the system so failures are detectable and traceable.
The definition has three parts, and they depend on one another. The parts are worth taking in order, because each one relies on the one before it.
- 1Understand the ways the system can fail. These are its failure modes, meaning particular ways it can go wrong.
- 2Decide what to measure and what should trigger an alert, based on those failure modes.
- 3Build the system so the measurements are possible and a failure leaves a trail someone can follow.
A system with excellent dashboards but no way to connect a bad answer to the request that produced it is only partly observable. The dashboards may show that something changed, but without the trail, a team cannot find out which request and which step were responsible.
Much of what you already know about monitoring software applies here too. Software engineering has long offered practices for logging, tracing requests, watching resource use, and paging someone when a service degrades. Traditional machine learning has its own practices for tracking model behavior over time. You should reuse these tools rather than reinvent them.
The difficulty is that foundation models introduce failure modes that those existing practices were not built to catch. The model's behavior is produced by the model rather than written line by line by your team, so the ways it can misbehave do not always match the failures your existing dashboards were designed to show. The metrics you already collect may be necessary but not sufficient, and you will need additional metrics and design decisions aimed at the failures a foundation model can cause.
How a Failure Becomes Traceable
Traceability depends on what the system records while it is handling a request. The sequence below shows an illustrative order of events in a system designed for observability. A user sends a request, the application calls the model, and the answer returns. Along the way, the application writes records to a telemetry store, so that a failing step can be located after the fact.
The order matters. The telemetry records are written during the request, not reconstructed afterward from memory. If the record of the request and its component calls exists, a team can start from a complaint and move backward to the step that failed. If the record does not exist, the bad answer is only a complaint, and it cannot be connected to anything the system did.
Locating a bad answer after the fact
A user reports an unsafe answer that the system gave yesterday. How can the team locate the failing step, and then decide whether this was a single odd answer or a real pattern?
- 1Find the request
Because the system was built to link a bad answer to the request that produced it, the team starts from the user's report and finds the matching request record.
- 2Check the component records
Each component call the request passed through leaves a record, so the team can see what the retriever returned, what the prompt builder assembled, and what the model call produced.
- 3Locate the failing step
The team compares the records and sees the step where the output first went wrong, instead of guessing from the final answer alone.
- 4Count similar requests
Metrics across many requests show whether the same failure repeats, which answers the launch question about telling one odd answer apart from a real pattern.
The failing step is identified, and the team knows whether the problem is an isolated answer or a recurring pattern that needs an alert and a fix.
Components That Add New Failure Points
Separating an AI application into components keeps the system easier to change and to maintain. Each component can also be reasoned about on its own. But each addition changes the set of places where things can go wrong. A retrieval step, a tool call, or a guardrail added to a model-only system each brings its own failure points, along with the benefits it was meant to provide.
A guardrail is a good illustration. It is a check that screens what goes into or comes out of a model, for example to block content you do not want the application to produce. A guardrail can be implemented in the inference service that runs the model, in the model gateway that routes requests, or as a standalone component of its own. The job stays the same in all three cases. What changes is where the check lives and which other parts of the system must know about it.
Placement matters for observability. If the check is buried inside the inference service, its decisions may be visible only in that service's records. If it is a standalone component, it can report its own measurements separately, but you now have one more piece to monitor and one more place where things can go wrong. Either way, the guardrail adds failure points of its own, such as blocking an answer that was acceptable or letting through one that was not. Those are generated examples of the kind of failure a team should plan for, not outcomes stated in the source.
Mapping Metrics and Alerts to Failures
You cannot design useful metrics and alerts until you know which failures matter for your application. Identifying the failure modes comes first, and the records, metrics, and alerts follow from them. An alert is useful only when it is tied to a metric that matters, and a metric is useful only when the system actually produces the information it measures.
The map above is a generated illustration of the method, not a fixed list. Each failure mode from the launch scenario is paired with a signal that would reveal it, and each signal is assigned to the component that produces it. Notice that the metrics follow from the failure modes. Starting from the dashboards and asking what they show would invert the order the source recommends.
Common Mistakes in Observability Design
Common mistake Treating observability as something to bolt on after an incident
Why it failsObservability depends on the system producing measurements and traces while it runs. Adding them after a failure means the evidence for that failure may already be gone.
Do this insteadDesign the records, metrics, and alerts into the system from the start, based on the failure modes you expect.
Common mistake Collecting metrics before deciding which failures matter
What it looks likeA dashboard filled with request counts and throughput, with nothing tied to wrong or unsafe answers.
Why it failsMetrics are derived from failure modes. Without them, the numbers may look healthy while the failures users care about go unseen.
Do this insteadList the failure modes first, then choose the metrics and alerts that watch each one.
Common mistake Assuming existing dashboards will catch model misbehavior
Why it failsFoundation models introduce failure modes that existing practices were not built to catch, so the metrics you already collect may be necessary but not sufficient.
Do this insteadKeep the existing monitoring tools, and add metrics and design decisions aimed at the failures a foundation model can cause.
Common mistake Having dashboards with no link from a bad answer to its request
Why it failsA system like this is only partly observable, because a team can see that something changed but cannot find the request and step responsible.
Common mistake Placing a guardrail without recording its decisions
What it looks likeA guardrail inside the inference service whose decisions are visible only in that service's own records, which no one checks.
Why it failsA check that screens inputs or outputs is a component too. If its decisions leave no trail, its failures cannot be detected or traced.
Do this insteadDecide where the guardrail lives, and make sure its decisions and measurements are recorded where your team will look.
Practice: Planning the Signals
A team adds a retrieval step and a guardrail to a chatbot that previously sent user messages straight to a model. List the new failure points this creates. For each one, propose one metric and one alert, and name the component that produces the signal.
Hints
- Start with the failure modes, not the dashboards.
- Ask where a bad output would first become visible to the user, and whether a record exists upstream of that point.
- The guardrail can live in the inference service, the model gateway, or as its own component. Decide where its decisions will be recorded.
Summary of the Method
- 1Observability means understanding how a system fails, designing metrics and alerts around those failures, and building the system so failures are detectable and traceable.
- 2A failure can start in one component and surface far downstream, so the trail of records matters as much as the final answer.
- 3Each added component, such as a retriever, tool call, or guardrail, can improve capability, safety, or speed while adding complexity and new failure modes.
- 4Identify the failure modes first, then design the records, metrics, and alerts that follow from them.
At a glance
- Observability means understanding how a system fails, designing metrics and alerts around those failures, and building the system so failures are detectable and traceable.
- A failure can start in one component and become visible only at the end of a pipeline, so records made during each request are what allow it to be traced.
- Adding components such as a retriever, tool call, or guardrail can make a system more capable, safer, or faster, but each addition also adds complexity and new failure modes.
- Foundation models introduce failure modes that existing monitoring practices were not built to catch, so you identify those failure modes first and then design the metrics and alerts that follow.