On this page12
- The gates, in the order a request meets them
- Four automatic gates in practice
- When a gate said no
- AI output is untrusted input
- Releases that roll back by themselves
- Human approval where it matters
- Security in the design, not added later
- How I work
- The same gates at any volume
- Frequently asked questions
- Examples on this site
- Planning an AI system that has to be trusted?
Part of AI engineering, intelligent automation and production systems. By Mohammad Javad Dastouri, full-stack and AI engineer.
Production systems need more than a successful demonstration. These are the controls I build into every AI system before it acts on real data.
- file fingerprints checked
- 1,360
- real API calls in each self-test
- 228
- releases shipped through the gates
- 193
The gates, in the order a request meets them
Input validation: Data is checked for type, size and format before anything uses it.
Access restrictions: Each user, key and service reaches only what it needs.
Controlled tool permissions: An agent can call only the tools it was given, for their stated purpose.
Output validation: AI output is checked against the expected structure and values.
Correction cycles: An answer that fails the check is corrected or refused, never passed on as it is.
Human approval: Critical production actions wait for a person to approve them.
Testing and deployment gates: A change that fails its tests does not reach production.
Error handling and monitoring: Failures are caught, logged and reported, so they are fixed, not discovered later.
Input validation: Data is checked for type, size and format before anything uses it.
Access restrictions: Each user, key and service reaches only what it needs.
Controlled tool permissions: An agent can call only the tools it was given, for their stated purpose.
Output validation: AI output is checked against the expected structure and values.
Correction cycles: An answer that fails the check is corrected or refused, never passed on as it is.
Human approval: Critical production actions wait for a person to approve them.
Testing and deployment gates: A change that fails its tests does not reach production.
Error handling and monitoring: Failures are caught, logged and reported, so they are fixed, not discovered later.
Four automatic gates in practice
On the TFI PHP App, which runs a group of client websites, every change must pass four gates. Any one of them can stop it.
Integrity
- What it asks
- Which files are the trusted ones?
- How
- Records the fingerprints of 1,360 files, so any later change shows up
Rule check
- What it asks
- Does the whole site still follow every rule?
- How
- About 60 groups of rules, including security, phone layout and structured data
Smoke test
- What it asks
- Is the live site up?
- How
- Opens the main pages at the public address
API self-test
- What it asks
- Does every API promise still hold?
- How
- 228 real calls, including refused writes, and it cleans up after itself
Integrity
- What it asks
- Which files are the trusted ones?
- How
- Records the fingerprints of 1,360 files, so any later change shows up
Rule check
- What it asks
- Does the whole site still follow every rule?
- How
- About 60 groups of rules, including security, phone layout and structured data
Smoke test
- What it asks
- Is the live site up?
- How
- Opens the main pages at the public address
API self-test
- What it asks
- Does every API promise still hold?
- How
- 228 real calls, including refused writes, and it cleans up after itself
When a gate said no
During one release, the rule check refused the version because of one line in the wrong place. No client site received it. The same day, the API self-test failed on a check that could never have passed: the feature was right and the test was wrong. A gate can be wrong too, so a failure gets read, never waved through.
AI output is untrusted input
I treat a language model like an outside service that can fail. Its output is merged onto safe defaults, checked for types and allowed values, and returned in the same shape even when the model fails. An AI outage then degrades one feature instead of breaking the system. See the output contract.
Releases that roll back by themselves
193 releases have shipped through these gates since 5 October 2026. On 3 November 2026, an update hit a database step that one site could not pass, and that site rolled itself back. The same release stopped on four more sites, which stayed on the previous version. Visitors kept a working site. How releases reach live sites.
Human approval where it matters
An agent is safe when it cannot finish an important job alone.
Bulk changes are previewed and confirmed before anything reaches a live site.
A row that cannot be written is reported, never skipped quietly.
Nothing reports success until the result has been read back.
An agent is safe when it cannot finish an important job alone.
Bulk changes are previewed and confirmed before anything reaches a live site.
A row that cannot be written is reported, never skipped quietly.
Nothing reports success until the result has been read back.
Security in the design, not added later
Integrations are designed with security in mind from the start: encrypted keys, restricted access and the least permission each part needs.
How I work
I take ownership of the tasks I accept.
I explain technical decisions in plain words.
I deliver the outcome that was agreed, and say early when something changes.
I take ownership of the tasks I accept.
I explain technical decisions in plain words.
I deliver the outcome that was agreed, and say early when something changes.
The same gates at any volume
Every delivery in a bulk order passes the same gates as a single project. The four automatic gates take about 5 minutes after each piece of work, so checking does not become the bottleneck.
How bulk orders work, step by step.
Frequently asked questions
Can AI be trusted with production actions?
With limits. It acts only through permitted tools, its output is checked, and critical actions wait for human approval.
What if a release breaks something?
The gates stop most problems before release. If an update still fails on a site, that site rolls back by itself to the previous version.
How do you prove a system works?
With automatic checks against the real public address, not only inside the code, plus written manual checks for what automation cannot see.
Examples on this site
Four gates every change must pass
How changes are held back until they are proven.
An output contract for AI
Model output checked before anyone relies on it.
Planning an AI system that has to be trusted?
Tell me what it must never get wrong. Or go back to the overview.
- Section
- Services
- Reading time
- 4 min read
Hiring for this kind of work?
Tell me about the role and I will reply by email.
Discuss a role with me
