Testing AI Systems: The Two Layers Teams Skip

Jul 28, 2026
read
Atulpriya Sharma
Sr. Developer Advocate
Improving
Read more from
Atulpriya Sharma

Table of Contents

Start your free trial.

Start your free trial.

Start your free trial.

Explore Testkube hands-on.
30 days
no commitment
$0
no credit card needed

Subscribe to our monthly newsletter to stay up to date with all-things Testkube.

Please disable pixel blocker extension
You have successfully subscribed to the Testkube newsletter.
You have successfully subscribed to the Testkube newsletter.
Oops! Something went wrong while submitting the form.
Jul 28, 2026
read
Atulpriya Sharma
Sr. Developer Advocate
Improving
Read more from
Atulpriya Sharma
Atulpriya Sharma
Sr. Developer Advocate
Improving
AI systems have four testable layers, and the two in the middle are the ones going unchecked. Here's where the risk sits and what has to change at the leadership level.

Table of Contents

Executive Summary

Quick answer
AI systems break into four testable layers: infrastructure, model, orchestration, and application. Teams test infrastructure and application well because those resemble problems they have already solved. The model's reasoning and the agent's orchestration logic go untested, and those are the two layers most likely to fail in production. Closing the gap takes continuous evaluation, a named owner for eval quality, real budget, and one place to see every signal together.

As AI systems moved into production, most engineering teams pointed their existing testing playbook at the new stack. Load testing got extended to cover model endpoints. Security testing got extended to cover prompt injection. CI gates stayed where they were. That is how every prior technology shift got absorbed, so the instinct made sense.

It was also incomplete. AI systems introduced two new layers, the model's own reasoning and the orchestration logic that strings its decisions together, and neither behaves like the systems that playbook was built for.

Why this is surfacing now

Part of why the gap went unnoticed is that agentic AI systems look familiar from the outside. They sit behind an API. They deploy through the same pipelines. They show up on the same dashboards as everything else in production. That surface familiarity is what let teams extend the old playbook, and why the extension felt sufficient.

Adoption has also moved faster than governance. Most enterprises still lack a mature governance model for autonomous agents, even as those agents take on more decision-making responsibility. Over 40% of last year's shipped code was AI-generated, a number large enough to force a testing conversation on its own, and confidence in that code has not caught up.

That volume is why continuous testing for AI-generated code became its own conversation. But that conversation covers the code the AI writes. The AI's own reasoning sits outside it.

The four-layer AI stack

Any AI system, whether a single model or a full agent chaining tool calls together, breaks down into four layers. Each one fails differently enough to need its own kind of testing.

Layer How it fails What testing looks like Tested well today?
Infrastructure GPU exhaustion, model load failures, retrieval index unavailable Load tests, chaos experiments, resource and readiness checks Yes
Model Output quality degrades, behavior drifts after an upstream update Continuous evals against a maintained golden dataset Rarely
Orchestration / agent Small early errors compound silently across a multi-step chain Trace-level assertions on tool calls, step outcomes, and retrieval accuracy Rarely
Application Prompt injection, guardrail bypass, hostile user input Red-teaming and adversarial security testing, run continuously Yes

Layer 1: Infrastructure

At the bottom sits infrastructure: compute, the model-serving layer, the vector databases feeding retrieval. This layer looks most familiar to anyone who has run load tests or chaos experiments, except the signals changed shape. You watch GPU memory instead of CPU utilization. You check whether a model finished loading instead of whether a process started.

Layer 2: Model

Above that sits the model itself: the raw output quality of whatever is doing the reasoning. Testing gets strange here, because the model does not return the same answer twice given the same input, and most testing careers were built on the assumption that it would. Pass or fail stops being a clean binary the moment non-determinism enters the picture.

Layer 3: Orchestration / Agent

Above the model sits orchestration, the agent layer: multi-step reasoning, tool calls, decisions about what to do next based on what just happened. The custom prompts, context, and RAG systems you have built on top of your LLM. Errors compound silently here. A small mistake three steps into a chain does not show up immediately. It shows up much later, as a visible failure that looks nothing like its actual cause.

Layer 4: Application

At the top sits the application layer: guardrails, the assumption that a user might be hostile, red-teaming against the system. This one is closer to familiar security testing, with one important difference. The attack surface never closes, because instructions and data share the same channel, so there is no version of "patched" that makes the problem go away for good.

Layers one and four get tested well, because they look like problems teams have already solved. Layers two and three do not.

Why this keeps happening, and what it costs the business

The gap between the model and orchestration layers does not persist because nobody has noticed it. It persists because processes that made sense for deterministic software stopped making sense the moment AI entered the stack.

The root causes

Non-determinism

The first habit is how teams treat non-determinism itself. A test that returns a different result on every run has traditionally been treated as a flaky test, a bug to chase down and eliminate. With a model in the loop, that variability is a property of the system. Treating it as something to engineer away means the testing quietly gets abandoned instead, since it never behaves the way a "fixed" test is supposed to.

Ownership

Most engineering organizations have someone whose job is to keep the test suite healthy and trusted. Almost none have an equivalent owner for eval quality, the thing that would actually tell you whether the model's reasoning holds up over time. Without an owner, evals do not get maintained. They get built once, usually for a demo, and forgotten.

Cost

