Five controlled failure experiments with Qwen3, and what they reveal about AI Platform Engineering.
The LLM did exactly what I asked.
It selected the correct tool, supplied the expected arguments, and returned a structured function call.
The application still exposed another tenant's deployment information.
Not because the model hallucinated. Not because it misunderstood the request.
Because the application trusted a decision it should have enforced itself.
This happened in a deliberately vulnerable, local implementation using synthetic data. No real customer information was involved.
I built the experiment to investigate a question that becomes increasingly important as engineering teams introduce LLM-powered applications:
What guarantees does the application provide when the model behaves correctly, but its dependencies, permissions, or execution boundaries do not?
The result became the AI Platform Failure Lab: five controlled experiments comparing naive execution with explicit operational controls.
The experiment: one model, two execution paths
I used Qwen3 4B through Ollama's /api/chat endpoint.
The model generated a structured tool call:
get_deployment_status(
tenant_id="tenant_alpha",
service="payments-api",
environment="staging"
)
The test runner accepted the model's message.tool_calls output, not free-text instructions.
The same proposal was submitted to two execution paths:
- Baseline: intentionally naive behavior, with specific protections removed.
- Hardened: application-enforced authorization, timeouts, retry budgets, execution limits, and result validation.
The deployment records, identities, and dependency failures were synthetic.
The goal was not to benchmark Qwen3. It was to isolate what happens after the model proposes an action.
F01: A correct tool call can still cross a security boundary
Consider two fictional users:
Alice belongs to tenant A. Bob belongs to tenant B.
The model generates a valid deployment-status request targeting tenant A.
Under Alice's identity, both execution paths allow the request.
Under Bob's identity, the results differ:
- Baseline: Access allowed. One unauthorized datastore read.
- Hardened: Access denied. Zero datastore reads.
The tool call was identical.
The authorization boundary made the difference.
A tenant identifier supplied by the model is not proof of authorization. The application must establish the caller's identity, check permissions, and enforce the appropriate data scope.
This aligns with OWASP's guidance on Excessive Agency: models should operate through tools with constrained functionality and appropriate authorization.
Importantly, this was not a prompt-injection attack. It was a controlled test of an intentionally vulnerable execution boundary.
F02: A timeout is an application decision
Next, I introduced a synthetic tool that took approximately 300 milliseconds to respond.
The hardened executor had an 80-millisecond timeout.
The baseline waited approximately 300.5 ms and accepted the result.
The hardened executor stopped waiting after approximately 80.3 ms, returning TOOL_TIMEOUT with no verified deployment data.
That distinction matters.
A timeout is not merely an exception handler. It is a decision about how long an operation is allowed to consume the application's execution budget.
There is an important limitation: this experiment demonstrates cooperative cancellation of an asynchronous Python operation, not the ability to terminate arbitrary remote work.
The measurements also exclude model inference.
Cancelling our wait and proving that a remote operation has stopped are different guarantees.
F03: More successful retries do not necessarily mean better engineering
This experiment produced the most interesting trade-off.
A synthetic dependency returned three consecutive 503 errors before recovering on the fourth attempt.
The baseline retried four times and succeeded.
The hardened executor stopped after two attempts and returned:
RETRY_BUDGET_EXHAUSTED
At first glance, the baseline looks better.
It returned success. The hardened path did not.
But the baseline consumed twice as many dependency attempts.
Under sustained overload, additional retries can amplify pressure on a struggling system.
Other scenarios revealed similar problems:
- A
403response: the baseline retried; the hardened executor did not. - A
429with a 300 ms retry delay: the baseline retried immediately; the hardened executor respected its deadline. - A single transient
503: both implementations recovered.
The hardened policy used a 150 ms deadline for the tool operation. These values were chosen for the experiment, not as universal production recommendations.
The important question is not whether retries exist.
Who owns the retry budget, which errors are eligible, and when should the application stop trying?
AWS addresses these trade-offs in Timeouts, Retries, and Backoff with Jitter.
F04: The model should not control its own execution budget
Qwen3 generated one real structured tool proposal.
The runner then replayed that proposal three times.
The baseline executed all three submissions.
The hardened executor allowed one and rejected the remaining two with:
TOOL_CALL_BUDGET_EXCEEDED
Three proposals. One permitted execution.
The experiment did not involve an autonomous agent repeatedly deciding to call a tool. The additional proposals were synthetic replays.
What it demonstrated was a useful invariant:
The application can impose execution limits independently of the model's proposals.
A more complete agentic platform would extend this to model calls, tokens, elapsed time, and costs across the entire request lifecycle.
F05: A tool response is not automatically verified evidence
The final experiment examined what happens when a tool returns data that looks usable but violates the expected contract.
I injected three invalid responses:
- A failed deployment missing its required failure reason.
- A response referring to a different service.
- A deployment status outside the recognized values.
The baseline accepted all three as verified.
The hardened executor rejected them, returning structured errors such as:
INCOMPLETE_TOOL_EVIDENCE
TOOL_RESPONSE_MISMATCH
INVALID_DEPLOYMENT_STATUS
The distinction is simple:
Receiving data is not the same as verifying that it satisfies the application's contract.
Schema validation does not prove that the information is true. And this experiment did not generate a final natural-language response from the LLM.
Therefore, it would be incorrect to claim that F05 prevents hallucinations.
It demonstrates a narrower, enforceable guarantee: inconsistent tool evidence is rejected before being marked as verified.
Five experiments, one architectural lesson
The experiments tested five different execution boundaries:
| Experiment | Application-enforced guarantee |
|---|---|
| F01 — Authorization | Cross-tenant access denied before reading data |
| F02 — Timeout | Slow operations bounded by a deadline |
| F03 — Retries | Attempts constrained by error classification and budget |
| F04 — Execution | Tool dispatches limited independently of model proposals |
| F05 — Evidence | Invalid or inconsistent tool results rejected |
75 deterministic tests passed. The experiments were also executed with real Qwen3 tool proposals and synthetic dependencies.
The public repository contains the source code, experimental reports, SHA-256 checksums, and instructions for reproducing the results.
Reproduce the experiments
AI Platform Failure Lab — GitHub v1.0.0
Run the deterministic tests with:
python3 -m unittest discover -s tests -v
No GPU or commercial LLM API is required for these tests.
The live model-assisted experiments additionally require Ollama and Qwen3 4B.
What this laboratory does not prove
This is an experimental Python test harness, not a complete production AI platform.
It does not demonstrate production-grade authentication, distributed tracing, concurrent load handling, real network isolation, or a complete multi-turn autonomous agent.
The HTTP status values in the reports describe in-process results, not responses observed from a deployed HTTP server.
These limitations are part of the experiment's scope, not something to hide.
From working LLM integrations to operable AI platforms
Authorization, deadlines, bounded retries, resource budgets, and validation are not new engineering concepts.
They have been fundamental to reliable distributed systems for years.
What changes with LLM-powered applications is that model-generated decisions now participate in the execution path.
A model-generated tool call is a proposal, not an authorization.
The application must decide whether the action is permitted, how much work it may consume, which failures are recoverable, and what evidence is sufficient to report a verified result.
This is where traditional Platform Engineering connects directly with AI Infrastructure.
A working LLM integration demonstrates functionality.
An operable AI service requires enforceable runtime guarantees.
An AI platform makes those guarantees reusable and governable across applications and teams.
The experiments don't establish that I've built a complete AI platform.
They demonstrate why I would design its execution boundaries this way.
The most interesting part wasn't what the model decided. It was what the application allowed to happen afterward.
An independent engineering laboratory using local LLM inference and synthetic data, informed by my background in software engineering, cloud infrastructure, and production reliability. This is not a claim of operating a commercial LLM platform in production.
Source code and experimental evidence: AI Platform Failure Lab
© 2026 Rafael Terrero. Original article text and illustrations. All rights reserved, to the extent permitted by applicable law. Source code is licensed separately under the terms specified in the GitHub repository.


Top comments (0)