Evaluating a model's output is not free the way running a unit test is free. It costs real compute and real money per run, and most teams never build that into a budget the way they budget CI minutes. So evaluation happens occasionally instead of continuously, and occasional evaluation of a system whose behavior can shift on its own is close to no evaluation at all.

Using AI to test AI

The fourth is a subtler trap: using AI to grade AI's own output. It is tempting, since it scales in a way human review does not, and it reintroduces the exact bias the evaluation was meant to catch in the first place. A model that is confidently wrong does not become a reliable judge of another model's confident wrongness just because it is doing the grading instead of generating.

The business cost

In a multi-step agent, an error does not show up where it happens. It compounds across every step that follows, and by the time it is visible, the actual cause can be several steps back, buried under everything that happened after it. Root cause analysis gets expensive and slow.

Behavior can also drift with zero code change on your end. A hosted model gets updated upstream. A retrieval index shifts underneath you. The system starts behaving differently for reasons that sit outside your Git commit history, and regressions stop being something you can bisect your way to.

Prompt injection sits in a category of its own. Because instructions and data travel through the same channel, it cannot be engineered away completely. It is a permanent risk that has to be managed on an ongoing basis.

How leadership needs to adapt

None of what needs to change here is exotic or complex. It is the same operating discipline most organizations already apply to infrastructure, extended to cover the model and orchestration layers.

Start with what "tested" means. Right now it is a pre-release gate, a checkbox before shipping. That definition does not hold for a system that can drift after deployment with no code change involved, so testing has to become continuous, watching production behavior alongside what happened in staging last week.

Human judgment has to stay in the loop. Letting AI grade AI's own output is efficient, and it reintroduces the exact bias the evaluation exists to catch, so quality assessment cannot be fully delegated away.

Then comes the budget. Evals need headcount and funding the way infrastructure does, as an ongoing line item rather than a one-time project that gets built and left alone. The golden dataset behind those evals, the examples a team trusts to represent real behavior, deserves an owner with the same accountability a production test suite owner has.

Unifying AI testing across the stack

All of it needs to be visible in one place. Most organizations already run separate tools for model evals, red-teaming, and agent testing, and that fragmentation recreates the problem fragmented QA tooling has always caused: no single view of whether the system is actually trustworthy. Centralizing those results is what turns scattered signals into an answer. It is the same tool-sprawl argument that has been made about traditional QA tooling for years, applied to a newer part of the stack.

This is where a test orchestration platform like Testkube fits. Testkube does not run the evaluations. It gives infrastructure, model, and agent signals one place to live instead of scattering them across dashboards nobody checks in the same sitting.

Testkube's AI agents already do a version of this at the infrastructure and orchestration layers, correlating test failures with environment state instead of leaving that correlation to someone cross-referencing logs by hand.

Test triggers extend that one layer further, kicking off workflows that evaluate retrieval accuracy and hallucination rates the moment a deployment or a prompt changes. For most organizations, extending the same principle across model and agent-level evals is the next step, and it builds on infrastructure they already run.

The two layers to fix first

Two of the four layers get tested well because they resemble problems teams have already solved. The model's actual reasoning and the agent's decisions as it strings tool calls together are the ones going unchecked, and they are also the ones most likely to fail once a system is making decisions on its own in production.

Closing that gap is less about buying a new tool than about giving the signals that already exist, from infrastructure monitoring to model evals to agent-level testing, one place to live and be acted on together.

Part 2 gets tactical: a walkthrough of what testing the model and agent layers actually looks like, with a working demo.

Frequently asked questions

What are the four layers of an AI system?
Infrastructure (compute, model serving, vector databases), the model itself (output quality of the reasoning), orchestration or the agent layer (multi-step reasoning, tool calls, prompts, and RAG), and the application layer (guardrails and adversarial input handling). Each layer fails in a different way and needs its own form of testing.
Why can't you test an AI model like normal software?
A model does not return the same answer twice for the same input. Pass or fail stops being a clean binary, so the useful signal comes from evaluating output quality against a maintained reference set over time rather than asserting a single expected result.
Is non-determinism the same thing as a flaky test?
No. A flaky test is a defect to fix. Model non-determinism is a property of the system. Treating it as a defect usually ends with the test being abandoned, because it never behaves the way a fixed test is supposed to.
Can you use AI to evaluate AI output?
It scales in a way human review does not, and it reintroduces the same bias the evaluation exists to catch. A model that is confidently wrong is not a reliable judge of another model's confident wrongness. Human judgment has to stay in the loop.
Why do AI systems drift without any code changes?
A hosted model can be updated upstream and a retrieval index can shift underneath the application. Behavior changes for reasons that sit outside your commit history, which is why testing has to run continuously against production behavior rather than only as a pre-release gate.
Where does test orchestration fit into AI testing?
A test orchestration platform does not run the evaluations itself. It gives infrastructure checks, model evals, red-team results, and agent-level tests one place to be triggered, executed, and reviewed together, so no single layer's signal disappears into its own tool.
Atulpriya Sharma
Sr. Developer Advocate
Improving
Read more from
Atulpriya Sharma

About Testkube

Testkube is the open testing platform for AI-driven engineering teams. It runs tests directly in your Kubernetes clusters, works with any CI/CD system, and supports every testing tool your team uses. By removing CI/CD bottlenecks, Testkube helps teams ship faster with confidence.
Get Started with a trial to see Testkube in action.